note 107529 deleted from function.mysql-real-escape-string by philip

From: Date: Fri, 04 Sep 2015 20:45:33 +0000
Subject: note 107529 deleted from function.mysql-real-escape-string by philip
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-203686@lists.php.net to get a copy of this message
Note Submitter: Ortreum ---- This small function walks through a complete array without a "normal" loop and convert all potentially "bad" inputs like $_POST and $_GET to mysql conform strings. <?php function db_conform($s) { if (!is_array($s)) mysql_real_escape_string($s); function db_conform_array_callback(&$item, $key) { echo $key; $item = db_conform($item); } array_walk($s, 'db_conform_array_callback'); return $s; } $_POST = db_conform($_POST); ?>

« previous php.notes (#203686) next »