I\'m constructing an upload so people I know can send me files securely, and with ease. But I want to design it just so, that when one of my friends sign in with their
You'd want $_SERVER['PHP_AUTH_USER']
and $_SERVER['PHP_AUTH_PW']
to retrieve the username and password, assuming you mean a regular "basic authentication" login, as done by Require valid-user
settings in .htaccess.
more details here.
Not to open up an old task, but running PHP 5 with Apache 2.2 and this is the variable that works for me:
$_SERVER['USER'];
Something that worked for me:
$_SERVER['REDIRECT_REMOTE_USER']
Please try the above. In general, one can do "print_r($_SERVER)
" and hunt out the parameter one is looking for.
I think the following variables give you the derise information:
PHP_AUTH_USER: When doing HTTP authentication this variable is set to the username provided by the user.
PHP_AUTH_PW: When doing HTTP authentication this variable is set to the password provided by the user.
echo "<p>Hello {$_SERVER['PHP_AUTH_USER']}.</p>";
echo "<p>You entered {$_SERVER['PHP_AUTH_PW']} as your password.</p>";
You can read it from $_SERVER['PHP_AUTH_USER']
You should be able to get the user name the user signed in with from the $_SERVER['REMOTE_USER']
variable after they've successfully signed in.