note 74946 deleted from security.globals by tularis
| From: | tularis@php.net | Date: | Sat, 05 May 2007 18:20:35 +0000 |
| Subject: | note 74946 deleted from security.globals by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126222@lists.php.net to get a copy of this message | ||
Note Submitter: nospam at communitycolor dot com
Reason: useless
----
Rather than taking everything from $_REQUEST, you could add a validation filter. This way you only
get the variables that you expect. Such a filter could validate and cast type.
// this code will only make $one, $two, $three
$varType = array('one'=>'int', 'two'=>'str',
'three'=>int);
foreach($_REQUEST AS $key => $value) {
if ($varType[$key] == 'int') {
${$key} = (int) $value;
} elseif ($varType[$key] == 'str') {
${$key} = strip_tags($value);
}
}