|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2000-08-11 09:45 UTC] bmcadams@php.net
[2000-08-11 21:08 UTC] bmcadams@php.net
[2000-09-18 06:12 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Nov 02 20:00:01 2025 UTC |
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; } } ?>