RE: [PHP] extracting htaccess info
| From: | Lars Holm Nielsen | Date: | Mon, 30 Oct 2000 14:25:01 +0000 |
| Subject: | RE: [PHP] extracting htaccess info | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-22681@lists.php.net to get a copy of this message | ||
> I have certain files protected in a directory using .htaccess. How can
> you pass the username and password from the htaccess login to a php
> script?
As far as I remember the username and password, will be set as an enviroment
variable. To check if I'm right, just make a php script which is password
protected by .htaccess. The php file should just contain <?phpinfo();?>.
Then run it, and browse to the bottom part of the generated page. There
you'll find a lot of variable names. And probably also one called something
like HTTP_REMOTE_USER og HTTP_USER etc. Well, if they are there, you'll find
them. If not, you'll have to use the HTTP authentication mechanisim in PHP
(http://www.dk.php.net/manual/features.http-auth.php).
---
Regards/Mvh.
Lars Holm Nielsen <lars@hankat.dk>