GPC Magic Quotes Runtime Stripping


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

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


Copy this code and paste it in your HTML
  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. }

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.