")
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=****>alert('SQL通用防注入系统提示↓nn请不要在参数中包含非法字符尝试注入!');history.back(-1)</Script>"
Response.end
end if
next
Next
End If
这样我们就实现了get请求的注入的拦截,但是我们还要过滤post请求,所以我们还得继续考虑request.form,这个也是以数组形式存在的,我们只需要再进一次循环判断即可。代码如下:
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=****>alert('SQL通用防注入系统提示↓nn请不要在参数中包含非法字符尝试注入!nnHTTP://www.521movie.com ');history.back(-1)</Script>"
Response.end
end if
next
next
end if
好了大功告成,我们已经实现了get和post请求的信息拦截,你只需要在conn.asp之类的打开数据库文件之前引用这个页面即可。放心的继续开发你的程序,不用再考虑是否还会受到SQL注入攻击。难道不是么?
关键词:编写通用的ASP防SQL注入攻击程序