放到公用調用文件(如conn數據庫鏈接文件),對所有GET或POST的數據進行過濾特殊字符串,以實現簡單有效的SQL注入過濾
復制代碼 代碼如下:
Function inject_check($sql_str) {
 return eregi('select|insert|and|or|update|delete|/'|///*|/*|/././/|/.//|union|into|load_file|outfile', $sql_str);
}
if (inject_check($_SERVER['QUERY_STRING'])==1 or inject_check(file_get_contents("php://input"))==1){
 //echo "警告 非法訪問!";
 header("Location: Error.php");
}
| 
 
 | 
新聞熱點
疑難解答