note 43126 deleted from features.http-auth by nlopess
| From: | nlopess@php.net | Date: | Thu, 10 Jun 2004 09:12:49 +0000 |
| Subject: | note 43126 deleted from features.http-auth by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-70856@lists.php.net to get a copy of this message | ||
Note Submitter: martino at dorifor dot com
----
I am using the authentication code below on two sites and it works on one, but not on the other. I
asked my ISP about it and they are puzzled. Aparently, the only difference is that the site that
works is on Apache v1.3, but the one that doesn't is on Apache v2. I haven't found the
answer to the problem yet, but hope someone does.
<?php
if ($_SERVER['PHP_AUTH_USER'] <> 'someuser' ||
$_SERVER['PHP_AUTH_PW'] <> 'somepass') {
header('WWW-Authenticate: Basic realm="Some Site"');
header('HTTP/1.0 401 Unauthorized');
echo 'Login failed.';
exit;
}
?>
Martino