Exemple #1
0
 /**
  * LDAPに接続する
  *
  * @param
  * @return リソース
  */
 function connect_ldap()
 {
     // システム設定を取得
     $system_conf_row = ACSLDAP::set_system_conf();
     // LDAP接続
     $conn = @ldap_connect($system_conf_row['ldap_server'], $system_conf_row['ldap_port']);
     if (!$conn) {
         // 失敗時はNULL
         return null;
     }
     // LDAPプロトコルバージョンセット (LDAPv3)
     @ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION, 3);
     // バインド処理
     $bind = @ldap_bind($conn, $system_conf_row['ldap_bind_dn'], $system_conf_row['ldap_bind_passwd']);
     if (!$bind) {
         // 失敗時はNULL
         return null;
     }
     return $conn;
 }