Link to home
Start Free TrialLog in
Avatar of mankowitz
mankowitzFlag for United States of America

asked on

php ldap operations error

I am writing an application in php and trying to authenticate against an active directory server via LDAP. I am able to authenticate users (valid versus invalid), but I want to search the AD to get their full name. Here is my php code:

$ldap = ldap_connect("192.128.xxx.xxx") or die("NO LDAP CONNECTION");
$user = "xxxx";
$domiain_user = "domain\\" . $user;
ldap_set_option($ldap, LDAP_OPT_REFERRALS, 0);
ldap_set_option($ldap, LDAP_OPT_PROTOCOL_VERSION, 3);
        
if($bind = @ldap_bind($ldap, $domain_user, $_POST['password'])) {
    // valid
    $dn = "dc=evh,dc=inc";
    $filter = "(sAMAccountName=$user)";
	$attr = array("givenName", "sn");
    $result = ldap_search($ldap, $dn, $filter, $attr) or exit("Unable to search LDAP server");  
                                  // THIS IS WHERE I GET THE OPERATIONS ERROR
    $entries = ldap_get_entries($ldap, $result);
    var_dump($entries);
}

Open in new window


I keep getting an operations error. Any ideas?
ASKER CERTIFIED SOLUTION
Avatar of jausions
jausions
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mankowitz

ASKER

so it turns out that that typo was in my actual code....... D'oh!