How can I get the authenticated user name under Apache using plain HTTP authentication and PHP?
Asked Answered
F

2

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?

Fannyfanon answered 4/8, 2008 at 17:2 Comment(1)
I've used this to display the username from basic authentication: $_SERVER['REMOTE_USER']Hallagan
G
40

I think that you are after this

$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
Gunk answered 4/8, 2008 at 17:8 Comment(0)
E
0

i think that you are after this

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

Estelleesten answered 22/7, 2023 at 12:7 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.