注册提交时因为SQL防注入过滤导致无法注册,怎么处理?
大家好,我是个新手,近日在调试一个程序时,注册时频繁出现提示操作不成功的警告,检查了一下,发现是在conn.asp的SQL防注入部分出现的问题,但不知怎么解决,想请教下啊!!!!附注册截图:
以下是conn.asp文件代码:
<%@ LANGUAGE = VBScript.Encode %>
<%
'检测是否有效的数字-----------------
Function IsInteger(Para)
IsInteger=False
If Not (IsNull(Para) Or Trim(Para)="" Or Not IsNumeric(Para)) Then
IsInteger=True
End If
End Function
'检查无效字符----------------------
Function CheckStr(byVal ChkStr)
Dim Str:Str=ChkStr
Str=Trim(Str)
If IsNull(Str) Then
CheckStr = ""
Exit Function
End If
Dim re
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="(\r\n){3,}"
Str=re.Replace(Str,"$1$1$1")
Set re=Nothing
Str = Replace(Str,"'","''")
Str = Replace(Str, "!!!", "!")
Str = Replace(Str, "★★★", "★")
CheckStr=Str
End Function
'转换HTML代码-----------------------
Function HTMLDecode(reString)
Dim Str:Str=reString
If Not IsNull(Str) Then
Str = Replace(Str, "&", "&")
Str = Replace(Str, ">", ">")
Str = Replace(Str, "<", "<")
Str = Replace(Str, " ", CHR(32))
Str = Replace(Str, " ", CHR(9))
Str = Replace(Str, " ", CHR(9))
Str = Replace(Str, """, CHR(34))
Str = Replace(Str, "'", CHR(39))
Str = Replace(Str, "", CHR(13))
Str = Replace(Str, "<br>", CHR(10))
HTMLDecode = Str
End If
End Function
'--------SQL防注入定义部份------------------
Dim Fy_Post,Fy_Get,Fy_In,Fy_Inf,Fy_Xh
Fy_In = "or|三维画|钢|板|天津|管|枪|★|◣|◢|法轮功|法轮功|贷款|迷药|迷昏药|窃听器|六合彩|买卖枪支|三唑仑|麻醉药|麻醉乙醚|短信群发器|催情药|春药|窃听器|出售手枪|办理证件|办证|办理文凭|骗子|join|union|like|modify|cast|drop|exec|insert|select|delete|update|count|alter|rename|chr|mid|truncate|char|declare|'"
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 "<Script Language=JavaScript>alert('林城分类信息网提示您↓\n\n您的本此操作含有不被允许的字符失败了!');history.back();</Script>"
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 "<Script Language=JavaScript>alert('林城分类信息网提示您↓\n\n您的本此操作失败了!');history.back();</Script>"
Response.End
End If
Next
Next
End If
'----------------------------------
'数据库连接文件
dim conn,connstr,db,startime
startime=timer()
'db="
db="alldata/#ak9826.mdb"
Set conn = Server.CreateObject("ADODB.Connection")
connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath(db)
'connstr="driver={Microsoft Access Driver (*.mdb)};dbq=" & Server.MapPath(db)
conn.Open connstr
sub closedb()
conn.close
set rs=nothing
set conn=nothing
end sub
If Err Then
err.Clear
Set Conn = Nothing
Response.Write "<script Language=javascript>location.href = '我休息会,马上就好,请稍后访问!';</script>"
Response.End
End If
%>