countnikon Posted July 5, 2006 Share Posted July 5, 2006 Hello Everybody,I'm having trouble with this class I'm making for doing LDAP authentication and Lookups. However, I cannot output my results. Can somebody shed some light on this please?[code]<?PHPclass ldap{ var $ldapconn; //ldap connection storage variable var $ldap_bind; //ldap bind storage variable var $entries; //ldap entries variable var $dc = "my dc server"; var $port = 389; var $ldapLookupUser = "ldaplookupuser"; var $ldapLookupPass = "ldaplookup pass"; function ldapConn() { $this->ldapconn = @ldap_connect($dc,$port); } function ldapBind() { $this->ldap_bind = @ldap_bind($this->ldapconn,$ldapLookupUser,$ldapLookupPass); } function ldapAuthenticate() { if(@ldap_bind($this->ldapconn,$username,$password)) return true; else return false; } function ldapSearch($by,$search,$ou) { $read = @ldap_search($this->ldapconn, "ou=$ou,dc=mydc,dc=net", "samaccountname=*$search*"); $entries = @ldap_get_entries($this->ldapconn, $read); for ($i=0; $i<$entries["count"]; $i++) { if($entries[$i][$by][0]) $values = $values.$entries[$i][$by][0]; } return $values; }}$ldap = new ldap;$ldap->ldapConn();$ldap->ldapBind();$results = $ldap->ldapSearch("mail","myusrname","myou");echo $results;?>[/code]I know the ldap searches are working because it is not erroring out anymore. Any help would be appreciated. Quote Link to comment https://forums.phpfreaks.com/topic/13792-help-creating-an-ldap-class/ Share on other sites More sharing options...
countnikon Posted July 6, 2006 Author Share Posted July 6, 2006 Anybody here good with classes? Quote Link to comment https://forums.phpfreaks.com/topic/13792-help-creating-an-ldap-class/#findComment-53983 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.