note 42471 added to function.mysql-escape-string

From: Date: Tue, 18 May 2004 10:11:25 +0000
Subject: note 42471 added to function.mysql-escape-string
Groups: php.notes 
Request: Send a blank email to php-notes+get-69749@lists.php.net to get a copy of this message
I often work with array-forms. So everything I submit is a child of the $_POST['SUBMIT'] - Array. To clean all inputs before working with it, I use the following function: function cleanArray(&$cleanMe) { function cleanElement(&$item, $key) { $item = mysql_escape_string($item); } array_walk($cleanMe, 'cleanElement'); } You may add more "checks" and cleanup-stuff into the cleanElement-Function (ex. htmlspecialchars and stuff like that). ---- Manual Page -- http://www.php.net/manual/en/function.mysql-escape-string.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+42471 Delete -- http://master.php.net/manage/user-notes.php?action=delete+42471&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+42471&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#69749) next »