有关ASP的一段报错问题!
从网上找的一段防SQL注入的脚本.
Microsoft VBScript 编译器错误 (0x800A0408)
无效字符
/qfly/shop/guest/sql.asp, line 10
response.write("<script language='javascript'>alert('对不起,请勿恶意注入!');Javascript:window.history.go(-1);</script>")
程序
<%@LANGUAGE="VBSCRIPT"%>
<%
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 language=javascript>alert('对不起,请勿注入!');Javascript:window.history.go(-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('1111');history.back(-1)</Script>"
Response.end
end if
next
next
end if
%>
[解决办法]
response前面有全角空格,要用半角空格。
代码其他地方也有,要一起替换掉。