note 69013 added to function.mysql-escape-string

From: Date: Sat, 19 Aug 2006 19:26:25 +0000
Subject: note 69013 added to function.mysql-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-116068@lists.php.net to get a copy of this message
a way to clean _POST _GET and _COOKIE along with their registered global variables. <?php function cleanmysql($arr,$arr2) { foreach ($arr as $gt1=>$gt2) { if (is_array($arr[$gt1])) { list($arr[$gt1],$arr2[$gt1])=cleanmysql($arr[$gt1],$arr2[$gt1]); } else { $gt2=mysql_escape_string($gt2); $arr[$gt1]=$arr2[$gt1]=$gt2; } } return array($arr,$arr2); } list($_GET,$GLOBALS) = cleanmysql($_GET,$GLOBALS); list($_POST,$GLOBALS) = cleanmysql($_POST,$GLOBALS); list($_COOKIE,$GLOBALS) = cleanmysql($_COOKIE,$GLOBALS); ?> ---- Server IP: 195.222.164.18 Probable Submitter: 85.140.97.155 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.mysql-escape-string.php Edit -- https://master.php.net/note/edit/69013 Del: integrated -- https://master.php.net/note/delete/69013/integrated Del: useless -- https://master.php.net/note/delete/69013/useless Del: bad code -- https://master.php.net/note/delete/69013/bad+code Del: spam -- https://master.php.net/note/delete/69013/spam Del: non-english -- https://master.php.net/note/delete/69013/non-english Del: in docs -- https://master.php.net/note/delete/69013/in+docs Del: other reasons-- https://master.php.net/note/delete/69013 Reject -- https://master.php.net/note/reject/69013 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#116068) next »