note 61173 added to function.ldap-search

From: Date: Fri, 27 Jan 2006 11:53:32 +0000
Subject: note 61173 added to function.ldap-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-102554@lists.php.net to get a copy of this message
HOWTO list LDAP users. This CODE list one user from LDAP tree, but I' like list all user from LDAP one ou=Organization <?php $ldaprdn = 'cn=user,dc=domain,dc=org'; $ldappass = 'password'; $sdn = 'cn=user,ou=group,dc=domain,dc=org'; $ldapconn = ldap_connect("ldap://localhost", 389) or die("Not connect: $ldaphost "); if ($ldapconn) { // binding to ldap server $ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass); // verify binding if ($ldapbind) { $filter="uid=*"; $justthese = array("uid"); $sr=ldap_read($ldapconn, $srdn, $filter, $justthese); $entry = ldap_get_entries($ldapconn, $sr); } else { echo "LDAP conn ok..."; } } ldap_close($ldapconn); ?> <?php echo $entry[0]["mail"][0] . " mail adress "; echo $entry[0]["sn"][0] . " Name "; ?> ---- Server IP: 195.228.154.4 Probable Submitter: 212.24.169.130 (proxied: unknown) ---- Manual Page -- http://www.php.net/manual/en/function.ldap-search.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+61173 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61173&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61173&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61173&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61173&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61173&report=yes&reason=non-english Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61173&report=yes&reason=already+in+docs Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61173&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+61173&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#102554) next »