note 35095 added to function.ldap-search
| From: | nicolas at atanis dot net | Date: | Tue, 19 Aug 2003 16:17:58 +0000 |
| Subject: | note 35095 added to function.ldap-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-54700@lists.php.net to get a copy of this message | ||
Here is a little script that make a complete subtree search ( i know a script above seems do that
but it doesnt work fine)
This is my version:
Voila ce que j'ai fait aujourd'hui ...
$ldap_host = "192.168.0.50";
$ldap_port = "389";
$base_dn = "dc=fr";
$filter = "(cn=*)";
$ldap_user ="cn=admin,dc=fr";
$ldap_pass = "hellodelu";
$connect = ldap_connect( $ldap_host, $ldap_port);
ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);
$bind = ldap_bind($connect, $ldap_user, $ldap_pass);
$read = ldap_search($connect, $base_dn, $filter);
$info = ldap_get_entries($connect, $read);
echo $info["count"]." entrees retournees<BR><BR>";
for($ligne = 0; $ligne<$info["count"]; $ligne++)
{
for($colonne = 0; $colonne<$info[$ligne]["count"]; $colonne++)
{
$data = $info[$ligne][$colonne];
echo $data.":".$info[$ligne][$data][0]."<BR>";
}
echo "<BR>";
}
ldap_close($connect);
--------
nicolas
----
Manual Page -- http://www.php.net/manual/en/function.ldap-search.php
Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+35095
Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+35095&report=yes
Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+35095&report=yes