March 22, 2006 1 Comment
Easily one of the most useful functions in PHP.
In order to protect against SQL/code injection attacks, developers are encouraged to sanitize your input. This gets to be a little bit of a hassle applying sanitation functions to 200 form variables and 8 URL variables.
The answer? Array Map.
$_GET = array_map(“sanitize”, $_GET);
$_POST = array_map(“sanitize”, $_POST);
Sanitize is a user-defined function that employs strip_tags and trim, among other hacker defeating elements.
It’s that easy.