Authenticating via http
| From: | Paul | Date: | Fri, 11 Jan 2002 07:49:23 +0000 |
| Subject: | Authenticating via http | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-80170@lists.php.net to get a copy of this message | ||
Here's a really quick question. I can't figure out how to try to get user
authentication more than once. For instance, supposed I get this log on
screen that asks for my username and password. If I type in something wrong
that variable gets stuck in $PHP_AUTH_USER, and there is no way to unset it,
so the user would be prompted again. Please help. Thanks
<?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 {
//Check the database for user/password combination. Oh, not right?
let's try again
unset($PHP_AUTH_USER); //Doesn't work
}
?>