Does it make any difference if you call "exit()" after each [man]header/man call?
Oh, nevermind on that, probably not. But you could try it.
You need to put in some debugging echo statements, like spufi suggested. You also might try a tracking variable in the query string on those header calls.
if ($db_found) {
$uname = quote_smart($uname, $db_handle);
$pword = quote_smart($pword, $db_handle);
$SQL = "SELECT * FROM login WHERE username = $uname AND password = $pword";
$result = mysql_query($SQL);
$num_rows = mysql_num_rows($result);
if ($result) {
if ($num_rows > 0) {
if ($uname =='abc')
{
session_start();
$_SESSION['login'] = "1";
header ("Location: welcomeabc.php?uname=$uname");
}
else if($uname =='xyz')
{
session_start();
$_SESSION['login'] = "1";
header ("Location: welcomexyz.php?uname=$uname");
}
else
{session_start();
$_SESSION['login'] = "1";
header ("Location: login.php");
}
}
else {
//$errorMessage = "Invalid Login";
//session_start();
//$_SESSION['login'] = '';
session_start();
$_SESSION['login'] = "";
header ("Location: login.php");
}
}
else {
$errorMessage = "Error logging on";
}
mysql_close($db_handle);
}
else {
$errorMessage = "Error logging on";
}
Then you can have "welcomeabc.php" and its sister tell you just what that variable is. Actually, you could probably just read it in the QS. 😉