php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #5622 Access Violation when using HTTP Authentication
Submitted: 2000-07-16 08:32 UTC Modified: 2000-09-18 06:12 UTC
From: david at interpont dot hu Assigned:
Status: Closed Package: Reproducible Crash
PHP Version: 4.0.1pl2 OS: NT4 SP6, IIS 4
Private report: No CVE-ID: None
 [2000-07-16 08:32 UTC] david at interpont dot 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;
  }
 } 

?>

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-08-11 09:45 UTC] bmcadams@php.net
I will evaluate this and get back to you.
 [2000-08-11 21:08 UTC] bmcadams@php.net
Cannot duplicate problem on identical platform using supplied user script.
Invalid configuration of web server?
 [2000-09-18 06:12 UTC] sniper@php.net
Not reproduceable and no feedback.

--Jani
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 09:01:29 2024 UTC