//替换本地登录为AD域用户认证
//edit by ZhangJin on 2015-05-23 -START-$dn = $user_account.'@funova.net';$dn_passwd= $pw;$ad_host="192.168.1.5:389";$ad = ldap_connect($ad_host) or die("Could not connet!"); ldap_set_option ($ad,LDAP_OPT_PROTOCOL_VERSION,3);ldap_set_option ($ad,LDAP_OPT_REFERRALS,0);$bd = ldap_bind($ad,$dn,$dn_passwd);if($bd){ $filter="(|(samaccountname=$user_account))"; //$filter="(|(telephonenumber=18507565164*))"; //$filter="(|(sn=$dn*)(givenname=$dn*))"; $attrs = array("displayname","telephonenumber","mail"); $search = ldap_search($ad,'ou=staff,DC=funova,DC=net',$filter,$attrs); $entries = ldap_get_entries($ad,$search); //print_r($entries); $user_phone = $user_account = $entries[0]['telephonenumber'][0]; $user_name = $entries[0]['displayname'][0]; $user_mail = $entries[0]['mail'][0];}