I use this as an include. Don't recall where I got it from, perhaps the manual comments.
<?php
function strip_magic_quotes($arr) {
foreach ($arr as $k => $v) {
if (is_array($v)) {
$arr[$k] = strip_magic_quotes($v);
} else {
$arr[$k] = stripslashes($v);
}
}
return $arr;
}
if (get_magic_quotes_gpc()) {
if (!empty($_GET)) { $_GET = strip_magic_quotes($_GET); }
if (!empty($_POST)) { $_POST = strip_magic_quotes($_POST); }
if (!empty($_REQUEST)) { $_REQUEST = strip_magic_quotes($_REQUEST); }
if (!empty($_COOKIE)) { $_COOKIE = strip_magic_quotes($_COOKIE); }
}
?>