PHP - Retreive logins and password used by.htaccess
If you protected folder of your site using a.htaccess and you want to retrieve the login and password that the user has entered your PHP pages , you can use these variables:
$_SERVER['PHP_AUTH_USER'] // for login $_SERVER['PHP_AUTH_PW'] // for password
Note that it work with PHP 5.
For PHP 4, use the variable:
$REMOTE_USER
Few people have figured out how to get a login via .htaccess on OVH shared hosting.
Rouzz sur www.z-r has a solution:
OVH used PHP via SGI scripts and not as an Apache module and doesn't take Authorization header into consideration.
Add these 2 lines to .htaccess:
RewriteRule .* - [E=REMOTE_USER:%{HTTP:Authorization},L]
echo $_SERVER['REMOTE_USER'];