Dear Shane,

Thanks for response.
But when I use PHP3 and Apache than all is good.
And when I use PHP4 (!!!) and Apache than Apache don't understanding header
('HTTP/1.0 401 Unauthorized'), and Apache's "error.log" consist of  "Bad
header=HTTP/1.0 401 Unauthorized: d:/program files/php/php.exe".
Do you know what is the matter?

Thanks in advance.
Nick.
----- Original Message -----
From: Shane McBride <[EMAIL PROTECTED]>
To: Nick Kostirya <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Sent: Wednesday, February 07, 2001 7:06 PM
Subject: Re: [PHP] HTTP Authentication


> Nick,
>
> I'm not sure were you are getting the value of $PHP_AUTH_USER from, so you
> might want to try this snippet. This causes a dialog box to open and ask
for
> a username/password.
>
> Also, in your code: you do not need to escape the quotes in the header.
>
> <?
>  // Check to see if $PHP_AUTH_USER already contains info
>  if (!isset($PHP_AUTH_USER)) {
>     // If empty, send header causing dialog box to appear
>     header('WWW-Authenticate: Basic realm="Whatever You want to say"');
>     header('HTTP/1.0 401 Unauthorized');
>     echo 'Authorization Required!';
>     exit;
>  } else if (isset($PHP_AUTH_USER)) {
>     if (($PHP_AUTH_USER !="abc") || ($PHP_AUTH_PW !="123")) {
>        header('WWW-Authenticate: Basic realm="Whatever You want to say"');
>        header('HTTP/1.0 401 Unauthorized');
>        echo 'Authorization Required!';
>        exit;
>   } else {
>    // Start echo statement
>    echo "hello";
>   }
> }
> ?>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to