I have this short script for authorizing users. Just switched servers. Now it does not work. It does not pop open the login screen, it just shows the Not Authorized error.
I'm I suppose to enable something on php?
<?
$loginPage = "store.php?myAccount=Login";
if (!isset($PHP_AUTH_USER) || $unauthorized)
{
$realm = "MyPHPStore_".time();
Header("WWW-Authenticate: Basic realm=\"$realm\"");
Header("Status: HTTP/1.0 401 Unauthorized");
print "<h1>401 Unauthorized</h1>Unable to authorize you. Please <a href=\"$loginPage\">click here</a> to try again.";
exit;
}
else
{
include("dbconnect.php");
$query = "select * from storeCustomer where customerUserID = '$PHP_AUTH_USER' and customerPassword = '$PHP_AUTH_PW'";
$mysql_result = mysql_query($query, $mysql_link);
if(mysql_affected_rows() == 0)
{
header("Location: ".$loginPage."&unauthorized=1");
exit();
}
else
{
while($row = mysql_fetch_row($mysql_result))
{
$custID = $row[0];
}
}
include("dbdisconnect.php");
}
?>