Re: redirecting a user to a page after a password popup
| From: | Marek Kilimajer | Date: | Wed, 13 Nov 2002 13:43:33 +0000 |
| Subject: | Re: redirecting a user to a page after a password popup | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-124212@lists.php.net to get a copy of this message | ||
You don't need to redirect, this is from the php documentation on http authentication:
<?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 "<p>Hello $PHP_AUTH_USER.</p>";
echo "<p>You entered $PHP_AUTH_PW as your password.</p>";
}
?>
instead of the "Text to send if user hits Cancel button" you can put whole html page
John Meyer wrote:
Hi, I'm generating a 401 header for a few pages, and if they click cancel, I want to send them to a 401 page. How do I do this? I've tried a header after those headers, but that just redirects them automatically.