<? 
function antihack(&$var){ 
if(is_array($var)) array_walk($var, 'antihack'); 
else $var = htmlspecialchars(stripslashes(mysql_real_escape_string($var)), ENT_QUOTES, 'UTF-8'); } 
foreach(array('_SERVER', '_GET', '_POST', '_COOKIE', '_REQUEST') as $v){ 
if(!empty(${$v})) array_walk(${$v}, 'antihack'); 
} 
?> 