PHPでのSQLインジェクション対策

シンプル関数で判断:
Function inject_check($sql_str) {
return preg_match('/select|insert|and|or|update|delete|\’|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile/i’, $sql_str);
}
if (inject_check($_SERVER['QUERY_STRING’])==1 or inject_check(file_get_contents(“php://input"))==1){
//echo “警告 不正なアクセス!";
header(“Location: Error.php");
exit;
}

Software

Posted by arkgame