Entry
How can I get users via PHP after .htaccess login?
Dec 20th, 2001 08:46
MyNameIs Monkey, Frank Hoechel, http://www.php.net/manual/en/features.http-auth.php
Pop the htaccess request using PHP in the first place:
<?php
if(!isset($PHP_AUTH_USER)) {
header("WWW-Authenticate: Basic realm=\"Your Realm\"");
header("HTTP/1.0 401 Unauthorized");
echo "Your custom 401 message here\n";
exit;
} else {
echo "<p>Hello $PHP_AUTH_USER.</p>";
echo "<p>Your password is $PHP_AUTH_PW.</p>";
}
?>
This will *only* work when PHP is running as an Apache module.