欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php防止sql注入代碼實例

 更新時間:2013年12月18日 17:02:37   作者:  
本文介紹了php防止sql注入的代碼實例,大家參考使用吧

放到公用調(diào)用文件(如conn數(shù)據(jù)庫鏈接文件),對所有GET或POST的數(shù)據(jù)進行過濾特殊字符串,以實現(xiàn)簡單有效的SQL注入過濾

復(fù)制代碼 代碼如下:

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");
}

相關(guān)文章

最新評論