Sometimes when i have alot of begginers create plugins or moduldes for a site i use something like...
foreach($_GET as $key=>$value) {
if(functions_exists('clean_get_'.$key)) {
$_GET[$key]=call_user_func('clean_get_'.$key,$value);
} else {
unset($_GET[$key];
}
}
... and all the get and post values are 'magically' cleaned or removed so i don't need to worry about someone elses sql-injectable plugin.
Or, if you are a fan of lazy-loading ...
foreach($_GET as $key=>$value) {
if(is_file('clean_get_'.$key.'.php')) {
include_once('clean_get_'.$key.'.php');
if(functions_exists('clean_get_'.$key)) {
$_GET[$key]=call_user_func('clean_get_'.$key,$value);
} else {
unset($_GET[$key]);
}
} else {
unset($_GET[$key];
}
}
ps. code was written here directly, mistakes are probable!