一些黑客可以访问我的数据库,我会找到错误;我无权访问服务器日志。我制作了这段代码以将可疑查询保存在文本文件中:
function query($query) {
$file = 'sqllog.txt';
if(/* Which condition should i use to detect? */){
$contents = file_get_contents($file);
$contents.="\r\n";
$contents.=$query;
file_put_contents($file,$contents);
}
$this->theQuery = $query;
return mysql_query($query, $this->link);
}
我应该使用哪种条件来检测 sql 注入可疑查询?