Search code examples
phpauthenticationmod-ldap

How do I retrieve the user information of a user authenticated with Apache's mod_ldap?


I have LDAP authentication working with Apache. Now I need to know how I can get what user logged in with PHP. Is it even possible? Do I have to do the authentication in PHP to store the user name?


Solution

  • I am not sure if it's the same with mod_lsap, but when you authenticate using Apache, the username and password are stored in the $_SERVER's superglobals.

    $_SERVER['PHP_AUTH_USER']
    $_SERVER['PHP_AUTH_PW']
    

    http://ca.php.net/manual/en/reserved.variables.server.php