I will be implementing LDAP authentication into a company web portal. Once they login, I need to retrieve the value that user has in the "Office" field (under the general tab) in Active Directory. Any help would be greatly appreciated.
Here is my LDAP authentication code for reference:
public function ldap_authentication($username, $password) {
$connection = ldap_connect($this->HOST, $this->PORT) or die("Can't establish LDAP connection");
ldap_set_option($connection, LDAP_OPT_PROTOCOL_VERSION, 3);
if ($connection) {
$bind = ldap_bind($connection, $username.$this->DOMAIN, $password) or die("Can't bind to LDAP");
if ($bind) {
$authenticated = true;
}
else {
$authenticated = false;
}
}
else {
$authenticated = false;
}
ldap_unbind($connection);
return $authenticated;
}