forked from zakkak/qa-ldap-login
-
Notifications
You must be signed in to change notification settings - Fork 0
/
LDAPServer.php
30 lines (23 loc) · 821 Bytes
/
LDAPServer.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
class LDAPServer {
protected $con;
protected $lastError;
public function connectWithServer() {
$ldap_host = qa_opt('ldap_login_hostname');
// Establish link with LDAP server
$this->con = ldap_connect($ldap_host, qa_opt('ldap_login_port')) or die ("Could not connect to $ldap_host host.");
if (!is_resource($this->con)) trigger_error("Unable to connect to hostname", E_USER_WARNING);
ldap_set_option($this->con, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($this->con, LDAP_OPT_REFERRALS, 0);
}
public function bindToLDAP($user,$pass) {}
public function getUserAttributes() {}
public function closeServerConnection() {
$this->lastError = ldap_errno($this->con);
ldap_close($this->con);
}
public function showErrors() {
return $this->lastError;
}
}
?>