password auth with php 4.03p1
| From: | scottrus at ipass dot net | Date: | Sat, 18 Nov 2000 03:27:13 +0000 |
| Subject: | password auth with php 4.03p1 | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-26008@lists.php.net to get a copy of this message | ||
All -
I have php password authentication working but not 100% the way I want. My problem is when users
cancel
the login process. Here is my script fragment:
00
01 if(!isset($PHP_AUTH_USER)) {
02 // user hit the cancel button
03 header("WWW-Authenticate: Basic realm=\"my site\");
04 header("HTTP/1.0 401 Unauthorized");
05 exit;
06 } else {
07 // verify userid/passwd
08 if (userauth($PHP_AUTH_USER,$PHP_AUTH_PW != 1) {
09 header("WWW-Authenticate: Basic realm=\"my site\");
10 header("HTTP/1.0 401 Unauthorized");
11 exit;
12 }
13 }
14
This is basically what you find in the php manual under the subject of php HTTP auth. The problem
for me
is that when the user cancels they get a 'Page Contains No Data' response at the browser
(NS4.x). I
have 'ErrorDocument 403 /error_docs/403.html' defined in my apache httpd.conf but it never
seems to get
that far when the cancel button is pressed. If I insert a header("HTTP/1.0 403"); just
after lines 05
and 10 then the user login fails without ever getting prompted.
My best guess is that php is sending the 403 header along with the 401 headers. Any suggestions how
to
get this working?
--
Scott