Why it doesnt work
| From: | Aalee | Date: | Fri, 10 Dec 2004 12:52:24 +0000 |
| Subject: | Why it doesnt work | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-203921@lists.php.net to get a copy of this message | ||
Hi ive tried this script and it doesnt seem to work for me. I have typed
exactly the same username and password in the script..it keeps on asking for
the username and password..pls help...cud this be due to a setting in the
php or apache server...am using php 4.3 and apache 1.3.33...the code is
<?php
if (!isset($PHP_AUTH_USER)) {
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>
";
}
}
?>
cheers...