程序代码:
<%
Function CheckSql() '防止SQL注入
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('请不要在参数中包含非法字符!');}</Script>"
Response.Write "本站有服务不到位的地方,请多提建议!如果你糊来小心我掐死你↓<br><br>"
Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")&"<br><br>"
Response.Write "操作时间:"&Now&"<br><br>"
Response.Write "操作页面:"&Request.ServerVariables("URL")&"<br><br>"
Response.Write "提交方式:Get<br><br>"
Response.Write "提交参数:"&SQL_Get&"<br><br>"
Response.Write "提交数据:"&Request.QueryString(SQL_Get)
response.Write "<meta http-equiv='refresh' content='3;url=/'>"
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('请不要在参数中包含非法字符!');</Script>"
Response.Write "本站有服务不到位的地方,请多提建议!如果你糊来小心我掐死你↓<br><br>"
Response.Write "操作IP:"&Request.ServerVariables("REMOTE_ADDR")&"<br><br>"
Response.Write "操作时间:"&Now&"<br><br>"
Response.Write "操作页面:"&Request.ServerVariables("URL")&"<br><br>"
Response.Write "提交方式:Post<br><br>"
Response.Write "提交参数:"&SQL_Get&"<br><br>"
Response.Write "提交数据:"&Request.Form(SQL_post)
Response.end
end if
next
next
end if
End Function