if(!function_exists('get_magic_quotes_gpc')) { // for PHP 6.x function get_magic_quotes_gpc() { return 0; } } if(get_magic_quotes_gpc()) { function undo_magic_quotes(&$array) { foreach($array as $key => $value) { if(is_array($value)) { undo_magic_quotes($array[$key]); } else { $array[$key] = stripslashes($value); } } } undo_magic_quotes($_GET); undo_magic_quotes($_POST); undo_magic_quotes($_COOKIE); undo_magic_quotes($_REQUEST); undo_magic_quotes($_FILES); }