标签:
如果你的sql语句为 "delete from stu where id=".$id;
其中$id为客户端传过来的数据,通过$_POST[‘id‘]接收的。
此时如果客户端传过来的数据为 localhot:80/index.php?id=8 or 1 此时恒成立。将会把数据库中的数据全部删掉。
此处接收的id应该为整型,我们可以通过$_POST[‘id‘]+0 将接收到的数据转换为整型,这样就可以防止注入。
标签:
原文地址:http://www.cnblogs.com/shenming/p/4235093.html