note 119463 added to function.ldap-search
| From: | mike at remi-designs dot net | Date: | Mon, 13 Jun 2016 10:27:22 +0000 |
| Subject: | note 119463 added to function.ldap-search | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-205694@lists.php.net to get a copy of this message | ||
I ran into the problem, that the attribute I was search for had the matching rule of
"exactMatch".
Example:
E-Mail Address is stored in mixed case: John.Doe@example.com
LDAP Search will not retrieve any values when the user enters: john.doe@example.com
Solution: instead of comparing user input and attribute value by
<?php
if($data[$i]['mail'][0] == $username) {
// this will run into nothing
}
?>
use strcasecmp instead:
<?php
if(strcasecmp($data[$i]['mail'][0], $username) == 0) {
// works
}
----
Server IP: 72.52.91.14
Probable Submitter: 91.229.57.240
----
Manual Page -- http://php.net/manual/en/function.ldap-search.php
Edit -- https://master.php.net/note/edit/119463
Del: integrated -- https://master.php.net/note/delete/119463/integrated
Del: useless -- https://master.php.net/note/delete/119463/useless
Del: bad code -- https://master.php.net/note/delete/119463/bad+code
Del: spam -- https://master.php.net/note/delete/119463/spam
Del: non-english -- https://master.php.net/note/delete/119463/non-english
Del: in docs -- https://master.php.net/note/delete/119463/in+docs
Del: other reasons-- https://master.php.net/note/delete/119463
Reject -- https://master.php.net/note/reject/119463
Search -- https://master.php.net/manage/user-notes.php