Removes magic quotes on $_GET, $_POST, $_COOKIE, $_FILES and $_REQUEST, when they are enabled.
1
2 <?php
3
4 // remove magic_quotes
5 if(get_magic_quotes_gpc())
6 {
7 function undo_magic_quotes_array($array)
8 {
9 return is_array($array) ? array_map('undo_magic_quotes_array', $array) : str_replace("\\'", "'",
10 str_replace("\\\"", "\"",
11 str_replace("\\\\", "\\",
12 str_replace("\\\x00", "\x00", $array))));
13 }
14
15 $_GET = undo_magic_quotes_array($_GET);
16 $_POST = undo_magic_quotes_array($_POST);
17 $_COOKIE = undo_magic_quotes_array($_COOKIE);
18 $_FILES = undo_magic_quotes_array($_FILES);
19 $_REQUEST = undo_magic_quotes_array($_REQUEST);
20 }
21
22 ?>