Secure Undo magic_quotes


/ Published in: PHP
Save to your folder(s)

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


Copy this code and paste it in your HTML
  1. <?php
  2. $in = array(&$_GET, &$_POST, &$_COOKIE);
  3. while (list($k,$v) = each($in)) {
  4. foreach ($v as $key => $val) {
  5. if (!is_array($val)) {
  6. $in[$k][$key] = stripslashes($val);
  7. continue;
  8. }
  9. $in[] =& $in[$k][$key];
  10. }
  11. }
  12. unset($in);
  13. }
  14. ?>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.