PHP and .htaccess

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I am building a website, part of which reuires user authentication. In  
the past I have used PHP and MYSQL to do this, but I was wondering if  
there is an easy wasy to use .htaccess. On the face of it this looks  
simple but each page the site returns is user specific, so I need a way  
of finding out which user logged in.

For example if John logged in he would see page A
If Suzy logged in she would see page B.

I am thinking that there might be something in the page headers that I  
can get hold of, I'm just not sure what.

Any help greatly welcome.


Re: PHP and .htaccess

Try $_SERVER['PHP_AUTH_USER'] maybe.
And $_SERVER['PHP_AUTH_PW'] gets the password.

See for full details.

Re: PHP and .htaccess

Al wrote:
Quoted text here. Click to load it

Many thanks for that, all sorted now.

Re: PHP and .htaccess

splodge wrote:
Quoted text here. Click to load it

Also, for an implementation example, you can check out:

Justin Koivisto, ZCE -

Re: PHP and .htaccess

On 12 Jan 2006 11:38:09 -0800, in

Quoted text here. Click to load it

It's worth noting that those will only retrieve .htaccess USER and PW
if PHP running as an Apache module, and not if it's running as CGI.

Site Timeline