Batch filter posts, get sensitive data
Copy code The code is as follows:
$_GET = stripslashes_array( $_GET);
$_POST = stripslashes_array($_POST);
Data filter function
Copy code The code is as follows:
function stripslashes_array(&$array) {
while(list($key,$var) = each($array)) {
if ( $key != 'argc' && $key != 'argv' && (strtoupper($key) != $key || ''.intval($key) == "$key")) {
if ( is_string($var)) {
$array[$key] = stripslashes($var);
}
if (is_array($var)) {
$array[$key] = stripslashes_array ($var);
}
}
}
return $array;
}
Replace HTML tail tag to serve filtering
Copy code The code is as follows:
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(">", "", $str);
$str = str_replace("<", "", $str);
$str = str_replace("<SCRIPT>", "", $str);<br> $str = str_replace("</SCRIPT>", "", $str);
$str = str_replace( "<script>", "", $str);<br> $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("
", chr(13),$str);
$str=str_replace("''","'",$str);
$str=str_replace("css","'",$str);
$str=str_replace("CSS","'",$str);
return $str;
}
http://www.bkjia.com/PHPjc/328027.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/328027.htmlTechArticleBatch filter posts, get sensitive data copy code code is as follows: $_GET = stripslashes_array($_GET); $_POST = stripslashes_array($_POST); The data filtering function copy code is as follows: fu...