<!--#include file="inc/inc_syssite.asp"-->
<!--#include file="Inc/Class_TrackBack.asp" -->
<%
'*********************************************************
'File: 			tb.asp
'Description:	Receive Ping For oBlog4.0
'Author: 		阿泰
'LastUpdate:	20060708
'
'Copyright:		http://www.oblog.cn
'*********************************************************
'ON Error Resume Next
If Application(cache_name_user&"_systemenmod")<>"" Then
	Dim enStr
	enStr=Application(cache_name_user&"_systemenmod")
	enStr=Split(enStr,",")
	If enStr(3)="1" Then	response.write("系统临时禁止使用引用通告功能!"):Response.End
End if

Dim objTrackback
Dim LogId,IP,url,title,BlogName,Excerpt,rst,rstCache
'恶意内容的操作不返回XML返回值
'IP检测
if oblog.chkiplock() then response.write("你的ip已经被系统锁定!"):response.End()
oblog.chk_commenttime
'http://atai:4000/oblog4/tb.asp?id=125&url=http://www.sina.com&blog_name=atai&title=好文章&excerpt=不错啊
LogId=Request("id")
IP=GetIP
Url=Trim(Request("url"))
title=Trim(Request("title"))
BlogName=Trim(Request("blog_name"))
Excerpt=Trim(Request("excerpt"))
If url=blogdir&"tb.asp" Then
'如果url为空则停止相应
	Response.Write "错误的地址"
	Response.End
End if


'内容检测
if oblog.chk_badword(url)>0 then oblog.adderrstr("地址中含有系统不允许的字符！")
if oblog.chk_badword(title)>0 then oblog.adderrstr("标题中含有系统不允许的字符！")
if oblog.chk_badword(BlogName)>0 then oblog.adderrstr("BLOG名称中含有系统不允许的字符！")
if oblog.chk_badword(Excerpt)>0 then oblog.adderrstr("摘要中含有系统不允许的字符！")
'专属关键字判定
if oblog.errstr<>"" then Response.Write oblog.errstr:response.End()
Call Link_Database
'频度检测,如果同一IP在单位时间内发布的通告申请达到一定限额，则自动封IP
Set rst=oblog.Execute("Select count(id) From Oblog_trackback Where ip='" & IP & "' And datediff("&G_Sql_mi&",addtime,"&G_Sql_Now&")<=30")
If rst(0)> 60 And oblog.ChkWhiteIP() = False Then
	'加入黑名单
	oblog.KillIp(IP)
	oblog.ShowMsg "因为您的一些操作对系统进行了干扰，你的IP被加入黑名单",""
	Response.End
End If
rst.Close
Set rst=Nothing
'检验引用通告授权码是否过期
Dim TBcode,nTime,TBcode0
Dim rs
TBcode0 = LCase(Trim(Request("TBcode")))
nTime = 30
Set rs = oblog.Execute ("SELECT TBcode FROM oblog_log WHERE logid = "&logid)
If Not rs.EOF Then
	TBcode = LCase(rs(0))
Else
	Response.Write "日志不存在"
	Response.End
End if
'TBcode = Application(oblog.Cache_Name & "_TBcode"&logid)
If TBcode = "" Or IsNull(TBcode) Then
	Response.Write "引用通告授权码已经过期"
	Response.End
End if
Response.Write (Int(DateDiff("n", DeDateCode(Left(TBcode, 12)), Now)) > nTime) & " : "  & TBcode0 & " : " & TBcode
If Int(DateDiff("n", DeDateCode(Left(TBcode, 12)), Now)) > nTime Then
'	Application(oblog.Cache_Name & "_TBcode"&logid) = GetDateCode(2) & RndPassword(12)
	TBcode = GetDateCode(Now(),2) & RndPassword(12)
	oblog.Execute ("UPDATE oblog_log SET TBcode = '" &TBcode& "' WHERE logid = "&logid)
End If
If TBcode0 <> TBcode Then
	Response.Write "引用通告授权码已经过期"
	Response.End
End if

'进行接收环节的处理
Set objTrackback = New Class_TrackBack
objTrackback.LOGID=LogId
objTrackback.IP=IP
objTrackback.URL=Url
'objTrackback.TBUSER=Trim(Request.QueryString("tbuser"))
objTrackback.TITLE=title
objTrackback.BLOG_NAME=BlogName
objTrackback.EXCERPT=Excerpt
Session("chk_commenttime")=Now()
Call objTrackback.Receive()
Set objTrackback=Nothing
conn.Close
Set conn=Nothing
%>