[ciapug] htaccess

Barry Von Ahsen ciapug@cialug.org
Tue, 23 Dec 2003 16:41:20 -0600


It seems that IE doesn't alway pass PHP_AUTH_USER properly (shock and 
horror).  From php.net:

When using NTLM authentication for a certain domain I've noticed that IE 
has trouble getting the network username using 
$_SERVER['PHP_AUTH_USER'], while Mozilla had no problem. Using 
$_SERVER['REMOTE_USER'] returned the username in both browsers. Kinda 
wierd, thought it would help since REMOTE_USER isn't listed as a 
$_SERVER constant.

It seems you can use either, with the limitations that PHP_AUTH_USER may 
not work on IIS servers/IE clients, or that REMOTE_USER may not be 100% 
officially supported/may deprecate since it's not listed in the PHP 
docs.  But it sounds like the poster is using NT/IIS directory security 
not .htaccess (which I've never seen work unless using IE anyhow).

YMMV, IANAL, caveat emptor, and such.

-barry


Dave J. Hala Jr. wrote:

> What is the differance?  I tried the $_SERVER[PHP_AUTH_USER] and it
> worked.
> 
> On Tue, 2003-12-23 at 15:28, Lathrop Preston wrote:
> 
>>You can use
>>
>>$_SERVER['REMOTE_USER'];
>>
>>instead.
>>
>>there seems to be some confusion as to the functional difference between 
>>the two (if any)
>>
>>
>>
>>Dave J. Hala Jr. wrote:
>>
>>
>>>Thanks.
>>>
>>>On Tue, 2003-12-23 at 11:54, Barry Von Ahsen wrote:
>>>
>>>
>>>>Dave J. Hala Jr. wrote:
>>>>
>>>>
>>>>
>>>>>I've got a folder that is password protected by an .htaccess file. From
>>>>>my php script I need to find out what the username they typed in was.
>>>>>
>>>>>Is the username from the apache login stored an as envirnoment variable
>>>>>somewhere?
>>>>>
>>>>>
>>>>>:) Dave
>>>>
>>>>$_SERVER['PHP_AUTH_USER']
>>>>
>>>>-barry
>>>>_______________________________________________
>>>>ciapug mailing list
>>>>ciapug@cialug.org
>>>>http://cialug.org/mailman/listinfo/ciapug
>>
>>_______________________________________________
>>ciapug mailing list
>>ciapug@cialug.org
>>http://cialug.org/mailman/listinfo/ciapug