zoukankan      html  css  js  c++  java
  • php接入域账号登陆代码

     

     

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

  • 相关阅读:
    中译英26
    listen 59
    Speaking 1
    listen 58
    listen 57
    中译英25
    listen 56
    2018.2.27 RF module distance test part I
    中译英24
    第二章、PyQt5应用构建详细过程介绍
  • 原文地址:https://www.cnblogs.com/hgj123/p/4996733.html
Copyright © 2011-2022 走看看