Automagically using Pecl Filter for user input
| From: | Graham Anderson | Date: | Fri, 29 Sep 2006 21:27:16 +0000 |
| Subject: | Automagically using Pecl Filter for user input | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-242408@lists.php.net to get a copy of this message | ||
How can I use PECL Filter to 'automagically' filter user input ?
I DO understand calling the PECL filter directly in a PHP script like so:
<?php
$clean = array();
$clean['name'] = input_get(INPUT_POST, 'name', FL_REGEXP, array('regexp' => '^[\w ]+$'));
$clean['age'] = input_get(INPUT_POST, 'age', FL_INT);
$clean['email'] = input_get(INPUT_POST, 'email', FL_EMAIL);
$clean['list'] = input_get(INPUT_POST, 'list', FL_BOOLEAN);
?>
But where does 'automagically' come into play?
Does 'automagically' mean preconfiguring the filter to run from configuration script like php.ini ?
I am referencing a Rasmus article.
http://toys.lerdorf.com/index.php?url=archives/38-The-no-framework-PHP-MVC-framework.html&serendipity[csuccess]=moderate#feedback
many thanks