I just stumbled on this neat bit of code to filter $_POST
data quickly:
$post=array_map("filter_data",$_POST);
I've updated it to the new version (after PHP 5.2) and I've got
$post=array_map("filter_var",$_POST,array(516)); // 516 == 'unsafe_raw'
Now I'm paranoid; this seems too easy. So
- Should I not do this for all
post
data? (shifty nervous eyes) - Is
unsafe_raw
the correct filter for genericpost
,get
, or cookie data?
I should add I'm just trying for a general sanitizer, mainly to remove SQL injections. If I have an email address or something I can filter again later. Any ideas / suggestions / horrified stares?