Return to Snippet

Revision: 6325
at May 16, 2008 10:31 by luizlopes


Initial Code
<?php
if (get_magic_quotes_gpc()) {
        $in = array(&$_GET, &$_POST, &$_COOKIE);
        while (list($k,$v) = each($in)) {
                foreach ($v as $key => $val) {
                        if (!is_array($val)) {
                                $in[$k][$key] = stripslashes($val);
                                continue;
                        }
                        $in[] =& $in[$k][$key];
                }
        }
        unset($in);
}
?>

Initial URL
http://talks.php.net/show/php-best-practices/26

Initial Description
This was taken out of a presentation by eZ systems on PHP Best Practices

Initial Title
Secure Undo magic_quotes

Initial Tags
php, post, array, security, best

Initial Language
PHP