Click to See Complete Forum and Search --> : PHP passwords do not work >.<


magu2k
04-13-2004, 10:57 PM
Greetings all,

I am using PHP 4.x, MySQL on Apache server, win2k platform

Every script I attempt to use which asks for a user and password will not make use of them, here is one example:


//set the username and password for the admin panel
$LOGIN = "mag"; //the username to access the admin panel
$PASSWORD = "mag"; //the passoword to access the admin panel

// do not edit below

function error ($error_message) {
echo $error_message."<BR>";
exit;
}
if ( (!isset($PHP_AUTH_USER)) || ! (($PHP_AUTH_USER == $LOGIN) && ( $PHP_AUTH_PW == "$PASSWORD" )) ) {
header("WWW-Authenticate: Basic entrer=\"Form2txt admin\"");
header("HTTP/1.0 401 Unauthorized");
error("Unauthorized access...");
}
?>


This is one example but any scripts I use which require it will absolutely refuse the password and login in any combination when I attempt to enter them to parse the script. Could it be the installation of PHP? maybe Apache? Scripts seem to run jsut fine, other than this. Any suggestions please?

Nevermore
04-14-2004, 06:46 AM
Remove the if() checking if the username and password are correct and just leave echo("Username: ".$php_auth_user." Password: ".$php_auth_pw);
and check that the server isn't just being fed the wrong username and password.