|
Posted by shimmyshack on 09/10/07 12:59
On Sep 10, 11:32 am, blesso...@gmail.com wrote:
> hai all,
> I am very new to this php language.I want to create a
> webpage with php ,in the first page there is two text boxes are there
> one for username and other for password so when ever then user should
> give the correct username and password,how should i give link to the
> next page in php.plese help me..
the very simplest way to do this is to have one page with the form
--http://server.com/login.html
<form method="post" action="protected.php">
<input type="text" name="username"/>
<input type="password" name="password"/>
</form>
--protected.php
<?php
$user = 'me';
$pass = 'hello_world';
if( $_POST['username']!=$user || $_POST['password']!=$pass )
{
header( 'http://server.com/login.html' );
exit();
}
else
{
//place your protected page here
}
?>
of course then you would go firther and do what Wewin suggests and use
sessions and pasword encryption and so on....
Navigation:
[Reply to this message]
|