防SQL注入漏动

[ 2006-04-21 13:20:23 | 作者: kite ]
字体大小: | |
将下面代码做成一个ASP文件,如SQL.asp
在你检查通过的面页加上<!--#include file="SQL.asp"-->就可以了

<%
'--------定义部份------------------
Dim Fy_Post,Fy_Get,Fy_In,Fy_Inf,Fy_Xh,Fy_db,Fy_dbstr
'自定义需要过滤的字串,用 "枫" 分隔
Fy_In = "\'枫;枫and枫exec枫insert枫select枫delete枫update枫count枫*枫%枫chr枫mid枫master枫truncate枫char枫declare枫or枫'枫\"
'----------------------------------
%>

<%
Fy_Inf = split(Fy_In,"枫")
'--------POST部份------------------
If Request.Form<>"" Then
For Each Fy_Post In Request.Form

For Fy_Xh=0 To Ubound(Fy_Inf)
If Instr(LCase(Request.Form(Fy_Post)),Fy_Inf(Fy_Xh))<>0 Then
Response.write"请不要输入非法的字符"
Response.End
End If
Next

Next
End If
'----------------------------------

'--------GET部份-------------------
If Request.QueryString<>"" Then
For Each Fy_Get In Request.QueryString

For Fy_Xh=0 To Ubound(Fy_Inf)
If Instr(LCase(Request.QueryString(Fy_Get)),Fy_Inf(Fy_Xh))<>0 Then
Response.write"请不要输入非法的字符"
Response.End
End If
Next
Next
End If
%>
永久地址 永久地址: http://www.jmkite.com/kite/technology/feed.asp?q=comment&id=2

此文还没有评论.

您无法为这篇日志发表评论.