有没有防sql注入的代码啊
有没有防sql注入的代码啊,我的站是asp的, 请教啊
[解决办法]
曾经用过动网论坛上的代码,里面有相关的防注入函数.
[解决办法]
用 ADO对象来操作数据库的话不需要防SQL注入过滤,用参数化查询取代SQL拼接就可以了。
------
非要拼接字符串的话 :
Access 的话可以 把字符字段的输入 Replace("xx","'", "''")
SQL Server 尽量用存储过程。拼接注入的方法太多了,必须用正则检查字段的类型大小和特征。
[解决办法]
没这么复杂,就是判断的时候别直接拼接字符串,用parameter穿参数的形式就行了。。。、、、咯。。。
[解决办法]
加强类型检测和控制。
[解决办法]
写一些对传参的ID的类型判断函数
Function replacestr(str) replacestr=replace(str,"'","") replacestr=replace(replacestr,"]","") replacestr=replace(replacestr,"[","") replacestr=replace(replacestr,";","") replacestr=replace(replacestr,":","") replacestr=replace(replacestr,"or","") replacestr=replace(replacestr,"and","") replacestr=replace(replacestr,"","")End Function '*************************************************************'判断是否为数字'*************************************************************Function ChkNum(Str) ChkNum=true if not IsNumeric(Str) then ChkNum=false end ifEnd Function