PDA

View Full Version : Extracting .htaccess user name in PHP


SneakyDave
05-07-1999, 04:47 PM
Is there a system variable that holds the .htaccess userid of a person accessing a protected directory?

Just checking! Thanks

Sneaky

Jacob Stetser
05-07-1999, 05:36 PM
yup, there is!


$PHP_AUTH_USER



------------------
icongarden.com/?fq (http://icongarden.com/?fq)
icongarden: making good ideas grow.

SneakyDave
05-08-1999, 04: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?

Thanks

Sneaky

Fixed spelling and clarified a few things
[This message has been edited by SneakyDave (edited 05-08-99)]

SneakyDave
05-08-1999, 05: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 &quot;other&quot; php authentication, then $PHP_AUTH_USER would work?

Sneaky

Justin
05-08-1999, 08: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).

------------------
Justin Nelson
FutureQuest Support