newbie question - apache-win2K-authentication
| From: | Shari Fletcher | Date: | Thu, 02 Aug 2001 14:42:24 +0000 |
| Subject: | newbie question - apache-win2K-authentication | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-60914@lists.php.net to get a copy of this message | ||
Hi all ---
I'm having some trouble getting basic authentication working. Either that
or my privileges are screwed up, or something.
I am running Apache on Windows 2000 and PHP4. I've searched newsgroups,
this mailing list, various FAQs and the manual, I think my eyes are
crossing. I've got a feeling either its so simple I can't see it, or its
not possible. I'm hoping someone has a quick idea about what's going on.
Here's my story:
My authentication script is from this example.
If I leave it as is, I can authenticate and I receive the error:
malformed = header from script. Bad header=3DHTTP/1.0 401 Unauthorized:
=e:/php/php.exe
If I change the unauthorized header to this: header("Status: 401
Unauthorized"); I cannot authenticate, though the user id and password is
correct.
Thanks in advance !
Shari
My script:
if (!isset($PHP_AUTH_USER)) {
// If empty, send header causing dialog box to appear
header('WWW-Authenticate: Basic realm="securedf"');
header('HTTP/1.0 401 Unauthorized');
echo 'Authorization Required.';
exit;
}
// If not empty, display values for variables
else {
echo "
<P>You have entered this username: $PHP_AUTH_USER<br>
You have entered this password: $PHP_AUTH_PW<br>
The authorization type is: $PHP_AUTH_TYPE</p>
";
}