» tagged pages
» logout
PHP
Return to PHP Code Snippets

undo_magic_quotes and PHP 6

Tags Applied to this Entry

1 person has tagged this page:


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);
}



Code source magic_quotes and $_GET, $_POST, $_COOKIE, $_REQUEST ( php6 )
Username:
Password:
(or Cancel)