[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Newby: Get entries?
Hi everyone...
I'm sure LDAP is very useful but it's kind of getting on my nerves ;) Just
kidding!
After all the help I got from here I finally made a few things work. Right
now I'm trying to make a simple search by uid and then display all the
attributes for that particular entry.
I assume I should use the ldap_get_attributes function but I just found an
example for the ldap_get_entries function. After making a few changes to
that example, this is what I used in my PHP script:
$info = ldap_get_entries($ds, $sr);
echo "Returned data for ".$info["count"]." entries:<p>";
for ($i=0; $i<$info["count"]; $i++) {
echo "Number of entries: ". $info[$i]["count"] ."<br>";
echo "dn: ". $info[$i]["dn"] ."<br>";
echo "cn: ". $info[$i]["cn"][0] ."<br>";
echo "sn: ". $info[$i]["sn"][0] ."<br>";
echo "objectClass 0: ". $info[$i]["objectClass"][0] ."<br>";
echo "objectClass 1: ". $info[$i]["objectClass"][1] ."<br>";
echo "objectClass 2: ". $info[$i]["objectClass"][2] ."<br>";
echo "objectClass 3: ". $info[$i]["objectClass"][3] ."<br>";
echo "mailHost: ". $info[$i]["mailHost"][0] ."<br>";
echo "mailMessageStore: ". $info[$i]["mailMessageStore"][0]
."<br>";
echo "uid: ". $info[$i]["uid"][0] ."<br>";
echo "userPassword: ". $info[$i]["userPassword"][0] ."<br>";
echo "email: ". $info[$i]["mail"][0] ."<br>";
echo "mailAlternateAddress: ". $info[$i]["mailAlternateAddress"][0]
."<br>";
echo "mailForwardingAddress: ".
$info[$i]["mailForwardingAddress"][0] ."<p>";
}
The searched entry has values for all the above attributes but I only get
information on a few of them. This is what I get on screen:
Number of entries: 10
dn: uid=name.lastname, ou=subfolder1, dc=company, dc=com
cn: Johnny Web
sn: second
objectClass 0:
objectClass 1:
objectClass 2:
objectClass 3:
mailHost:
mailMessageStore:
uid es: name.lastname
userPassword es:
email es: name.lastname@aa.aa
mailAlternateAddress:
mailForwardingAddress:
What happened with all the other values? Whay aren't they shown like all the
rest?
Thanks again for your help.
JON