note 104348 added to function.ldap-search

From: Date: Fri, 10 Jun 2011 09:23:57 +0000
Subject: note 104348 added to function.ldap-search
Groups: php.notes 
Request: Send a blank email to php-notes+get-180396@lists.php.net to get a copy of this message
Building on ldap_escape() from douglass_davis at earthlink dot net: - This code is more succinct - Moved the backslash escape to the start of the queue, so it doesn't escape backslashes that are added by escaping other characters - This version is around 3 times faster (on Windows 2K3 R2 at least) This still does not cope with nested filters, but is quick and useful on systems where PEAR is not available/not practical. <?php function ldap_escape ($s, $d = FALSE) { return str_replace(($d) ? array('\\',',','=','+','<','>',';','"','#') : array('\\','*','(',')',chr(0)), ($d) ? array('\\5c','\\2c','\\3d','\\2b','\\3c','\\3e','\\3b','\\22','\\23') : array('\\5c','\\2a','\\28','\\29','\\00'), $s); } ?> ---- Server IP: 69.147.83.197 Probable Submitter: 77.107.172.13 ---- Manual Page -- http://www.php.net/manual/en/function.ldap-search.php Edit -- https://master.php.net/note/edit/104348 Del: integrated -- https://master.php.net/note/delete/104348/integrated Del: useless -- https://master.php.net/note/delete/104348/useless Del: bad code -- https://master.php.net/note/delete/104348/bad+code Del: spam -- https://master.php.net/note/delete/104348/spam Del: non-english -- https://master.php.net/note/delete/104348/non-english Del: in docs -- https://master.php.net/note/delete/104348/in+docs Del: other reasons-- https://master.php.net/note/delete/104348 Reject -- https://master.php.net/note/reject/104348 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180396) next »