I'm receiving server error but I know for sure that there is no error in the code. It has been working before on other server.
What could be wrong??
Here is the code:
<?
if(!($PHP_AUTH_USER))
{
Header( "WWW-authenticate: basic realm=\"restricted area\"");
Header( "HTTP/1.0 401 Unauthorized");
echo "failed\n";
?>
<meta http-equiv="refresh" content="0;url=http://www.domain.com/failed.html">
<?
exit;
}
else
{
require ('db.php');
$user_id=strtolower($PHP_AUTH_USER);
$password=$PHP_AUTH_PW;
$Selstr= "select * from TABLE where (user='$user_id' || email='$user_id') and password='$password'";
$Result=mysql_query($Selstr, $connect);
if ($password == "")
{
Header( "WWW-authenticate: basic realm=\"restricted area\"");
Header( "HTTP/1.0 401 Unauthorized");
print"<meta http-equiv='refresh' content='0;url=http://www.domain.com/failed.html'>";
exit;
}
elseif(!mysql_num_rows($Result))
{
Header( "WWW-authenticate: basic realm=\"restricted area\"");
Header( "HTTP/1.0 401 Unauthorized");
print"<meta http-equiv='refresh' content='0;url=http://www.domain.com/failed.html'>";
exit;
}
}
?>
Thanks