先写个conn_security.asp页面,代码如下:

<%

dim sql_injdata

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>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>history.back(-1)</Script>"
Response.end
end if
next
next
end if


%>

你只需要在conn.asp之类的打开数据库文件之前引用这个页面即可。放心的继续开发你的程序,不用再考虑是否还会受到SQL注入攻击。 

<!--#include file="conn_security.asp"-->

 

 

作者:沐雪
文章均系作者原创或翻译,如有错误不妥之处,欢迎各位批评指正。