保护免受XSS攻击脚本


<? <? function antihack(&$var){ if(is_array($var)) array_walk($var, 'antihack');功能antihack(&$ ​​VAR){如果(IS_ARRAY(是$ var))的。array_walk($变种,'antihack'); else $var = htmlspecialchars(stripslashes(mysql_real_escape_string($var)), ENT_QUOTES, 'UTF-8');否则是$ 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'); }的foreach(数组('_SERVER','_GET','_POST','_COOKIE','_REQUEST')为$ V){如果(!空($ {$ V}))的。array_walk($ {$ V}, 'antihack'); } ?> }?>

出处.俄国一论坛



扫描二维码,在手机上阅读

强悍邮件转发服务 - Bouncr

高防DNS盾 、防劫持 防DDOS 域名解析、免费智能DNS

评 论