Ok, I am having a hard time with the header function.. if you look at the script below, both the 2 first header functions work no problem upon given cirumstances.. but as soon as I add the last header function, the first header function does not work.. it always reverts to the last header.. what am i doing wrong?
Thanks everyone.
CODE:
<?
//------------------------------------------------------------------------------------------------------------------
// VARIABLE DECLARATION..
$username = $_GET['user'];
$password = $_GET['password'];
$Button = $_GET['Button'];
//------------------------------------------------------------------------------------------------------------------
// FUNCTION LOGIN INTO LOGIN DATABASE
function readdata() {
...deleted for posting purposes..}
//------------------------------------------------------------------------------------------------------------------
if ($Button == "Cancel"){
@header("Location: http://www.xxx.com/Mainview.php?selected=poker");
}
if ($Button == "Submit"){
!readdata();
$query="SELECT * FROM `login`";
$result=mysql_query($query) or die("Query failed: $query\nError: " . mysql_error());
$num_entries=mysql_numrows($result);
mysql_close();
$i=0;
while ($i < $num_entries) {
$sqluser=mysql_result($result,$i,'user');
$sqlpass=mysql_result($result,$i,'pass');
if ($username == $sqluser && $password == $sqlpass) {
@header("Location: http://www.xxx.com/test2.php");
}
$i++;
}
}
@header("Location: http://www.xxx.com/signin.php?flag=invalid");
?>