note 24299 added to function.stripslashes

From: Date: Mon, 12 Aug 2002 18:22:09 +0000
Subject: note 24299 added to function.stripslashes
Groups: php.notes 
Request: Send a blank email to php-notes+get-34881@lists.php.net to get a copy of this message
Another function that considers string, arrays and objects : function no_magic_quotes_gpc(&$var) { if (is_string($var)) { $var = stripslashes($var); } elseif (is_array($var)) { foreach($var AS $key => $value) { no_magic_quotes_gpc($var[$key]); } } elseif (is_object($var)) { foreach(get_object_vars($var) AS $key => $value) { no_magic_quotes_gpc($var->$key); } } } if (get_magic_quotes_gpc()) { no_magic_quotes_gpc($_GET); no_magic_quotes_gpc($_POST); no_magic_quotes_gpc($_COOKIE); } Voilà ! JP. -- http://www.php.net/manual/en/function.stripslashes.php http://master.php.net/manage/user-notes.php?action=edit+24299 http://master.php.net/manage/user-notes.php?action=delete+24299 http://master.php.net/manage/user-notes.php?action=reject+24299

« previous php.notes (#34881) next »