Having a little trouble here:
It seems that PHP is not recognizing even a hardcoded username and password, nor is it reporting my "Basic Realm" correctly.
I can upload this same file to a remote server, and it works, so I know it's in my config...
Using IIS 4 with non-CGI version of PHP from php4win.
My basic security settings are configured to send plain passwords; no domain vilidation; no anonymous access.
Once again, the username and password arent recognized, and the "Basic Realm" area shows only the numeric IP of the server, and not the hardcoded value from the oho file.
Here's the code...it's very straightforward..
<?php
// Check $PHP_AUTH_USER for info
if (!isset($PHP_AUTH_USER)) {
// If empty
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else if (isset($PHP_AUTH_USER)) {
if (($PHP_AUTH_USER != "admin") || ($PHP_AUTH_PW != "abc123")) {
header('WWW-Authenticate: Basic realm="My Private Stuff"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
} else {
echo "
<P>You're authorized!</p>
";
}
}
?>