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

php防止sql注入代碼實(shí)例

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

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

復(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 "警告 非法訪(fǎng)問(wèn)!";
 header("Location: Error.php");
}

相關(guān)文章

最新評(píng)論