English
 电子信箱
 加入收藏

  威盾防火墙 >> 新闻中心 >> 业界动态 >> 好用的asp防SQL注入代码

 

好用的asp防SQL注入代码

威盾防火墙 2015-01-06

 

在连接数据库的下方加入代码就可以防止sql注入了:

<%

dim sql_injdata,SQL_inj,SQL_Get,SQL_Data,Sql_Post

SQL_injdata = "'|and|exec|insert|select|delete|update|count|*|%|chr|mid|master|truncate|char|declare"
SQL_inj = split(SQL_Injdata,"|")
If Request.QueryString<>"" Then
For Each SQL_Get In Request.QueryString
For SQL_Data=0 To Ubound(SQL_inj)
if instr(Request.QueryString(SQL_Get),Sql_Inj(Sql_DATA))>0 Then
Response.Write "<Script Language=javascript>alert('注意:请不要提交非法请!');history.back(-1)</Script>"
Response.end
end if
next
Next
End If
If Request.Form<>"" Then
For Each Sql_Post In Request.Form
For SQL_Data=0 To Ubound(SQL_inj)
if instr(Request.Form(Sql_Post),Sql_Inj(Sql_DATA))>0 Then
Response.Write "<Script Language=javascript>alert('注意:请不要提交非法请!');history.back(-1)</Script>"
Response.end
end if
next
next
end if

%>


相关内容: 最新内容:
c#.net全站防止SQL注入类的代码[2015-01-06]
asp.net 防止SQL注入攻击[2015-01-06]
防止SQL注入[2015-01-06]
解析阻止或减轻SQL注入攻击实用招数[2015-01-05]
网站SQL注入防御实战演示经典版![2015-01-05]
“SQL注入”的前世今生和防御思路[2015-01-05]
c#.net全站防止SQL注入类的代码[2015-01-06]
asp.net 防止SQL注入攻击[2015-01-06]
防止SQL注入[2015-01-06]
Apache 防盗链(Apache Anti-Leech)技术的简单实现[2015-01-06]
如何打造一款可靠的WAF(Web应用防火墙)[2015-01-06]
php xss过滤[2015-01-06]