I have this authorization script and it works on my windows/apache server, but when I upload it to my linux/apache server It doesn\'t work. It doesn\'t give any errors. All it does is it lets you in once but then when you go to another page it says you need to log in again. I checked the php.ini file on the linux/apache server and everthing looks like it\'s set right. Any ideas?
<?php
session_start();
if ($logOut) {
unset($_SESSION);
session_destroy();
include(\"logOut.inc\");
exit;
}
if (isset($PHP_AUTH_USER)) {
// If non-empty, check the database for matches
// connect to MySQL
$db = mysql_connect(\"localhost\", \"oconnor\", \"gnirdoow\");
mysql_select_db(\"addressbook\",$db);
// Formulate the query
$sql = \"SELECT * FROM address WHERE userid=\'$PHP_AUTH_USER\' and password=\'$PHP_AUTH_PW\'\";
// Execute the query and put results in $result
$result = mysql_query($sql);
$myrow = mysql_fetch_array($result);
// Get number of rows in $result. 0 if invalid, 1 if valid.
$num = mysql_numrows($result);
if ($PHP_AUTH_USER == \"guest\" && $PHP_AUTH_PW == \"guest\") {
session_start();
$_SESSION[\"currentUserID\"] = \"guest\";
$_SESSION[\"currentUserName\"] = \"Guest\";
$_SESSION[\"currentUserType\"] = \"guest\";
} else if ($num != \"0\") {
session_start();
$_SESSION[\"currentUserIDNumber\"] = $myrow[\"id\"];
$_SESSION[\"currentUserID\"] = $myrow[\"userid\"];
$_SESSION[\"currentUserName\"] = $myrow[\"first\"];
$_SESSION[\"currentUserType\"] = $myrow[\"userType\"];
//echo \"$_SESSION[userid]\";
//set cookie
} else {
$errorMsg = \"<center>\\n<font color=red><b>Your user name or password was incorrect. Please Try Again.</b><br><br>\\n\";
include(\"login.inc\");
exit;
}
}
if (!isset($_SESSION[\"currentUserID\"])) {
$errorMsg = \"\";
include(\"login.inc\");
exit;
}
?>