Re: trapping the user name from .htaccess / .htpasswd
| From: | Jason Wong | Date: | Thu, 07 Mar 2002 17:29:03 +0000 |
| Subject: | Re: trapping the user name from .htaccess / .htpasswd | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-87645@lists.php.net to get a copy of this message | ||
On Friday 08 March 2002 00:36, Dave wrote:
> Hello all,
>
> I have an .htaccess and .htpasswd file in a directory. This is working
> fine, when anyone attempts to enter this directory, they are prompted for a
> user name and password, and if correctly entered, the page will load fine.
>
> What I would like is the ability to capture, or trap the user name.
>
> Immagine, in the simplist example, when the form loads, I could have
>
> <?
> print "Hello".$username;
> ?>
>
> Assuming $username was the varable for the user who logged in.
Use $PHP_AUTH_USER & $PHP_AUTH_PW.
Read the manual chapter "HTTP authentication with PHP".
--
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
/*
My idea of roughing it is turning the air conditioner too low.
*/