Global VARS.

From: Date: Fri, 07 Mar 2003 20:27:30 +0000
Subject: Global VARS.
Groups: php.general 
Request: Send a blank email to php-general+get-138691@lists.php.net to get a copy of this message
Hello, To get ride of magic_quotes I do: function no_magicquotes() { global $HTTP_GET_VARS ; global $HTTP_POST_VARS ; global $HTTP_COOKIE_VARS ; if (get_magic_quotes_gpc()) { // Overrides GPC variables for (reset($HTTP_GET_VARS); list($k, $v) = each($HTTP_GET_VARS); ) $$k = stripslashes($v); for (reset($HTTP_POST_VARS); list($k, $v) = each($HTTP_POST_VARS); )
     $$k = stripslashes($v);
for (reset($HTTP_COOKIE_VARS); list($k, $v) = each($HTTP_COOKIE_VARS);)
     $$k = stripslashes($v);
} } And it seems to work, But i have have a file like that:
$VAR_mailadmin     = "mail@toto.com" ;
$VAR_urlgallery    = "http://www.siova.net/paris2" ;
$VAR_categories[0]["title"] = "Montréal by Night" ; $VAR_categories[0]["name"] = "Mtl by night" ; $VAR_categories[0]["file"] = "montreal_by_night" ; ... And many others variables. And magic_quotes seems to work for global vars too. Is there a way to modify no_magicquotes() to make this function works with all global vars ? Another for...each...but how ? Thanks, Vincent.

« previous php.general (#138691) next »