Hi experts,
I have reinstalled the apache server on my xp, the source are all the same as previous, but after i run it after installation, the header location not working.....
i dont know what went wrong, can anyone assist?
Thanks:
<?php
session_start();
include("settings.inc");
mysql_select_db("helpdesk", $connection);
$query = "SELECT name, usertype FROM Usersettings WHERE Username = '$POST[username]' AND Password = '$POST[password]'";
$result = mysql_query($query) or die("ERROR");
$Resultrow = mysql_fetch_array($result);
$User = $Resultrow[0];
$Type = $Resultrow[1];
$num_result = mysql_num_rows($result);
print ("<tr><td height = 80 valign=\"top\">");
if($num_result == 0) {
print("<font color='red'>You have entered invalid user ID or password ! Please try again!<br>");
print ("If you have forgotten your password, Please contact HMM SIN I&T Dept for assistance.</font>");
print "";
}
else {
mt_srand((double)microtime() * 1000000);
$SesId = session_id();
$query2 = "INSERT INTO Temp (SesId, Sesdate, Name, Type) VALUES ('$SesId', SYSDATE(), '$User', '$Type')";
$result2 = mysql_query($query2) or die("ERROR");
// delete old inactive sessions
$query3 = "DELETE FROM temp WHERE Sesdate <> SYSDATE()";
$result3 = mysql_query($query3) or die("ERROR");
// update current old sessions
$query4 = "UPDATE temp SET Name = '$User' WHERE SesId='$SesId'";
$result4 = mysql_query($query4) or die("ERROR");
print ("<br></tr></table>");
switch ($Type)
{
case "C":
echo '<meta http-equiv="refresh" content="0;url=mainc.php">';
break;
case "I":
echo '<meta http-equiv="refresh" content="0;url=mainc.php">';
break;
case "T":
header("location:maint.php");
break;
case "P":
echo '<meta http-equiv="refresh" content="0;url=maint.php">';
break;
}
}
?>