PHP 4.0 Bug #5622 Updated: Access Violation when using HTTP Authentication
| From: | Bug Database | Date: | Mon, 18 Sep 2000 10:12:10 +0000 |
| Subject: | PHP 4.0 Bug #5622 Updated: Access Violation when using HTTP Authentication | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-33451@lists.php.net to get a copy of this message | ||
ID: 5622
Updated by: sniper
Reported By: david@interpont.hu
Status: Closed
Bug Type: Reproduceable crash
Assigned To:
Comments:
Not reproduceable and no feedback.
--Jani
Previous Comments:
---------------------------------------------------------------------------
[2000-08-11 21:08:34] bmcadams@php.net
Cannot duplicate problem on identical platform using supplied user script.
Invalid configuration of web server?
---------------------------------------------------------------------------
[2000-08-11 09:45:18] bmcadams@php.net
I will evaluate this and get back to you.
---------------------------------------------------------------------------
[2000-07-16 08:32:35] david@interpont.hu
Hi!
My problem is that when I use HTTP Authentication, PHP displays an Access Violation. After this the
computer slows down and IIS stops working.
When I use the script above, first the browser (both IE5.01 and NS4.7) displays the name/pass login
window correctly but if I hit the Cancel button, then a PHP Access Violation message comes.
I have installed PHP and IIS as described in the manuals. Everything else seems to be fine.
Please tell me the solution and tell me if you have the same problem or works fine for you.
Please drop me an e-mail in case of reply as I can't check this page frequently! Thanks!
Regards,
David Szilagyi
The script:
<?
if (!isset($PHP_AUTH_USER)) {
header('WWW-Authenticate: Basic realm="test"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required. - I';
exit;
} else {
$filename = "./users.txt";
$fp = fopen($filename, "r");
$file_contents = fread($fp, filesize($filename));
fclose($fp);
$line = explode("n", $file_contents);
$i = 0;
while($i <= sizeof($line)) {
$data_pair = explode(":", $line[$i]);
if (($data_pair[0] == "$PHP_AUTH_USER") && ($data_pair[1] ==
"$PHP_AUTH_PW")) {
$auth = 1;
break;
} else {
$auth = 0;
}
$i++;
}
if ($auth == "1") {
echo "<P>You're authorized!</p>";
exit;
} else {
header('WWW-Authenticate: Basic realm="test"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required. - II';
exit;
}
}
?>
---------------------------------------------------------------------------
Full Bug description available at: http://bugs.php.net/?id=5622