HTTP Authentication
| From: | Nick Kostirya | Date: | Wed, 07 Feb 2001 15:27:18 +0000 |
| Subject: | HTTP Authentication | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-38546@lists.php.net to get a copy of this message | ||
Hi, all.
HTTP Authentication in PHP 4 - Apache don't work!!!
Help me.
Best.
__________________________________________________
<?php
if(!isset($PHP_AUTH_USER)) {
Header("WWW-Authenticate: Basic realm=\"My Realm\"");
Header("HTTP/1.0 401 Unauthorized");
echo "Text to send if user hits Cancel button\n";
exit;
} else {
echo "Hello $PHP_AUTH_USER.<P>";
echo "You entered $PHP_AUTH_PW as your password.<P>";
}
?>