<%
'inc_antiSpam
'4.0改用UBB，仅支持部分标签，所以不对连接进行处理
'仅检查回复频度
Function  antiSpam(sMode)
	'内容过滤字前面已经处理过，此处进行重复性处理
	Dim rst,rstCache,iCheck,sIP,sIP1
	Set rst=Server.CreateObject("Adodb.Recordset")
	iCheck=0
	sIP=oblog.userip
	'检测IP
	sIP1=Replace(sIP,".","") 
	If Not IsNumeric(sIP1) Then	sIP=""
	If sIP="" Then
		antiSpam="您的IP来源被系统置疑，系统不接收您的数据!"
		Exit Function
	End If

	If sMode="1" Then
		If is_sqldata=1 Then
			Set rst=oblog.Execute("Select count(commentid) From Oblog_Comment Where addip='" & sIP & "' And datediff(n,addtime,getdate())<=" & C_Spam_ChkMinutes)
			If rst(0)>C_Spam_OneIp Then
				iCheck=1
			Else				
				rst.Close
				Set rst=oblog.Execute("Select count(commentid) From Oblog_Comment Where datediff(n,addtime,getdate())<=" & C_Spam_ChkMinutes)
				If rst(0)>C_Spam_AllIp Then iCheck=2
			End If
		Else
			Set rst=oblog.Execute("Select count(commentid) From Oblog_Comment Where addip='" & sIP & "' And datediff('n',addtime,now())<=" & C_Spam_ChkMinutes)
			If rst(0)>C_Spam_OneIp Then
				iCheck=1
			Else				
				rst.Close
				Set rst=oblog.Execute("Select count(commentid) From Oblog_Comment Where  datediff('n',addtime,now())<=" & C_Spam_ChkMinutes)
				If rst(0)>C_Spam_AllIp Then iCheck=2
			End If
		End If
	Else
		If is_sqldata=1 Then
			Set rst=oblog.Execute("Select count(messageid) From Oblog_Message Where addip='" & sIP & "' And datediff(n,addtime,getdate())<=" & C_Spam_ChkMinutes)
			If rst(0)>C_Spam_OneIp Then
				iCheck=1
			Else				
				rst.Close
				Set rst=oblog.Execute("Select count(messageid) From Oblog_Message Where datediff(n,addtime,getdate())<=" & C_Spam_ChkMinutes)
				If rst(0)>C_Spam_AllIp Then iCheck=2
			End If
		Else
			Set rst=oblog.Execute("Select count(messageid) From Oblog_Message Where addip='" & sIP & "' And datediff('n',addtime,now())<=" & C_Spam_ChkMinutes)
			If rst(0)>C_Spam_OneIp Then
				iCheck=1
			Else				
				rst.Close
				Set rst=oblog.Execute("Select count(messageid) From Oblog_Message Where datediff('n',addtime,now())<=" & C_Spam_ChkMinutes)
				If rst(0)>C_Spam_AllIp Then iCheck=2
			End If
		End If
	End If
	rst.Close
	Set rst=Nothing
	Select Case iCheck
		Case 0
			antiSpam=""			
		Case 1
			'加入黑名单
			Set rstCache = Server.CreateObject("Adodb.RecordSet")       	        
		    rstCache.Open "Select * From  oblog_config Where id=5",conn,1,3
			rstCache("ob_value")=rstCache("ob_value")& vbCrLf & sIP
			rstCache.Update
			rstCache.Close
			Set rstCache=Nothing
			oblog.reloadsetup
			antiSpam="因为您的一些操作对系统进行了干扰，你的IP被加入黑名单"
		Case 2
			antiSpam="系统暂时不允许进行回复或留言操作!"
	End Select
End Function

'检查特殊标签
Function ChkCommentTag(sContent)
	Dim sBadtags,aTags,i
	sBadtags="[/url],[url, href"
	aTags=Split(sBadtags,",")
	ChkCommentTag=false
	sContent=LCase(sContent)
	For i=0 To Ubound(aTags)
		If InStr(sContent,aTags(i))>0 Then
			ChkCommentTag=True
			Exit Function
		End If
	Next
End Function
%>