Authenticate Using Two Different password files for different document folder
| From: | Stephen Lo | Date: | Thu, 17 Aug 2000 08:18:19 +0000 |
| Subject: | Authenticate Using Two Different password files for different document folder | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12170@lists.php.net to get a copy of this message | ||
To whom it can help,
We wish to set up two authentication password files for different document folder (e.g. Document
Root is '/u1/httpd', folder 1 is '/u1/httpd/folder1' and folder 2 is
'/u1/httpd/folder2').
We have writen authentication lines in the Apache configure file
<Location /folder1>
..
AollowOverriden AuthConfig
AuthName Folder1
AuthType Basic
AuthUserFile /u1/password_f1
Authenticate On
..
</Location>
And we also wrotn similar code for Folder2 with password file as password_f2.
In each index.phtml in /folder1 and /folder2, we put the following lines to check user login:-
if (!isset($PHP_AUTH_USER)) {
HEADER("WWW-Authenticate: Basic realm=\"My Realm\"");
Header("HTTP/1.0 401 Unauthorized");
exit;
} else {
.....
}
We had discovered that password file cannot be able to located as calling the /folder1 or /folder2.
Then, we move one of the password file into ServerRoot/cgi-bin/. It's worked.
So, we wonder how we can obtain the varaliable of $PHP_AUTH_USER, and using assigned password file
for each document folder.
Regards,
Stephen Lo
Project Manager
Consulting & Outsourcing Services Division
Jardine OneSolution
[Tel] (852)2516-3628 [Fax] (852)2516-3622 [Email]swhlo@jos.com.hk
DISCLAIMER:-
<<This email is confidential and intended only for the use of the individual or entity named
above and may contain information that is privileged. If you are not the intended recipient, you
are notified that any dissemination, distribution or copying of this email is strictly prohibited.
If you have received this email in error, please notify us immediately by return email or telephone
and destroy the original message. Thank you.>>