note 73488 deleted from function.ldap-get-dn by didou

From: Date: Mon, 26 Feb 2007 03:16:44 +0000
Subject: note 73488 deleted from function.ldap-get-dn by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-123864@lists.php.net to get a copy of this message
Note Submitter: langhammer at gmail dot com Reason: bad code ---- Hi guys, I use LDAP to find different contexts in a few communitys. So my example has also a limited search. If there is any error mail me. <?php // specify your LDAP-Server $ldapserver=172.16.250.40; // specify username`s-dn you would like to find $username="steffen_langhammer"; // specify ldap_tree if you wouldn't search every unit // Here an fictive example to find usersdn in: "Cologne,Germany,General Motors" $ldaptree="ou=CO,ou=DE,o=GM"; // Connect to ldap, optional you should bind $ldapconnector=@ldap_connect($ldapserver); // The example: $ldapusersearch=@ldap_search($ldapconnector,$ldaptree,cn=$username); $entryid=@ldap_first_entry($ldapconnector, $ldapusersearch); $ldapdnread=@ldap_get_dn($ldapconnector,$entryid); // Output result echo"Users DN is: ".$ldapdnread; ?> Steffen

« previous php.notes (#123864) next »