hgj123
 

 

//替换本地登录为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];
}

分类:

技术点:

相关文章:

  • 2021-08-12
  • 2022-12-23
  • 2021-08-17
  • 2021-07-21
  • 2021-06-04
  • 2021-05-08
  • 2021-12-24
  • 2021-10-11
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-19
  • 2021-09-28
  • 2021-12-26
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案