PHP and Ldap - cont

Problems with the Windows version of XAMPP, questions, comments, and anything related.

PHP and Ldap - cont

Postby briangcc » 21. November 2006 14:27

Ok so I got PHP and LDAP talking to a MS Active Directory. I'm now trying to build an authentication piece and I'm hanging up on the LDAP_search function. Here's the code:

$ldapserver=ldap_connect("adserver.domain.org");
if (!$ldapserver) {
echo "Unable to connect to LDAP Server";
exit;
}
$bind=ldap_bind($ldapserver);
if (!$bind) {
echo "Unable to bind to LDAP Server";
exit;
}
$base_dn="DC=ad.domain.org";
$filter="cn=" . $username;
echo "Filter: $filter";
$inforequired=array("ou","sn","mail","employeeID");
$result=ldap_search($ldapserver,$base_dn,$filter,$inforequired);

The error code popping up is:

Warning: ldap_search() [function.ldap-search]: Search: Operations error in C:\Program Files\xampp\htdocs\logged.php on line 25

I did try putting in the credentials of an active AD user to get around the anonymous AD Bind issues but I end up with the same error message. So where did I go wrong with this?

**If I trim out the $inforequired entry in the $result line I still end up with the same error.
briangcc
 
Posts: 3
Joined: 14. November 2006 19:26

Return to XAMPP for Windows

Who is online

Users browsing this forum: No registered users and 49 guests