I have a members only area of my site where users login via apache's .htaccess thing. Is there a way that my PHP script can see what the user's login name is?
I think $PHP_AUTH_USER works....if I recall correctly
Thanks for the tip. I had my script do the following line of code: echo echo $HTTP_SERVER_VARS['PHP_AUTH_USER'];
However, there is nothing in that string... its completely empty. Do I have to have something special set somewhere for this to work?
Originally posted by Mucello Thanks for the tip. I had my script do the following line of code: echo echo $HTTP_SERVER_VARS['PHP_AUTH_USER']; However, there is nothing in that string... its completely empty. Do I have to have something special set somewhere for this to work?
are you using that code inside of a function. HTTP_SERVER_VARS is not available within a function. But $_SERVER is.
and the two variables you want to use are: $SERVER['PHP_AUTH_USER'] $SERVER['PHP_AUTH_PW']
No it isn't being used in a function. I tried both $HTTP_SERVER_VARS['PHP_AUTH_USER'] and $_SERVER['PHP_AUTH_USER'] to no avail.
Ahhhhh I'm an idiot:p It does work after all. I was trying to use that variable in a directory other than the protected one. No problem... I'll just load that variable as a session parameter and everything's cool. Thanks everyone🙂 -Mark