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 sign-in (it's going to an .htaccess
login), I can establish that in PHP and log their file into a database associated with their account.
In short, I need PHP to be able to detect who is signed in so I can pass that data to a database.
Is there any possible way of doing that?
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With