Hi,
I am running Windows version PhP4.2.2 on IIS. I have created a simple Login HTML form(p-10-1.htm) and a simple validation PhP script p-10-1.php. Not sure what is wrong with the p-10-1.php script as it's not validating the $username and $password. It seems to accept anything and everything which it shouldn't. Please help....thanks,
-----p-10-1.php --------------
<?php
//create password and login with cookies
$passwords = array("bill" =>"apple",
"charles"=>"potatoe",
"david"=>"igneous");
if ($_post[password] == $passwords[$_post[username]])
{
setcookie("$_post[username]", $_post[username], time()+1200);
echo "<h2>Access Granted</h2>";
}
else
{
setcookie("$_Post[username]","",time()-3600);
echo "<h2>Invalid user name or password: ACCESS Denied </h2>";
}
?>
-----p-10;1.html------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Prohect 10 -1</title>
</head>
<body>
<form Method="post" action="p-10-1.php">
<h2>Project 10-1: Login page </h2>
<br><br>
User Name :
<br><Input type="text" name="username" size="16">
<br><br>
Password:
<br><input type="text" name="password" size="16">
<br><br>
<br><br><input type="Submit"> <br><input type="reset">
</form>
</body>
</html>