1 <?php 2 3 // If magic quotes are enabled, strip slashes from all user data 4 function stripslashes_recursive($var) { 5 return (is_array($var) ? array_map('stripslashes_recursive', $var) : stripslashes($var)); 6 } 7 8 if (get_magic_quotes_gpc()) { 9 $_GET = stripslashes_recursive($_GET); 10 $_POST = stripslashes_recursive($_POST); 11 $_COOKIE = stripslashes_recursive($_COOKIE); 12 } 13 14 ?>
(thanks :)
1 2 <?php 3 4 if (get_magic_quotes_gpc()) { 5 $in = array(&$_GET, &$_POST, &$_COOKIE); 6 while (list($k,$v) = each($in)) { 7 foreach ($v as $key => $val) { 8 if (!is_array($val)) { 9 $in[$k][$key] = stripslashes($val); 10 continue; 11 } 12 $in[] =& $in[$k][$key]; 13 } 14 } 15 unset($in); 16 } 17 18 ?>
You need to create an account or log in to post comments to this site.