怎样防止SQL注入漏洞,我用明小子3.5检测一下我的网站! 就有注入漏洞,能把数据库里的敏感数据全猜解出来, 我问下,怎样做,能屏蔽这一点,让其更加安全??
简单一点:
对于int型的参数,如文章的id等,可以先判断是不是整数。
id =trim(request("id"))
if id<>"" then
if Not isNumeric(id) then
response.write"请提供数字型参数"
response.end
end if
id = clng(id)
else
response.write"请输入参数id"
response.end
end if
这样的话,明小子3.5就无法注入了。
对于int型的参数,如文章的id等,可以先判断是不是整数。
id =trim(request("id"))
if id<>"" then
if Not isNumeric(id) then
response.write"请提供数字型参数"
response.end
end if
id = clng(id)
else
response.write"请输入参数id"
response.end
end if
这样的话,明小子3.5就无法注入了。
温馨提示:答案为网友推荐,仅供参考
第1个回答 2007-10-08
不一定,我觉得要控制 "'"号输入就行了,再控制一些 SQL 关键字的这样更安全
比如
id=trim(request("id"))
if instr(id,"'")>0 or instr(id,"insert")>0 then
response.write "对不起,请不要注入本站"
response.end
end if
比如
id=trim(request("id"))
if instr(id,"'")>0 or instr(id,"insert")>0 then
response.write "对不起,请不要注入本站"
response.end
end if