I am getting a whole lot closer to getting IIS to work with PHP loading as ISAPI.

Now, when I try to get authorized, it never works. It's probably a varialbe in the 
.ini file I have not set. I keep getting the user prompt box, and the realm changes 
after the first login failure

NT5
PHP 4.0.4pl1

Here's the code:

?>  
  // Check to see if $PHP_AUTH_USER already contains info
  if (!isset($PHP_AUTH_USER)) {
    // If empty, send header causing dialog box to appear
 header('WWW-Authenticate: Basic realm="TBCC"');
 header('HTTP/1.0 401 Unauthorized');
 echo 'Authorization Required!';
 exit;
  } else if (isset($PHP_AUTH_USER)) {
 if (($PHP_AUTH_USER !="admin") || ($PHP_AUTH_PW !="admin")) {
   header('WWW-Authenticate: Basic realm="TBCC"');
   header('HTTP/1.0 401 Unauthorized');
   echo 'Authorization Required!';
   exit;
    }
 }
?>

<html>

<h1>It worked!</h1>

</html>

Reply via email to