Code: Select all
<?
$IE = array_keys($_GET); $i=0;
while($i<count($IE)) { $_GET[$IE[$i]]= protect($_GET[$IE[$i]]); $i++; }
$IE = array_keys($_POST); $i=0;
while($i<count($IE)) { $_POST[$IE[$i]]= protect($_POST[$IE[$i]]); $i++; }
$IE = array_keys($_REQUEST); $i=0;
while($i<count($IE)) { $_REQUEST[$IE[$i]]= protect($_REQUEST[$IE[$i]]); $i++; }
$IE = array_keys($_COOKIE); $i=0;
while($i<count($IE)) { $_COOKIE[$IE[$i]]= protect($_COOKIE[$IE[$i]]); $i++; }
$IE = array_keys($_SESSION); $i=0;
while($i<count($IE)) { $_SESSION[$IE[$i]]= protect($_SESSION[$IE[$i]]); $i++; }
function protect($var)
{
$newvar = @preg_replace('/[^a-zA-Z0-9\_\-\.@]/','',$var);
if(strpos(str_replace("''",""," $newvar"),"'")!=false)
return str_replace("'", "''", $newvar);
else return $newvar;
}
?>