Please
can someone help me find a simple tutorial or script on how to make a login page with a form for username and password, that will redirect through the header if the username and password are correct. I have tried doing this with a book and a php-forum but with no result really. I got this far. It doesn’t “accept” the password however and I get a header saying …php?Message=Invalid.
Here is the code:
<?php
if (( $_POST ['username'] == "larry") && ($_POST ['password'] == "opensesame" )) {
print "valid";
}
?><title>LOG - IN</title>
<form method="post" action="HandleLogin.php">
<center><p>PLEASE FILL IN:</p>
<p>Username:*<input type="text" name="username"></p>
<p>
Password:*<input type="text" name="password">
<br>
<br>
<input type="submit" name="submit" value="SUBMIT">
</p></center>
</form>
on the HandleLogin.php I have:
<?php
if(($password=="opensesame") && ($username=="larry")){
header("Location:index.php?username=$username");
exit;
} else {
header("Location:login2.php?Message=Invalid");
exit;
}
?>
Hoping for help!