note 82831 added to function.stripslashes
| From: | techdesk100 at osu1 dot php dot net | Date: | Mon, 28 Apr 2008 14:58:12 +0000 |
| Subject: | note 82831 added to function.stripslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-138868@lists.php.net to get a copy of this message | ||
Function which checks if $input has correct slashes,
otherwise adds slashes. For cases when you are not sure the input is not already addslashed.
public function addslashes_once($input){
//These characters are single quote ('), double quote ("), backslash (\) and NUL
(the NULL byte).
$pattern = array("\\'", "\\\"", "\\\\",
"\\0");
$replace = array("", "", "", "");
if(preg_match("/[\\\\'\"\\0]/", str_replace($pattern, $replace,
$input))){
return addslashes($input);
}
else{
return $input;
}
}
----
Server IP: 64.71.164.2
Probable Submitter: 84.53.67.94
----
Manual Page -- http://www.php.net/manual/en/function.stripslashes.php
Edit -- https://master.php.net/note/edit/82831
Del: integrated -- https://master.php.net/note/delete/82831/integrated
Del: useless -- https://master.php.net/note/delete/82831/useless
Del: bad code -- https://master.php.net/note/delete/82831/bad+code
Del: spam -- https://master.php.net/note/delete/82831/spam
Del: non-english -- https://master.php.net/note/delete/82831/non-english
Del: in docs -- https://master.php.net/note/delete/82831/in+docs
Del: other reasons-- https://master.php.net/note/delete/82831
Reject -- https://master.php.net/note/reject/82831
Search -- https://master.php.net/manage/user-notes.php