Hi experts,
I reinstalled the apache web server, and i restored the same PHP source and works fine for everything except --- Header location..
I wonder what went wrong.... Can anyone help? i am at my wits end...
<?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":
header("location:mainc.php");
break;
case "I":
header("location:mainc.php");
break;
case "T":
header("location:maint.php");
break;
case "P":
header("location:maint.php");
break;
}
}
?>
Would that be my setting in apache went wrong???