login not working at all
Posted: Fri Jan 15, 2010 4:49 pm
Hello friends,
I've a problem when i try to login into admin cp of an script
take a look
the admin cp login should brings username and password from an database table
however when i try to login , it keeps showing me login popup even if the username and password was correct.
here is the code
I've a problem when i try to login into admin cp of an script
take a look
the admin cp login should brings username and password from an database table
however when i try to login , it keeps showing me login popup even if the username and password was correct.
here is the code
Code: Select all
<?if ($allow_page != "1") die("Sorry, there was an error.");?><?
function showlogin() {
header('WWW-Authenticate: Basic realm="Rapid Search Script :: Admin Area"');
header('HTTP/1.0 401 Unauthorized');
echo "Invalid Request. - Please retry.";
exit;
}
if (!isset($_SERVER['PHP_AUTH_USER']) OR !isset($_SERVER['PHP_AUTH_PW'])) {
showlogin();
}
$sql=mysql_query("SELECT `Value` FROM `general` WHERE `Name` = 'admin_username'") or die (mysql_error());
while($row=mysql_fetch_array($sql)) $guser = "$row[Value]";
$sql=mysql_query("SELECT `Value` FROM `general` WHERE `Name` = 'admin_password'") or die (mysql_error());
while($row=mysql_fetch_array($sql)) $gpass = "$row[Value]";
if ($guser != $_SERVER['PHP_AUTH_USER']) showlogin();
if ($gpass != $_SERVER['PHP_AUTH_PW']) showlogin();
$username = $_SERVER['PHP_AUTH_USER'];
?>