Posted By

DrewDouglass on 07/11/09


Tagged

php


Versions (?)

Who likes this?

2 people have marked this snippet as a favorite

GandalfGrey
qubestream


GPC Magic Quotes Runtime Stripping


 / Published in: PHP
 

URL: http://codingforums.com/showthread.php?t=144149

All credit for this code goes to the all mighty Fou-Lou of codingforums.com (link given).

  1. if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc())
  2. {
  3. function GPCStrip($arr)
  4. {
  5. if (is_array($arr))
  6. {
  7. foreach ($arr AS $arrKey => $arrVal)
  8. {
  9. $arr[$arrKey] = GPCStrip($arrVal);
  10. }
  11. }
  12. else if (is_string($arr))
  13. {
  14. $arr = stripslashes($arr);
  15. }
  16. return $arr;
  17. }
  18. $_GET = GPCStrip($_GET);
  19. $_POST = GPCStrip($_POST);
  20. $_COOKIE = GPCStrip($_COOKIE);
  21. if (is_array($_FILES))
  22. {
  23. foreach ($_FILES AS $key => $val)
  24. {
  25. $_FILES[$key]['tmp_name'] = str_replace('\\', '\\\\', $val['tmp_name']);
  26. }
  27. }
  28. $_FILES = GPCStrip($_FILES);
  29. }
  30. if (function_exists('set_magic_quotes_runtime'))
  31. {
  32. }

Report this snippet  

You need to login to post a comment.