NEW CODE AS YOU PUT ^^
<?PHP
$usernames = array('admin','harts');
$passwords = array('admin','harts');
$page = array('index.php','Harts.php');
// Count the amount of users in array.
$count_users = count ($usernames);
// Set users found to "0"
$user_found = '0';
// Set username and password variables from $_POST data.
$username = $_POST['username'];
$password = $_POST['password'];
// Check to see if we gave a match in usernames
// If we have a match set a cariable with the record number
// Update "$user_found" if we find a match
for($u=0; $u<$count_users; $u++) {
if($username == $usernames[$u]) {
$userRecord = $u;
$user_found = '1';
}
}
// If no user is found, login has failed. Re-direct back to login.
if(!$user_found) {
header('Location: login.php?value=fail');
exit;
}
// If usernames don't match, login has failed. Re-direct back to login.
if($usernames[$userRecord] !=$username) {
header('Location: login.php?value=fail');
exit;
// If passwords don't match, login has faled. Re-direct back to login.
} else if($passwords[$userRecord] !=$password) {
header('Location: login.php?vale=fail');
exit;
// If usernames and passwords match, login succeeded. Re-direct to player specific page.
} else {
$_SESSION['username'] = $username;
header("Location: $page[$userRecord]");
exit;
}
?>
wont even allow the login, it wont move page, just says login failed... :S
thanks for the try tho!