Hello,
I am new to PHP and trying to learn. I am trying a tutorial and this is the
script. It is supposed to pop up a box requiring a username and pass. but
all I get is
'Authorization Required'
Any suggestions? I am running PHP3 and 4 and on an IIS server (it is just
for testing, normally it would be apache)
Thanks in advance!!!
<?php
// File Name: auth02.php
// 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="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>
";
}
}
?>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php