过滤特殊字符

/**

* 过滤特殊字符

* @param string $f_str 要过滤的信息

* @return string 返回过滤后的结果

*/

function str_rp($f_str)

{

$f_str = preg_replace("/and/i","and",$f_str);

$f_str = preg_replace("/execute/i","execute",$f_str);

$f_str = preg_replace("/update/i","update",$f_str);

$f_str = preg_replace("/count/i","count",$f_str);

$f_str = preg_replace("/chr/i","chr",$f_str);

$f_str = preg_replace("/mid/i","mid",$f_str);

$f_str = preg_replace("/master/i","master",$f_str);

$f_str = preg_replace("/truncate/i","truncate",$f_str);

$f_str = preg_replace("/char/i","char",$f_str);

$f_str = preg_replace("/declare/i","declare",$f_str);

$f_str = preg_replace("/select/i","select",$f_str);

$f_str = preg_replace("/create/i","create",$f_str);

$f_str = preg_replace("/delete/i","delete",$f_str);

$f_str = preg_replace("/insert/i","insert",$f_str);

$f_str = stripcslashes($f_str); //防止单引号双号引被转义

$f_str = str_replace('<','<',$f_str);

$f_str = str_replace(">",'>',$f_str);

$f_str = str_replace('\'',''',$f_str);

$f_str = str_replace('"','"',$f_str);

$f_str = str_replace(' ',' ',$f_str);

return $f_str;

}

你可能感兴趣的:(过滤特殊字符)