<!--#include file="mdb.asp" -->
<!--#include file="inc/config.asp"-->
<!--#include file="inc/format.asp"-->
<!--#include file="inc/inc.asp"-->
<!--#include file="inc/function_blog.asp" -->
<%
IF IsInteger(Request.QueryString("id")) And Request.QueryString("action")<>"deltb" Then
	Dim tbID,tbTitle,tbURL,tbExcerpt,tbBlog,tbCP
	tbID = clng(trim(Request.QueryString("id")))
	tbCP="GB2312"
	If Trim(Request.QueryString("CP"))="GBK" Then tbCP="GB2312"
	If Trim(Request.QueryString("TM"))="RSS" Then
		Set tbBlog=Conn.Execute("SELECT tb_Title,tb_URL,tb_Intro FROM b_Trackback WHERE blog_ID="&tbID)
		If Not (tbBlog.BOF and tbBlog.EOF) Then
			Response.contentType="text/xml"
			%>
			<?xml version="1.0" encoding="<%=tbCP%>"?>
			<response>
			<error>0</error>
			<rss version="0.91"><channel>
			<title><%=SiteName%></title>
			<link><%=SiteURL%></link>
			<description><%=SiteName%></description>
			<language>zh-cn</language>
			<item>
			<% do while not tbBlog.eof %>
			<title><%=tbBlog(0)%></title>
			<link><%=tbBlog(1)%></link>
			<description><%=tbBlog(2)%></description>
			<% tbBlog.MoveNext
			Loop
		Else
			Call tbResponseXML(1,"无效参数，日志不存在！",tbCP)
		End If
		Set tbBlog=Nothing
		%>
		</item>
		</channel>
		</rss></response>
	<%Else
		If Request.QueryString("url")<>Empty Then
			tbURL = CheckStr(Request.QueryString("url"))
			tbTitle = CheckStr(Request.QueryString("title"))
			tbExcerpt = HTMLEncode(CheckStr(Request.QueryString("excerpt")))
			tbBlog = CheckStr(Request.QueryString("blog_name"))
		ElseIf Request.Form("url")<>Empty Then
			tbURL = CheckStr(Request.Form("url"))
			tbTitle = CheckStr(Request.Form("title"))
			tbExcerpt = CheckStr(Request.Form("excerpt"))
			tbBlog = CheckStr(Request.Form("blog_name"))
		Else
			Call tbResponseXML(1,"无效参数，URL地址不存在！",tbCP)
		End If
		tbURL=CutStr(tbURL,100)
		if tbTitle="" Then
			tbTitle=tbURL
		Else
			tbTitle=CutStr(tbTitle,100)
		End If
		tbExcerpt=CutStr(tbExcerpt,252)
		If tbExcerpt="" Then Call tbResponseXML(1,"无效内容，出现非法字符！",tbCP)
		tbBlog=CutStr(tbBlog,100)
		tbURL=HTMLEncode(tbURL)
		tbTitle=HTMLEncode(tbTitle)
		tbExcerpt=HTMLEncode(tbExcerpt)
		tbBlog=HTMLEncode(tbBlog)

                If Conn.Execute("SELECT count(blog_ID) FROM b_Content WHERE blog_IsShow=True And blog_DisComment=False AND blog_ID="&tbID)(0)>0 AND Conn.Execute("SELECT count(tb_ID) FROM b_Trackback WHERE blog_ID="&tbID&" AND tb_URL='"&tbURL&"' AND tb_Title='"&tbTitle&"' AND tb_Intro='"&tbExcerpt&"' AND tb_Site='"&tbBlog&"'")(0)<1 Then
			Conn.Execute("INSERT INTO b_TrackBack (blog_ID, tb_URL, tb_Title, tb_Intro, tb_Site, tb_PostTime) VALUES ("&tbID&",'"&tbURL&"','"&tbTitle&"','"&tbExcerpt&"','"&tbBlog&"',Now())")
			Conn.Execute("UPDATE b_Content SET blog_QuoteNums=blog_QuoteNums+1 WHERE blog_ID="&tbID)
		Else
			Call tbResponseXML(1,"此日志是隐藏日志不允许引用，或者此引用通告已发送！",tbCP)
		End If
	End If
Else
start="兜客日志 - 引用通告"
call head()
call menu()
%>

<!--导航栏-->
<TABLE cellSpacing=0 cellPadding=0 width=958 border=0 align="center">
    <TR>
      <TD width=4></TD>
      <TD width=950 class="a3" height=24></TD>
      <TD width=4></TD>
    </TR>
    <TR>
      <TD width=4></TD>
      <TD width=950 class="a4" height=9></TD>
      <TD width=4></TD>
    </TR>
</TABLE>
<!--导航栏-->

<!--广告位A-->
<TABLE width=958 border=0 align="center" cellPadding=0 cellSpacing=0>
    <TR>
      <TD width=4></TD>
      <TD align=middle width=950 bgColor=#ffffff height=24><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
          <TR>
            <TD width="100%" bgColor=#da251d height=2></TD>
          </TR>
          <TR>
            <TD width="100%"><%Call hx66_AD(1)%></TD>
          </TR>
          <TR>
            <TD width="100%" bgColor=#da251d height=2></TD>
          </TR>
      </TABLE></TD>
      <TD width=4></TD>
    </TR>
</TABLE>
<!--广告位A-->

<!--倒计时-->
<TABLE cellSpacing=0 cellPadding=0 width=958 border=0 align="center">
    <TR>
      <TD width=4></TD>
      <TD align=middle width=950 bgColor=#ffffff height=24><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
          <TR>
            <TD width="100%" class="a5" height=9></TD>
          </TR>
          <TR>
            <TD align=middle width="100%" class="a6" height=31>
<table width="100%" border=0 cellpadding=0 cellspacing=0>
 <TR>
   <TD width="65" align="center"><img src="skin/1/login_title.gif" width="37" height="31"><TD>您的位置：<A href="index.asp"><%=webname%></A> >> <a href='blog.asp'>兜客日志</a><td height="25" align="right"><%call djs()%>&nbsp;&nbsp;&nbsp;&nbsp;</td>
</TD>
 </TR>
</TABLE>
            </TD>
          </TR>
      </TABLE></TD>
      <TD width=4></TD>
    </TR>
</TABLE>
<!--倒计时-->

<TABLE width=958 border=0 align="center" cellPadding=0 cellSpacing=0>
    <TR>
      <TD width=4></TD>
      <TD align=middle width=950 bgColor=#ffffff height=24><TABLE cellSpacing=0 cellPadding=0 width=950 border=0>
          <TR>
            <TD align=middle vAlign=top width=198><TABLE height=51 cellSpacing=0 cellPadding=0 
width="100%" border=0>
                <TR>
                  <TD align=middle width=30 class="a1" height=34><IMG height=20 src="skin/1/gu1.gif" width=24 border=0></TD>
                    <TD class="a1" height=34 width=170><a href="#" class="STYLE1">会员登录</a></TD>
                </TR>
                <TR>
                  <TD width="100%" colSpan=2 height=1></TD>
                </TR>
                <TR>
                  <TD width="100%" colSpan=2 height=150><%call userlogin()%></TD>
                </TR>
                <TR>
                  <TD width="100%" colSpan=2 height=1></TD>
                </TR>
            </TABLE></TD>
            <TD vAlign=top align=middle width=1 bgColor=#cecccc></TD>
            <TD vAlign=top align=middle><TABLE height=51 cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TR>
                <TD align=middle width=30 class="a1" height=34><IMG height=20 src="skin/1/gu1.gif" width=24 border=0></TD>
                <TD class="a1" height=34 width=720><a href="#" class="STYLE1">引用通告</a></TD></TR>
              <TR>
                <TD width="100%" colSpan=2 align="center"><%If Request.QueryString("action")="deltb" Then
      If Not (IsInteger(Request.QueryString("tbID")) AND IsInteger(Request.QueryString("blogID"))) Then
	   Response.write("无效参数， <a href='javascript:history.go(-1);'>请点击返回</a>")
      Else
	   Dim dele_tb
	   Set dele_tb=Conn.ExeCute("SELECT T.blog_ID,C.blog_Author FROM b_TrackBack as T,b_Content as C WHERE T.blog_ID=C.blog_ID AND T.tb_ID="&clng(Request.QueryString("tbID")))
	   IF dele_tb.EOF AND dele_tb.BOF Then
		Response.write("引用通告不存在，<a href='javascript:history.go(-1);'>请点击返回</a>")
	   Else
		If (checkmember=true AND dele_tb("blog_Author")=Hx66_Name) OR SupAdmin=true Then
		   Conn.ExeCute("UPDATE b_Content SET blog_QuoteNums=blog_QuoteNums-1 WHERE blog_ID="&dele_tb("blog_ID"))
		   Conn.Execute("DELETE * FROM b_TrackBack WHERE tb_ID="&clng(Request.QueryString("tbID")))
		   Response.write("引用通告删除成功<br><a href='showblog.asp?blog_id="&clng(Request.QueryString("blogID"))&"'>请点击返回，或者3秒后自动返回</a><meta http-equiv='refresh' content='3;url=showblog.asp?blog_id="&clng(Request.QueryString("blogID"))&"'>")
		Else
		   Response.write("你没有权限删除引用通告，<a href='javascript:history.go(-1);'>请点击返回</a>")
		End If
	   End IF
      End If
Else
      If IsInteger(Request.QueryString("blogID"))=False Then
	   Response.Write("<a href=""blog.asp"">非法参数，请返回BLOG</a>")
      Else
	   Dim blogRS, tbRS
	   Set blogRS=Conn.Execute("SELECT * FROM b_Content WHERE blog_ID="&clng(Request.QueryString("blogID")))
	   If Not (blogRS.bof and blogRS.eof) Then%>
		<table width="100%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#F0F0F0">
		   <tr>
		     <td bgcolor="#F0F0F0"><%Response.Write("<a href='showblog.asp?blog_id="&blogRS("blog_ID")&"'><b>"&blogRS("blog_Title")&"</b></a>&nbsp;&nbsp;&nbsp;[ "&DateToStr(blogRS("blog_PostTime"),"Y-m-d")&" | 作者："&blogRS("blog_Author")&" | 来自：<a href='"&blogRS("blog_FromURL")&"' target='_blank'>"&blogRS("blog_From")&"</a> ]")%></td>
		   </tr>
		   <tr><td bgcolor="#FFFFFF">
			<%If blogRS("blog_IsShow")=False Then
			    Response.Write("<b>此日志为隐藏日志，禁止引用通告</b>")
			 Else%>
                         <b>引用地址：</b><br><img src="img/blog/gb2312_1.gif" border="0" align="absmiddle"> <%=webURL%>/blog_tb.asp?id=<%=blogRS("blog_ID")%><br><br>
			<b>RSS引用地址：</b><br><img src="img/blog/gb2312.gif" border="0" align="absmiddle">  <%=webURL%>/blog_tb.asp?id=<%=blogRS("blog_ID")%>&TM=RSS<br><br>
			   <%Set tbRS=Server.CreateObject("Adodb.Recordset")
			   SQL="SELECT * FROM b_TrackBack WHERE blog_ID="&clng(Request.QueryString("blogID"))&" ORDER BY tb_PostTime DESC"
			   tbRS.Open SQL,CONN,1,1%>
			   <b>该日志引用文章(<%=tbRS.Recordcount%>):</b><hr size="1" noshade color="#CCCCCC">
			   <%Do While Not tbRS.eof
			        Response.write("<a href='"&tbRS("tb_URL")&"' target='_blank'><B>·</B> "&tbRS("tb_Title")&" [ "&tbRS("tb_PostTime")&" | <b>"&tbRS("tb_Site")&"</b> ]</a><br>")
			        tbRS.MoveNext
			        Loop
			        tbRS.Close
			        Set tbRS=nothing
			 End If%><br><br></td>
		     </tr>
                  </table>
	    <%Else
		   Response.Write("无效参数， <br><br><a href=""javascript:history.go(-1);"">请点击返回</a>")
	      End If
	      Set blogRS=nothing
       End If
End If
%></TD>
              </TR>
            </TABLE></TD>
          </TR>
      </TABLE></TD>
      <TD width=4></TD>
    </TR>
</TABLE>
<%
call footer()
End If

Sub tbResponseXML(intFlag, strMessage,codePage)
	Response.contentType="text/xml"
	Response.write "<?xml version=""1.0"" encoding="""&codePage&"""?><response><error>"&intFlag&"</error>"
	If intFlag=1 Then Response.write "<message>"&strMessage&"</message>"
	Response.write "</response>"
	Response.End
End Sub
%>