Question

hello my friends i'm trying to get some data from the active directory but i have a problem when the stored eamil in capital letters or mixed letters , i want the ldap_search() to search the AD ignoring the case of the letters here's my function and thank you in advance

    function LDAPget($email)
    {
        $ldap['server'] = 'xx.xx.xx.xx';
        $ldap['user'] = 'x';
        $ldap['pass'] = 'any';
        $ds = ldap_connect($ldap['server']); 
        $bind = ldap_bind($ds, $ldap['user'], $ldap['pass']);
        $filter = "(mail=$email)";
        $sr = ldap_search($ds, $ldap['base_dn'], $filter, array('*'));
        $rows = ldap_get_entries($ds, $sr);
}
Was it helpful?

Solution 2

the strcasecmp function did the trick

    if (strcasecmp($rows[0][$filtername][0], $usereinfo) == 0 ) {

//problem solved 
}

OTHER TIPS

The LDAP client must use the exactMatch matching rule in the filter. Which caseExact matching rule is used depends on the attribute definition, which is stored in the schema. Each attribute has its own attribute type, syntax, matching rules, and other information. If the LDAP Directory Server is not LDAP compliant, extensible match filters might not be supported, in which case, the application must process the data retrieved from the LDAP directory server.

see also

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top