View Full Version : Extracting .htaccess user name in PHP
05-07-1999, 03:47 PM
Is there a system variable that holds the .htaccess userid of a person accessing a protected directory?
Just checking! Thanks
05-07-1999, 04:36 PM
yup, there is!
icongarden: making good ideas grow.
05-08-1999, 03:43 PM
Thanks Jacob, but it doesn't seem to work for me, I have a directory protected with .htaccess, and a form in that directory where I want to default the userid into. For example:
<input type=text name=name size=30 value='<?php print $PHP_AUTH_USER; ?>'>
But the $PHP_AUTH_USER returns null. I looked up the documentation on it at www.php.net (http://www.php.net), and it seems that I'm using it right. Actually trying to print the authuser returns a null also.
Does anyone know what I'm doing wrong?
Fixed spelling and clarified a few things
[This message has been edited by SneakyDave (edited 05-08-99)]
05-08-1999, 04:36 PM
R'ing TFM more and I found out that if I use $REMOTE_USER, it works fine. I assume if you used the "other" php authentication, then $PHP_AUTH_USER would work?
05-08-1999, 07:48 PM
That's funny - I was[nbsp][nbsp]going to suggest $REMOTE_USER when I first saw your quesion, but upon verification I couldn't get it to work... I'll try again later though. I can use that myself for my banner script, since[nbsp][nbsp]I now need a way for the sponsors to see their own stats :)[nbsp][nbsp]I might not use .htaccess though...
Oh, well, one more thing to know though :)[nbsp][nbsp]I know the environment variable REMOTE_USER is supposed to show that though, maybe I fubared something when I tried it (was real quick).
vBulletin® v3.6.8, Copyright ©2000-2013, Jelsoft Enterprises Ltd.