I'm stumped on this one. Very simple login screen. When there is a password match the script works perfectly and jumps to main.php. When the uname or pswd is wrong, the script wont drop into the ELSE clause and wont go to badlogin.php. The script just hangs with the blank white screen.
any help would be great.
<?php
include("dbconnect.php");
$u_name = mysql_real_escape_string($_POST['uname']);
$p_word = mysql_real_escape_string($_POST['pword']);
# *** querying all records ***
$query = mysql_query("SELECT * FROM notes_users WHERE valid_password = '$p_word' && valid_username = '$u_name'");
while($rst = mysql_fetch_array($query)) {
if (($rst[valid_username] == $u_name) AND ($rst[valid_password] == $p_word)) {
session_start();
$_SESSION['login'] = "1";
header('Location: main.php') ;
} else {
session_start();
$_SESSION['login'] = '';
header('Location: badlogin.php') ;
}
}
?>