This solution is easy to add, of course, but it does a lot of things that are probably not necessary. I'd prefer a generic function like get_form_input($name) which does something like the solution posted by dc.ml[at]oxys.net but with also with GET parameters: $in = !empty($_POST[$name]) ? $_POST[$name] : $_GET[$name];
Regards, Thomas
Charles McNulty wrote:
Instead of that, using this:
if(!get_magic_quotes_gpc()){ function deepslash($v){ return (is_array($v)) ? array_map("deepslash", $v) : addslashes($v); } $_POST=array_map("deepslash", $_POST); $_GET=array_map("deepslash", $_GET); $_COOKIE=array_map("deepslash", $_COOKIE); $_REQUEST=array_map("deepslash", $_REQUEST); $_GLOBALS=array_map("deepslash", $_GLOBALS); $_SERVER=array_map("deepslash", $_SERVER);
}
taken from here: http://us2.php.net/manual/en/function.get-magic-quotes-gpc.php Should work much better and you only need to put it at the top of one of the main include files instead of modifying the entire codebase.
-Charles
dc.ml@oxys.net wrote:
Hi,
What do you think about that :
function getPOST($name) { global $_POST; if(is_set($_POST[$name])) { if(get_magic_quotes_gpc () == 1) return *stripslashes(*$_POST[$name]); else return $_POST[$name]; } return null; }
same thing for $_GET we only need to change all $_GET and $_POST.
I think it's more easy than playing with .htaccess or php.ini.
If you agree, I'll do it tonight.
David