Posted By

luizlopes on 05/16/08


Tagged

escape get php post input cookie array quotes security secure values best magicquotes gpc practices


Versions (?)

Secure Undo magic_quotes


 / Published in: PHP
 

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

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

  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. ?>

Report this snippet  

You need to login to post a comment.