$ _ SERVER ['REMOTE_USER'] returns the name of the user registered by the user in Active Directory. I want to download this information using ldap_search ().
This is what I have now:
$ad =
$filter = "(|(sn=$username*)(givenname=$username*))";
$attr = array("displayname", "mail", "mobile", "homephone", "telephonenumber", "streetaddress", "postalcode", "physicaldeliveryofficename", "l");
$dn =
ldap_search($ad,$dn,$filter,$attr);
This works, but I'm not sure if it will work if two users have almost the same names. How can I only find my unique username, so that I always get only one user?
source
share