我试图找出如何防止SQL注入攻击,我写了这个基本功能:功能防止SQL注入PHP中的MDB2
antiInjectie($inputfromform){
$temp = str_replace("'", "`",$inputfromform);
$temp = str_replace("--", "~~",$temp);
return htmlentitites($temp);
}
但是有人告诉我还需要考虑的十六进制值,但如何我要这样做吗?
更新 我坚持用MDB2和pgsql的
http://stackoverflow.com/questions/60174/best-way-to-stop-sql-injection-in-php – Jacob
不幸的是我坚持MDB2 :( –
如果你不打算使用PDO ,看看你正在使用的连接类型的数据库功能,它们通常具有已经包装好的逃生功能 – afuzzyllama