54

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?

Rahul
  • 18,271
  • 7
  • 41
  • 60
basszero
  • 29,624
  • 9
  • 57
  • 79

2 Answers2

40

I think that you are after this

$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
Teifion
  • 108,121
  • 75
  • 161
  • 195
0

i think that you are after this

$username = $_SERVER['PHP_AUTH_USER']; $password = $_SERVER['PHP_AUTH_PW'];