Hey ppl. I decided to make an associative array to store usernames and passwords temporarily. but im having problems, the script ive wrote always complains that the username and password given doesnt match!
My code:
if($_GET["auth"] == "do")
{
$users = array("username" => "bob",
"password" => "blah");
$username = $_POST["username"];
$password = $_POST["password"];
foreach($users as $key => $val)
{
if($username != $val && $password != $val)
$error = true;
}
if($error)
{
echo "<body bgcolor=\"#333333\" text=\"#fcd211\">
<font color=\"#FF0000\">Error:</font>Username or Password not recognised.
Please try again.
<hr>
<a href=\"javascript:history.back(-1)\"><< Back</a>
</body>";
die();
}
Help appreciated, thx.