Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #class LDAPAC extends AppModel {
- class LDAPAC {
- public $name = 'LDAPAC';
- public $useTable = false;
- private $Lhost;
- private $Lport;
- private $Ldnbase;
- private $Luser;
- private $Lpass;
- private $ds;
- public function __construct($host, $port, $dnbase, $user, $pass) {
- #parent::__construct();
- $this->Lhost = $host;
- $this->Lport = $port;
- $this->Ldnbase = $dnbase;
- $this->Luser = $user;
- $this->Lpass = $pass;
- $this->ds = ldap_connect($host, $port);
- ldap_set_option($this->ds, LDAP_OPT_PROTOCOL_VERSION, 3);
- ldap_bind($this->ds, $user, $pass);
- }
- public function __destruct() {
- ldap_close($this->ds);
- }
- public function findl($attr,$value,$dnbase) {
- $searching = ldap_search($this->ds, $dnbase, $attr . '=' . $value);
- if ($searching) {
- return ldap_get_entries($this->ds, $searching);
- }
- }
- }
- ?>
- <?php
- $ldap = new LDAPAC('10.0.6.250','389','ou=accounts,o=comMail','cn=Manager,o=comMail','babaca');
- $t = $ldap->findl('mail','fabricio.fonseca@alog.com.br','ou=alog.com.br,ou=accounts,o=comMail');
- print_r($t);
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement