Hi. I'm a newbie to php and have created a login form that does not use an sql database. After inputing all the code I've tested it in IE and it doesn't work properly. If I leave the username and password blank but hit the submit button, it takes me to the page that is suppose to be restricted to those who put in the correct username and password. Even if I put in the wrong username and password, it takes me to the restricted page. I can't figure out if i've left out something or if I should just give up and go with using the sql database. Below is my code. Please help.
Thanks
<?php
?>
$username = "admin";
$password = "adminpass";
if(isset($_post['user'])&&isset($_post['password']))
{
if($username == $_post['user'] && $password == $_post['password'])
{
?>
<form name="form" action="membersonly-content.html" method="post">
<?php
}
else
{
die("your login information was incorrect");
}
}
else
?>
<h1>Login</h1>
<label for="txtusername">Username:</label>
<input type="text" title="enter your username" name="textusername"/> </p>
<label for="txtpassword">Password:</label>
<input type="password" title="enter your password" name="txtpassword"/> </p>
<input type="submit" name="submit" value="login"/></p>
</form>
<?php
}
else {
?>
</php>