I have a password protected directory with htaccess and htpasswd.
My .htpasswd
file looks like this:
user1:passwordstring
user2:passwordstring
user3:passwordstring
When any of the user login successfully into the directory is there anyway I can get that user's name using php?
Assuming that I've understood the question correctly, your answer is here. More reference.
<?php
$username = $_SERVER['PHP_AUTH_USER'];
$password = $_SERVER['PHP_AUTH_PW'];
?>