Login

Benutzer aus Active Directory (LDAP) mit letztem Anmeldedatum auslesen

Mi, 30.09.2009 - 20:14 -- admin

$ldap_url = 'server';
$ldap_domain = 'domain.local';
$ldap_dn = "dc=domain,dc=local";
 
$ds = ldap_connect( $ldap_url );
  ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
  ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
 
$username = "username";
$password = "password";
 
#now try a real login
 $login = ldap_bind( $ds, "$username@$ldap_domain", $password );
#$login = ldap_bind( $ds ); anonym binding; should not work in windows ad
 $attributes = array("displayname", "mail","department","title","lastlogon","lastlogontimestamp",);
 
#only persons

Login abonnieren