dal php.ini
; Magic quotes for incoming GET/POST/Cookie data.
magic_quotes_gpc = On
lo pruoi controllare anche dinamicamente da script così:
get_magic_quotes_gpc()
con il sequente codice fai in modo che, in qualunque circostanza, vengano messi gli slash ai dati gpc (GET, POST, COOKIE)
Codice PHP:
if (!get_magic_quotes_gpc())
{
function magicSlashes($element)
{
if (is_array($element))
return array_map("magicSlashes", $element);
else
return addslashes($element);
}
// Add slashes to all incoming GET/POST/COOKIE data.
if (isset ($_GET) && count($_GET)) $_GET = array_map("magicSlashes", $_GET);
if (isset ($_POST) && count($_POST)) $_POST = array_map("magicSlashes", $_POST);
if (isset ($_COOKIES) && count($_COOKIES))$_COOKIE = array_map("magicSlashes", $_COOKIE);
}