note 28116 deleted from function.set-magic-quotes-runtime by didou
| From: | didou@php.net | Date: | Thu, 29 May 2003 21:46:31 +0000 |
| Subject: | note 28116 deleted from function.set-magic-quotes-runtime by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-49336@lists.php.net to get a copy of this message | ||
Note Submitter: gnarf at gnarf dot net
----
PHP 4.1 whatever, compilation of everyones ideas.
// Defeat magic quotes
if (get_magic_quotes_gpc())
{
remove_magic_quotes("_GET");
remove_magic_quotes("_POST");
remove_magic_quotes("_SESSION");
remove_magic_quotes("_COOKIE");
ini_set("magic_quotes_gpc",0);
}
set_magic_quotes_runtime(0);
function remove_magic_quotes($vars,$suffix = '') {
eval("\$vars_val =& \$GLOBALS[$vars]$suffix;");
if (is_array($vars_val)) {
reset($vars_val);
while (list($key,$val) = each($vars_val))
remove_magic_quotes($vars,$suffix."[$key]");
} else {
$vars_val = stripslashes($vars_val);
eval("\$GLOBALS$suffix = \$vars_val;");
}
}
On a side, note, to do this easier, couldn't there be a PHP call that reprocesses all the magic
quoted stuff from the server, and fixes it so its not magic_quote'ed anymore?