<?php
function sGaddSlashes($arr)
{
foreach($arr as $_Key)
{
if( is_array($GLOBALS[$_Key]) )
{
while( list($k, $v) = each($GLOBALS[$_Key]) )
{ if( is_array($_Key[$k]) )
{
while( list($k2, $v2) = each($_Key[$k]) )
{
$_Key[$k][$k2] = addslashes($v2);
}
@reset($_Key[$k]);
} else {
$_Key[$k] = addslashes($v);
} // end if
} // end while
@reset($GLOBALS[$_Key]);
} // end if
} // end foreach
}
function do_clean($data) {
$data = escapeshellcmd($data);
$data = preg_replace("/..\//", "", $data);
$data = preg_replace("/^\//", "", $data);
$data = htmlentities($data);
// $data = addslashes($data);
return $data;
}
$MQ = (boolean) get_magic_quotes_gpc();
if( !$MQ ){
sGaddSlashes(array('$_GET', '$_POST'));
}
if($_POST)
{
$post = array();
$post = $_POST;
foreach($post as $key=>$val) {
$$key = do_clean($val);
}
}
if($_GET)
{
$get = array();
$get = $_POST;
foreach($get as $key=>$val)
{
$$key = do_clean($val);
}
}
?>
]]>