PHP 4.0 Bug #10277: $PHP_AUTH_USER and $PHP_AUTH_PWD
| From: | gary dot lante at unisa dot edu dot au | Date: | Wed, 11 Apr 2001 00:59:36 +0000 |
| Subject: | PHP 4.0 Bug #10277: $PHP_AUTH_USER and $PHP_AUTH_PWD | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-51412@lists.php.net to get a copy of this message | ||
From: gary.lante@unisa.edu.au
Operating system: Freebsd
PHP version: 4.0.4pl1
PHP Bug Type: *Web Server problem
Bug description: $PHP_AUTH_USER and $PHP_AUTH_PWD
When connecting to a site through IE5+ the site automatically Authenticate as False. Will not send a
Authenticate message up. Works fine under Netscape 4+
if (isset($PHP_AUTH_USER) && isset($PHP_AUTH_PW)) {
// Connect to database
$conn = pg_pconnect ("dbname=".$db.$login);
// Select database on MySQL server
// Formulate the query
$sql = "SELECT * FROM ".$table2." WHERE
username = '$PHP_AUTH_USER' AND
password = '$PHP_AUTH_PW' AND valid = 'y'";
// Execute the query and put results in $result
$result = pg_Exec ( $sql );
// Get number of rows in $result.
$num = pg_numrows( $result );
if ( $num != 0 ) {
// A matching row was found - the user is authenticated.
$auth = true;
}
}
if ( ! $auth ) {
header('http/1.0 401 Unauthorized');
header('WWW-Authentucate: Basic realm="Private"');
echo 'Authorization Required.<br>';
echo 'Please go to <a href=./index,php?pg=REGISTER>Registration</a> page to Get
a logon, It is Free.';
echo
"<br><b>???????".$PHP_AUTH_USER."<br>???????".$PHP_AUTH_PW."</b>";
exit;
} else {
}
--
Edit Bug report at: http://bugs.php.net/?id=10277&edit=1