note 78753 added to function.mysql-real-escape-string
| From: | Anonymous at osu1 dot php dot net | Date: | Thu, 25 Oct 2007 23:09:38 +0000 |
| Subject: | note 78753 added to function.mysql-real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-131741@lists.php.net to get a copy of this message | ||
// this doesn't do adding the quotes, checking for null, etc that the quote smart does, it
simply sanitizes input and handles arrays recursively
<?php
function sanitize($input){
if(is_array($input)){
foreach($input as $k=>$i){
$output[$k]=sanitize($i);
}
}
else{
if(get_magic_quotes_gpc()){
$input=stripslashes($input);
}
$output=mysql_real_escape_string($input);
}
return $output;
}
?>
// use: if you are going to use $_POST, $_GET, $_COOKIE or $_REQUEST, include the appropriate line
first.
$_POST=sanitize($_POST);
$_GET=sanitize($_GET);
$_COOKIE=sanitize($_COOKIE);
$_REQUEST=sanitize($_REQUEST);
----
Server IP: 69.147.83.197
Probable Submitter: 70.59.113.48
----
Manual Page -- http://www.php.net/manual/en/function.mysql-real-escape-string.php
Edit -- https://master.php.net/note/edit/78753
Del: integrated -- https://master.php.net/note/delete/78753/integrated
Del: useless -- https://master.php.net/note/delete/78753/useless
Del: bad code -- https://master.php.net/note/delete/78753/bad+code
Del: spam -- https://master.php.net/note/delete/78753/spam
Del: non-english -- https://master.php.net/note/delete/78753/non-english
Del: in docs -- https://master.php.net/note/delete/78753/in+docs
Del: other reasons-- https://master.php.net/note/delete/78753
Reject -- https://master.php.net/note/reject/78753
Search -- https://master.php.net/manage/user-notes.php