note 3653 modified in features.http-auth by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 13:56:13 +0000 |
| Subject: | note 3653 modified in features.http-auth by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79844@lists.php.net to get a copy of this message | ||
I had the same problem as above (that is, with apache I can't get the auth info). The solution
I found goes like this:
<?php
$headers = getallheaders();
$auth=$headers['authorization'];
if ($auth=='') { $auth=$headers['Authorization']; }
if($auth=='')
{
Header("WWW-Authenticate: Basic realm=\"$PROG_NAME\"");
Header("HTTP/1.0 401 Unauthorized");
}
?>
list($user, $pass) = explode(":", base64_decode(substr($auth, 6)));
--was--
I had the same problem as above (that is, with apache I can't get the auth info). The solution
I found goes like this:
$headers = getallheaders();
$auth=$headers[authorization];
if ($auth=='') { $auth=$headers[Authorization]; }
if($auth=='')
{
Header("WWW-Authenticate: Basic realm=\"$PROG_NAME\"");
Header("HTTP/1.0 401 Unauthorized");
}
list($user, $pass) = explode(":", base64_decode(substr($auth, 6)));
http://php.net/manual/en/features.http-auth.php