Any ideas why the code below would only be accepting the final username and password from the array (all others return failed). The code appears exactly i.e. In my newb way I wonder whether having numbers in the $users[here] stuffs it up?
<?php
$Username=$_POST['username'];
$Password=$_POST['password'];
$loginpage = "http://www.google.com.au/clients/login.php";
$failedpage = "failed.html";
session_start(); # must do this on each page a $_SESSION var is needed/used
$users = array();
$users[0] = array("user", "pass", "user/index.php");
$users[1] = array("user1", "pass1", "user1/index.php");
$users[2] = array("user2", "pass2", "user2/index.php");
$users[3] = array("user3","pass3", "user3/index.php");
$members = count($users);
for($x=0; $x<$members; $x++){ # loop 4 (number of members) times...
if(($Username==$users[$x][0])&&($Password==$users[$x][1])){ #if the posted username and password match a user's then:
$_SESSION['loggedin'] = 1; # assign a logged in status to this var
$_SESSION['member'] = $x; # assign the user's number to this var
$successpage=$users[$x][2];
header("Location: $successpage"); # send this user to his successpage
}else{
header ("Location: $failedpage"); # send this user to the fail page
}
} # if none of the 3 user/pass combos match, then:
?>
Thanks in adv.