<?
foreach($_REQUEST as $_k=>$_v)
{
echo strlen($_K);exit();
if( strlen($_k)>0 && eregi('^(cfg_|GLOBALS)',$_k) )
{
exit('Request var not allow!');
}
}
function _RunMagicQuotes(&$svar)
{
if(!get_magic_quotes_gpc())
{
if( is_array($svar) )
{
foreach($svar as $_k => $_v) $svar[$_k] = _RunMagicQuotes($_v);
}
else
{
$svar = addslashes($svar);
}
}
return $svar;
}
foreach(Array('_GET','_POST','_COOKIE') as $_request)
{
foreach($$_request as $_k => $_v) ${$_k} = _RunMagicQuotes($_v);
}
echo $uname;
?>
在html页面
<form>
uname:<input typ="text" name='uname' />
<input type="submit" value="submit"/>
</form>