I am trying to get ldap info from a W2K active directory. I have the authentication down, but I want to search on the aa0000000 to get the name associated with the login. Basically I am making a request form that will be used once a year, but need to be sure of the people signing up, use resources already setup, and have one login/pass.
Thanks for any help,
Kurt
Connect and autentication(works):
if (!($ldap = ldap_connect("x.x.x.x"))) {
die ("Could not connect to LDAP server");
}
$dn = "aa0000000@my.domain.edu";
$password = "pass";
if (!($res = @ldap_bind($ldap, $dn, $password))) {
die ("Could not bind to $dn");
}
Search for name(broken):
Error:Warning: Supplied argument is not a valid ldap link resource in /var/www/html/ldap.php on line 36
$person ="aa0000000";
$filter="(|(sn=$person)(givenname=$person))";
$justthese = array( "ou", "sn", "givenname", "mail");
$sr=ldap_search($ds, $dn, $filter, $justthese);
$info = ldap_get_entries($ds, $sr);
print $info["count"]." entries returned<p>";