PHP 传参过滤
时间:2011-05-24 来源:PHP工程师
<?php
class class_replace{
function htmldecode($str){
if(empty($str)) return;if($str=="") return $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(34),"",$str);
$str=str_replace("\"","",$str);
$str=str_replace(chr(39),"",$str);
$str=str_replace("","",$str);
$str=str_replace("'","",$str);
$str=str_replace("select","",$str);
$str=str_replace("join","",$str);
$str=str_replace("union","",$str);
$str=str_replace("where","",$str);
$str=str_replace("insert","",$str);
$str=str_replace("delete","",$str);
$str=str_replace("update","",$str);
$str=str_replace("like","",$str);
$str=str_replace("drop","",$str);
$str=str_replace("create","",$str);
$str=str_replace("modify","",$str);
$str=str_replace("rename","",$str);
$str=str_replace("alter","",$str);
$str=str_replace("cas","",$str);
$str=str_replace("replace","",$str);
$str=str_replace("%","",$str);
$str=str_replace("or","",$str);
$str=str_replace("and","",$str);
$str=str_replace("!","",$str);
$str=str_replace("xor","",$str);
$str=str_replace("not","",$str);
$str=str_replace("user","",$str);
$str=str_replace("||","",$str);
$str=str_replace("<","",$str);
$str=str_replace(">","",$str);
return $str;
}
}
//使用方法:$guolv=new class_replace();
//实例化
//$username=$guolv->htmldecode($_POST["username"]);
//使用例子?>