Skip to content

Instantly share code, notes, and snippets.

@BastienClement
Created July 10, 2011 15:58
Show Gist options
  • Save BastienClement/1074644 to your computer and use it in GitHub Desktop.
Save BastienClement/1074644 to your computer and use it in GitHub Desktop.
Magic Quote Killer
<?php
// Turn off magic_quotes_runtime
if (get_magic_quotes_runtime())
@ini_set('magic_quotes_runtime', false);
// Strip slashes from GET/POST/COOKIE (if magic_quotes_gpc is enabled)
if (get_magic_quotes_gpc())
{
function stripslashes_array($array)
{
return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
}
$_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
$_COOKIE = stripslashes_array($_COOKIE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment