Here is the code:
if (!isset ($_SERVER['PHP_AUTH_USER'])) {
header('WWW-Authenticate: Basic realm="My own Realm"');
header('HTTP/1.0 401 Unauthorized');
exit;
}
else if(($PHP_AUTH_USER=="fuu") && ($PHP_AUTH_PW=="bar")) {
echo "You got in...";
}
else {
echo "<html><body bgcolor=ffffcc>Invalid Login";
}
?>
I get the following error msg:
CGI Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are:
Status: 401
Content-type: text/html
X-Powered-By: PHP/4.3.1
WWW-Authenticate: Basic realm="Spoono Password.-0"
I have set register_globals = Off. Turning this ON had no effect.
Has anyone else had similar problems? What did you do? I run PHP on my Win XP with IIS web server.