views:

1354

answers:

3

First, let's get the security considerations out of the way. I'm using simple authentication under Apache for a one-off, internal use only, non-internet connected lan, php web app.

How can get I the HTTP authenticated user name in PHP?

+9  A: 

I think that you are after this

$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
Teifion
A: 

I've used this to display the username from basic authentication:

$_SERVER['REMOTE_USER']
Chris Bartow
+1  A: 

None of the above works for me...

I have a web server authenticating with LDAP, and I want to use the username to write to a log. How do I do that ? Either HTML, JavaScript or PHP would work.

Thanks.

Ilan Simon