IIS and $PHP_AUTH_USER
| From: | Shane McBride | Date: | Tue, 30 Jan 2001 02:34:09 +0000 |
| Subject: | IIS and $PHP_AUTH_USER | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-37182@lists.php.net to get a copy of this message | ||
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>