批量過濾post
$_GET = stripslashes_array($_GET);
$_POST = stripslashes_array($_POST);
數據過濾函數
function stripslashes_array(&$array) {
while(list($key
if ($key !=
if (is_string($var)) {
$array[$key] = stripslashes($var);
}
if (is_array($var)) {
$array[$key] = stripslashes_array($var);
}
}
}
return $array;
}
替換HTML尾標簽
function lib_replace_end_tag($str)
{
if (empty($str)) return false;
$str = htmlspecialchars($str);
$str = str_replace(
$str = str_replace(""
$str = str_replace(">"
$str = str_replace("<"
$str = str_replace("<SCRIPT>"
$str = str_replace("</SCRIPT>"
$str = str_replace("<script>"
$str = str_replace("</script>"
$str=str_replace("select"
$str=str_replace("join"
$str=str_replace("union"
$str=str_replace("where"
$str=str_replace("insert"
$str=str_replace("delete"
$str=str_replace("update"
$str=str_replace("like"
$str=str_replace("drop"
$str=str_replace("create"
$str=str_replace("modify"
$str=str_replace("rename"
$str=str_replace("alter"
$str=str_replace("cas"
$str=str_replace("&"
$str=str_replace(">"
$str=str_replace("<"
$str=str_replace(" "
$str=str_replace(" "
$str=str_replace(" "
$str=str_replace("&"
$str=str_replace("
$str=str_replace("<br />"
$str=str_replace("
$str=str_replace("css"
$str=str_replace("CSS"
return $str;
}
From:http://tw.wingwit.com/Article/program/PHP/201311/21285.html