Re: WWW-Authenticate problem in Apache
| From: | Boris Klotz | Date: | Tue, 02 Apr 2002 14:20:59 +0000 |
| Subject: | Re: WWW-Authenticate problem in Apache | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-91140@lists.php.net to get a copy of this message | ||
You should only send the HTTP Authentication Header, if the user isn't
already authenticated.
Try something like this:
<?php
$usr = "guest";
$pw = "guest";
if(!($PHP_AUTH_USER==$usr && $PHP_AUTH_PW==$pw)) {
header("WWW-Authenticate: Basic realm=\"My Realm\"");
header("HTTP/1.0 401 Unauthorized");
}
?>
Bob
"Dssopt" <dssopt02@macau.ctm.net> schrieb im Newsbeitrag
news:20020402080837.18625.qmail@pb1.pair.com...
> Hi everybody,
>
> I try to install Apache 3.1.2 + PHP-4.1.2 on RedHat 7.2.
>
> All seems to be fine but when I write a PHP to test the authenticate.
> <?php
> header("WWW-Authenticate: Basic realm=\"My Realm\"");
> ?>
> Whatever I input to the login box, the failed, retry message comes out and
> it becomes a dead loop - login - retry - login ..
>
> Can anyone help me ??
>
> Ken
>
>