您的足迹:首页 > PHP >PHP 简单的防注入

PHP 简单的防注入

function lib_replace_end_tag($str)
{
 if (empty($str)) return false;
 $str = htmlspecialchars($str);
 $str = str_replace( '/', "", $str);
 $str = str_replace("\\", "", $str);
 $str = str_replace("&gt", "", $str);
 $str = str_replace("&lt", "", $str);
 $str = str_replace("<SCRIPT>", "", $str);
 $str = str_replace("</SCRIPT>", "", $str);
 $str = str_replace("<script>", "", $str);
 $str = str_replace("</script>", "", $str);
 $str=str_replace("select","select",$str);
 $str=str_replace("join","join",$str);
 $str=str_replace("union","union",$str);
 $str=str_replace("where","where",$str);
 $str=str_replace("insert","insert",$str);
 $str=str_replace("delete","delete",$str);
 $str=str_replace("update","update",$str);
 $str=str_replace("like","like",$str);
 $str=str_replace("drop","drop",$str);
 $str=str_replace("create","create",$str);
 $str=str_replace("modify","modify",$str);
 $str=str_replace("rename","rename",$str);
 $str=str_replace("alter","alter",$str);
 $str=str_replace("cas","cast",$str);
 $str=str_replace("&","&",$str);
 $str=str_replace(">",">",$str);
 $str=str_replace("<","<",$str);
 $str=str_replace(" ",chr(32),$str);
 $str=str_replace(" ",chr(9),$str);
 $str=str_replace("    ",chr(9),$str);
 $str=str_replace("&",chr(34),$str);
 $str=str_replace("'",chr(39),$str);
 $str=str_replace("<br />",chr(13),$str);
 $str=str_replace("''","'",$str);
 $str=str_replace("css","'",$str);
 $str=str_replace("CSS","'",$str);

 return $str;
}
本博客所有文章如无特别注明均为原创。作者:fly复制或转载请以超链接形式注明转自 PHPWinner
原文地址《PHP 简单的防注入

相关推荐

PHPWinner -洛阳市网站制作,偃师市网站制作

联系我