note 87506 added to function.addslashes
| From: | (sohel62@yahoo.com) | Date: | Mon, 08 Dec 2008 06:09:36 +0000 |
| Subject: | note 87506 added to function.addslashes | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-147901@lists.php.net to get a copy of this message | ||
About Raymond and Aditya's post
Following code can help you to add slashes with posted array.
I just added a recursive function with Aditya's code.
<?php
//create array to temporarily grab variables
$input_arr = array();
//grabs the $_POST variables and adds slashes
foreach ($_POST as $key => $input_arr) {
if(is_array($input_arr)){
$_POST[$key] = addslashes_array($input_arr);
}else{
$_POST[$key] = addslashes($input_arr);
}
}
// Recursive Function to add slashes with posted array.
function addslashes_array($input_arr){
if(is_array($input_arr)){
$tmp = array();
foreach ($input_arr as $key1 => $val){
$tmp[$key1] = addslashes_array($val);
}
return $tmp;
}else{
return addslashes($input_arr);
}
}
?>
----
Server IP: 219.94.145.73
Probable Submitter: 210.251.252.137
----
Manual Page -- http://www.php.net/manual/en/function.addslashes.php
Edit -- https://master.php.net/note/edit/87506
Del: integrated -- https://master.php.net/note/delete/87506/integrated
Del: useless -- https://master.php.net/note/delete/87506/useless
Del: bad code -- https://master.php.net/note/delete/87506/bad+code
Del: spam -- https://master.php.net/note/delete/87506/spam
Del: non-english -- https://master.php.net/note/delete/87506/non-english
Del: in docs -- https://master.php.net/note/delete/87506/in+docs
Del: other reasons-- https://master.php.net/note/delete/87506
Reject -- https://master.php.net/note/reject/87506
Search -- https://master.php.net/manage/user-notes.php