Hi All
I got a small problem. Im trying to set up a membership section to my website. Ive got some code that checks the user password and username. Bascially even if i type in the correct pasword the page doesnt redirect. All the if statements beside this bit. Code is as follows:
<?
/ Check User Script /
session_start(); // Start Session
include 'db.php';
// Conver to simple variables
$username = $POST['username'];
$password = $POST['password'];
if((!$username) || (!$password)){
echo "Please enter ALL of the information! <br />";
include 'log_in.htm';
exit();
}
// Convert password to md5 hash
$password = md5($password);
// check if the user info validates the db
$sql = mysql_query("SELECT * FROM users WHERE username='$username' AND password='$password' AND activated='1'");
$login_check = mysql_num_rows($sql);
if($login_check > 0){
while($row = mysql_fetch_array($sql)){
foreach( $row AS $key => $val ){
$$key = stripslashes( $val );
}
// Register some session variables!
session_register('first_name');
$SESSION['first_name'] = $first_name;
session_register('last_name');
$SESSION['last_name'] = $last_name;
session_register('email_address');
$SESSION['email_address'] = $email_address;
session_register('special_user');
$SESSION['user_level'] = $user_level;
mysql_query("UPDATE users SET last_login=now() WHERE userid='$userid'");
header("Location: login_success.php");
}
} else {
echo "You could not be logged in! Either the username and password do not match or you have not validated your membership!<br />
Please try again!<br />";
include 'log_in.htm';
}
?>
Im not getting any errors at all, the page appears with all my headers and footers but it supposed to re-direct to login_success.php but it doesnt. Any ideas why?