<%
Dim Hx_Year,Hx_Month,Hx_Day,sBlog_ID,sCat_ID
Hx_Year=CheckStr(Trim(Request.QueryString("Hx_Year")))
Hx_Month=CheckStr(Trim(Request.QueryString("Hx_Month")))
Hx_Day=CheckStr(Trim(Request.QueryString("Hx_Day")))
sCat_ID=CheckStr(Trim(Request.QueryString("cat_id")))
sBlog_ID=CheckStr(Trim(Request.QueryString("blog_id")))
if sBlog_ID<>Empty then
    if not isInteger(sBlog_ID) then
        FoundErr=True
        ErrMsg=ErrMsg & "<br><li>非法的ID参数！</li>"
    else
	sBlog_ID=CLng(sBlog_ID)
    end if
else
	sBlog_ID=0
end if

if sBlog_ID>0 then
dim slog_Title,slog_Content,slog_Author,slog_PostTime,slog_DisSM,slog_DisUBB,slog_DisIMG,slog_AutoURL,slog_AutoKEY,slog_From,slog_FromURL,slog_Modify,slog_IsShow,slog_QuoteNums,slog_DisComment,slog_Weather,mainTitle
   sql="select * from b_Content where blog_ID="&sBlog_ID
   set rs=server.createobject("adodb.recordset")
   rs.open sql,conn,1,3
	if rs.bof and rs.eof then
		FoundErr=True
		ErrMsg=ErrMsg & "<br><li>你要找的日志不存在，或者已经被管理员删除！</li>"
        else	
                slog_Title=rs("blog_Title")
		slog_Content=rs("blog_Content")
		slog_Author=rs("blog_Author")
		slog_PostTime=rs("blog_PostTime")
		slog_DisSM=rs("blog_DisSM")
		slog_DisUBB=rs("blog_DisUBB")
		slog_DisIMG=rs("blog_DisIMG")
		slog_AutoURL=rs("blog_AutoURL")
		slog_AutoKEY=rs("blog_AutoKEY")
		slog_From=rs("blog_From")
		slog_FromURL=rs("blog_FromURL")
		slog_Modify=rs("blog_Modify")
		slog_IsShow=rs("blog_IsShow")
		slog_QuoteNums=rs("blog_QuoteNums")
		slog_DisComment=rs("blog_DisComment")
		slog_Weather=Split(rs("blog_Weather"),"|")
	  	rs("blog_ViewNums")=rs("blog_ViewNums")+1
                IF slog_IsShow=False Then 
                   start="BLOG日志 - 一篇隐藏日志"
                   mainTitle="一篇隐藏日志"
                else
                   start="兜客日志 - "&slog_Title&""
                   mainTitle=slog_Title
                end if
		rs.UPDATE
	     rs.Close
	  Set rs=Nothing
        end if
end if

if FoundErr=True then
	Call HxErrMsg()
	response.end
end if


sub main_blog()
    Response.Write "您的位置： <a href='index.asp'>"&webname&"</a> >> <a href='blog.asp'>兜客日志</a>"
    if sCat_ID<>empty then
         sCat_ID=clng(sCat_ID)
         Response.Write " >>  <a href='blog.asp?cat_id="&sCat_ID&"'>"&conn.execute("select cate_Name from b_cat where cate_ID="&sCat_ID&"")(0)&"</a>"
    end if
    if sBlog_ID>0 then Response.Write " >> "&mainTitle&""
    if Request.QueryString("tags")<>empty then Response.Write " >> TAG标签"
end sub


sub contextual_blog()
Dim blog_Prev,blog_Next
Dim cateQuery,Url_Add,Previmg,Nextimg
      cateQuery=""
      Url_Add="?"
      Previmg="<div><img src=""img/blog/Prev.gif"" border=""0""><font color='#CC3300'><strong>上篇日志：</strong></font>"
      Nextimg="<div style=""margin-top:5px;""><img src=""img/blog/Next.gif"" border=""0""><font color='#339900'><strong>下篇日志：</strong></font>"
If sCat_ID<>Empty Then
      cateQuery=" AND blog_cateID="&sCat_ID
      Url_Add=Url_Add&"cat_id="&sCat_ID&"&"
End If
Set blog_Prev=Conn.Execute("SELECT TOP 1 blog_ID,blog_Title,blog_IsShow,blog_Author FROM b_Content WHERE blog_ID<"&sBlog_ID&""&cateQuery&" ORDER BY blog_ID DESC")
IF blog_Prev.eof and blog_Prev.bof Then
        Response.Write "" & Previmg & "已经没有了</DIV> " & vbCrLf    
else
    If blog_Prev(2)=True OR (blog_Prev(2)=False And (SupAdmin=true OR (checkmember=true And Hx66_name=blog_Prev(3)))) Then
        Response.Write "" & Previmg & "<a href="""&Url_Add&"blog_id="&blog_Prev(0)&""">"&blog_Prev(1)&"</a></DIV>" & vbCrLf 
    else
        Response.Write "" & Previmg & "<a href="""&Url_Add&"blog_id="&blog_Prev(0)&""">隐藏日志……</a></DIV>" & vbCrLf  
    end if 
end if  
Set blog_Prev=Nothing
Set blog_Next=Conn.Execute("SELECT TOP 1 blog_ID,blog_Title,blog_IsShow,blog_Author FROM b_Content WHERE blog_ID>"&sBlog_ID&""&cateQuery&" ORDER BY blog_ID ASC")
IF blog_Next.eof and blog_Next.bof Then
        Response.Write "" & Nextimg & "已经没有了</DIV>" & vbCrLf   
else
    If blog_Next(2)=True OR (blog_Next(2)=False And (SupAdmin=true OR (checkmember=true And Hx66_name=blog_Next(3)))) Then
        Response.Write "" & Nextimg & "<a href="""&Url_Add&"blog_id="&blog_Next(0)&""">"&blog_Next(1)&"</a></DIV>" & vbCrLf 
    else
        Response.Write "" & Nextimg & "<a href="""&Url_Add&"blog_id="&blog_Next(0)&""">隐藏日志……</a></DIV>" & vbCrLf  
    end if
end if  
Set blog_Next=Nothing
end sub

Sub BlogList(num,fontnum,ls) 
  Response.Write("<TABLE width='100%' cellSpacing=0 cellPadding=0 align=center border=0>")
Dim rslist,i
if ls=0 then
   Set rslist=Conn.Execute("SELECT TOP "&num&" T.blog_ID,T.blog_Title,T.blog_Author,blog_PostTime,blog_IsShow FROM b_Content T,b_cat C WHERE T.blog_cateID=C.cate_ID ORDER BY T.blog_PostTime DESC")
elseif ls=1 then
   Set rslist=Conn.Execute("SELECT TOP "&num&" T.blog_ID,T.blog_Title,T.blog_Author,blog_PostTime,blog_IsShow FROM b_Content T,b_cat C WHERE T.blog_cateID=C.cate_ID and blog_isbest=True ORDER BY T.blog_PostTime DESC")
elseif ls=2 then
   Set rslist=Conn.Execute("SELECT TOP "&num&" T.blog_ID,T.blog_Title,T.blog_Author,blog_PostTime,blog_IsShow FROM b_Content T,b_cat C WHERE T.blog_cateID=C.cate_ID ORDER BY T.blog_ViewNums DESC, T.blog_PostTime DESC")			
end if
  i=1
  IF rslist.EOF AND rslist.BOF Then
	  Response.Write("暂无")
  Else
	  Do While NOT rslist.EOF
          Response.Write("<TR><TD height='25'>")
	  IF rslist("blog_IsShow")=False Then
		Response.Write("&nbsp;<img src=""img/blog/top"&i&".gif"" border=""0"">&nbsp;<a href='showblog.asp?blog_id="&rslist("blog_ID")&"' title='隐藏日志，不显示预览'>隐藏日志……</a>")
	  Else
                Response.Write("&nbsp;<img src=""img/blog/top"&i&".gif"" border=""0"">&nbsp;<a href='showblog.asp?blog_id="&rslist("blog_ID")&"' title='日志标题："&HTMLEncode(rslist("blog_Title"))&"&#13;&#10;发表日期："&rslist("blog_PostTime")&"&#13;&#10;日志作者："&HTMLEncode(rslist("blog_Author"))&"'>"&HTMLEncode(cutStr(rslist("blog_Title"),fontnum))&"</a>")
          End IF
          Response.Write("</TD></TR>") & vbCrLf
          i=i+1
	  rslist.MoveNext
	  Loop
  End IF
  rslist.Close
  Set rslist=Nothing
Response.Write("</TABLE>")
End Sub
Sub NewCommList(num,fontnum)
    Response.Write("<TABLE width='100%' cellSpacing=0 cellPadding=0 align=center border=0>")
Dim Arr_LastComm 
Dim rscomm
Set rscomm=Server.CreateObject("ADODB.RecordSet")
SQL="SELECT TOP "&num&" C.comm_ID,C.comm_Content,C.comm_Author,C.comm_PostTime,C.blog_ID,H.blog_ID,H.blog_IsShow FROM b_review AS C,b_Content AS H WHERE H.blog_ID=C.blog_ID ORDER BY comm_PostTime DESC"
rscomm.Open SQL,Conn,1,1
If rscomm.EOF AND rscomm.BOF Then
	Redim Arr_LastComm(7,0)
Else
	Arr_LastComm=rscomm.GetRows
End If
rscomm.Close
Set rscomm=Nothing

Dim CommNums,i
CommNums=Ubound(Arr_LastComm,2)
For i=0 To CommNums
    Response.Write("<TR><TD height='25'>&nbsp;<img src=""img/blog/dot3.gif"" border=""0"">")
    IF Arr_LastComm(6,i)=Empty Then
          Response.Write("&nbsp;隐藏日志的评论")
    Else
          IF DelQuote(Arr_LastComm(1,i))<>Empty Then
	      Dim CommContent
	      CommContent=DelQuote(HTMLEncode(Arr_LastComm(1,i)))
	      Response.Write("&nbsp;<a href=""showblog.asp?blog_id="&Arr_LastComm(4,i)&"#commmark_"&Arr_LastComm(0,i)&""" title="""&Arr_LastComm(2,i)&" 于 "&Arr_LastComm(3,i)&" 发表评论：&#13;&#10;"&Replace(Left(CommContent,100),"<br>","&#13;&#10;")&""">"&SplitLines(cutStr(Replace(CommContent,"<br>",""),fontnum),0)&"</a>")
          Else
              Response.Write("&nbsp;<a href=""showblog.asp?blog_id="&Arr_LastComm(4,i)&"#commmark_"&Arr_LastComm(0,i)&""">没有评论内容，只是引用</a>")
          End IF
   End IF
	      Response.Write("</TD></TR>")
Next
   Response.Write("</TABLE>")
End Sub

sub class_blog()
Response.Write("<div style=""display:block;padding:5px 1px;"">")
   Response.Write("<TABLE width='100%' cellSpacing=0 cellPadding=0 align=center border=0>")
	Dim ClassNum,i
	ClassNum=Ubound(Arr_Cat,2)
	For i=0 To ClassNum
        IF Arr_Cat(1,i)=Empty Then
           Response.Write("尚无分类，请先添加")
        Else
           Response.Write("<TR><TD height='25'>")
           IF ucase(Trim(CheckStr(Trim(Request.QueryString("cat_id")))))=ucase(Trim(Arr_Cat(0,i))) Then
	       Response.Write("&nbsp;<img src=""img/blog/dot.gif"" border=""0"">&nbsp;<font color=""#ff0000"">"&Arr_Cat(1,i)&"["&conn.execute("select count(blog_id) from b_content where blog_CateID="&Arr_Cat(0,i)&"")(0)&"]</font><BR>")
	   Else
	       Response.Write("&nbsp;<img src=""img/blog/dot0.gif"" border=""0"">&nbsp;<a href=""blog.asp?cat_id="&Arr_Cat(0,i)&""" title=""分类名称："&Arr_Cat(1,i)&""">"&Arr_Cat(1,i)&"</a>["&conn.execute("select count(blog_id) from b_content where blog_CateID="&Arr_Cat(0,i)&"")(0)&"]<BR>")
	   End IF
           Response.Write("</TD></TR>")
        End IF
        Next
Set ClassNum=Nothing
   Response.Write("</TABLE>")
Response.Write("</div>")
end sub

sub search_blog()
Response.Write "<form name='form2' method='post' action='blog.asp'><div align=center><input type='radio' name='is_select' value='1' checked class='inuptCG'>标题&nbsp;&nbsp;<input type='radio' name='is_select' value='2' class='inuptCG'>内容<br><input type='text' name='Search_keyword'  size='15' value='搜索关键字' maxlength='20' onfocus=""this.value=''""class='input'>&nbsp;<input type='submit' name='search'  value='搜索' onmouseover=""this.className='boton'"" onmouseout=""this.className='botoff'""></form></div>" & vbCrLf
end sub

sub content_blog()
if Request.querystring("blog_id")=Empty then
  Response.Write "<script language=javascript>alert('请指定操作的对象！');javascript:history.back();</script>"
  Response.End
end if
%>
<table border="0" width="100%" align="center" cellpadding="0" cellspacing="0" style="border-collapse: collapse;word-break:break-all;table-layout:fixed;text-align:left;display:block;padding:3px 12px;">
<%If slog_IsShow=True OR (checkmember=true and Hx66_name=slog_Author) OR SupAdmin=true Then%>
        <tr>
          <td height="34" class="a1" width="100%"><img src="img/blog/<%=slog_Weather(0)%>.gif" alt="<%=slog_Weather(1)%>" align="absmiddle">&nbsp;<strong><%=slog_Title%></strong><%If slog_IsShow = False Then%>（隐）<%End If%></td><td height="26" class="a1" align="right"><%If checkmember=true and Hx66_name=slog_Author Then
				Response.Write("&nbsp;&nbsp;<a href=""blog_edit.asp?blogID="&sBlog_ID&"""><img src=""img/blog/icon_edit.gif"" border=""0"" align=""absmiddle"" alt=""编辑日志"">编辑日志</a>")
			End If%></td>
        </tr>
        <tr>
          <td colspan=2 height="52"><div align="right">[时间：<%=datevalue(slog_PostTime)%>&nbsp;|&nbsp;来源：<a href="<%=slog_FromURL%>" target="_blank"><%=slog_From%></a>]<BR>
[字体：<a href="javascript:ContentSize(16)">大</a> <a href="javascript:ContentSize(14)">中</a> <a href="javascript:ContentSize(12)">小</a>]</div><hr size="1" style="border:1px dotted #CCCCCC;"></TD>
        </tr>
        <tr>
          <td valign="top" colspan=2 id="size"><%=Ubbcode(HTMLEncode(slog_Content),slog_DisSM,slog_DisUBB,slog_DisIMG,slog_AutoURL,slog_AutoKEY)%><BR><BR></TD>
        </tr>
        <%IF slog_Modify<>Empty Then 
             Response.Write ("<tr><td colspan=2>" & slog_Modify & "</TD></tr>") 
        End If%>
        <%IF ShowTag(sBlog_ID,"Show")<>empty then 
             Response.Write ("<tr><td colspan=2>" & ShowTag(sBlog_ID,"Show") & "</TD></tr>") 
        End if%>
        <tr>
          <td valign="top" colspan=2><img src="img/blog/icon_trackback.gif" border="0" align="absmiddle"><b><a href="blog_tb.asp?blogID=<%=sBlog_ID%>">引用通告</a>(<%=slog_QuoteNums%>)：</b><%=webURL%>/blog_tb.asp?id=<%=sBlog_ID%></TD>
        </tr>
<%Else
        Response.Write("<tr><td height=""26"" class=""a1"" colspan=2><strong>隐藏日志……</strong></TD></TR>")
End If%>
        <tr>
          <td valign="top" colspan=2><hr size="1" noshade color="#CCCCCC"><%call contextual_blog()%></TD>
        </tr>
       <%If slog_IsShow=True OR (checkmember=true and Hx66_name=slog_Author) OR SupAdmin=true Then%>
        <tr>
          <td height="26" class="a1" colspan=2>相关评论与引用通告</td>
        </tr>
        <tr>
          <td colspan=2>
<%
Dim CurPage,blogPerPage,Url_Add
If CheckStr(Request.QueryString("Page"))<>Empty Then
   Curpage=CheckStr(Request.QueryString("Page"))
   If IsInteger(Curpage)=False OR Curpage<0 Then Curpage=1
Else
   Curpage=1
End If
blogPerPage=30
Url_Add="?blog_id="&sBlog_ID&"&"
If sCat_ID<>Empty Then
     Url_Add=Url_Add&"cat_id="&sCat_ID&"&"
End If
Dim rsc
Set rsc=Server.CreateObject("Adodb.RecordSet")
SQL="SELECT comm_ID,comm_Content,comm_Author,comm_PostTime,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_PostIP,comm_AutoKEY FROM b_review WHERE blog_ID="&sBlog_ID&" UNION ALL SELECT 0,tb_Intro,tb_Title,tb_PostTime,tb_URL,tb_Site,tb_ID,0,'127.0.0.1',0 FROM b_Trackback WHERE blog_ID="&sBlog_ID&" ORDER BY comm_PostTime DESC"
rsc.Open SQL,Conn,1,1
     If rsc.EOF And rsc.BOF Then
%>
        <div style="height:26px"><li>暂时没有评论与引用</li></div>
    <%Else
           Dim Comm_Nums,MultiPages,PageCount
	   rsc.PageSize=blogPerPage
	   rsc.AbsolutePage=CurPage
	   Comm_Nums=rsc.RecordCount
	   MultiPages="<div style=""margin-top:10px;"" align=""center"">"&MultiPage(Comm_Nums,blogPerPage,CurPage,Url_Add)&"</div>"
	   Response.Write(MultiPages)
           Do Until rsc.EOF OR PageCount=blogPerPage
	   Dim blog_CommID,blog_CommAuthor,blog_CommContent
	   blog_CommID=rsc("comm_ID")
	   blog_CommAuthor=rsc("comm_Author")
	   blog_CommContent=rsc("comm_Content")
           Response.Write("<div style=""margin-top:10px;""><a name=""commmark_"&blog_CommID&"""></a>")
		    IF blog_CommID=0 Then
		       Response.Write("<img src=""img/blog/icon_ctb.gif"" border=""0"" align=""absmiddle"">&nbsp;引用通告：<a href="""&rsc("comm_DisSM")&""" target=""_blank"">"&rsc("comm_DisUBB")&"</a> 于 "&datevalue(rsc("comm_PostTime"))&"&nbsp;")
		    Else
                       Response.Write("<img src=""img/blog/dot3.gif"" alt=""引用这个评论"" border=""0"" align=""absmiddle"" style=""cursor:hand;"" onclick=""blogquote('quote_"&blog_CommID&"','"&blog_CommAuthor&"','"&rsc("comm_PostTime")&"')"";/>")
		       Response.Write("<div style=""display:none;"" id=""quote_"&blog_CommID&""">"&cutStr(DelQuote(Replace(HTMLEncode(blog_CommContent),"<br>","")),60)&"</div>&nbsp;发表评论：<font color=red>"&blog_CommAuthor&"</font> 于 <i>"&rsc("comm_PostTime")&"</i>&nbsp;")
		    End IF
                    If (checkmember=true and Hx66_name=slog_Author) OR SupAdmin=true Then
			If blog_CommID=0 Then
			Response.Write("&nbsp;&nbsp;<a href=""blog_tb.asp?action=deltb&blogID="&sBlog_ID&"&tbID="&rsc("comm_DisIMG")&""" title=""删除引用通告"" onClick=""winconfirm('你真的要删除这个引用吗？','blog_tb.asp?action=deltb&blogID="&sBlog_ID&"&tbID="&rsc("comm_DisIMG")&"'); return false""><b><font color='#FF0000'>×</font></b>删除引用</a>")
			Else
			Response.Write("&nbsp;&nbsp;<a href=""showblog.asp?action=delcomm&blogID="&sBlog_ID&"&commID="&blog_CommID&""" onClick=""return confirm('确定删除此条评论吗?');"" title=""删除评论""><b><font color=""#FF0000"">×</font></b>删除评论</a>&nbsp;|&nbsp;IP："&rsc("comm_PostIP")&"")
			End If
		    End If
                    Response.Write("</div>")
		    If blog_CommID=0 Then
		       Response.Write("<div style=""BORDER-bottom: #CCCCCC 1px dotted;padding: 5px;""><b>标题：</b>"&blog_CommAuthor&"<br><b>链接：</b><a href="""&rsc("comm_DisSM")&""" target=""_blank"">"&rsc("comm_DisSM")&"</a><br><b>摘要：</b>"&blog_CommContent&"</div>")
		    Else
			Response.Write("<div style=""BORDER-bottom: #CCCCCC 1px dotted;padding: 5px;"">"&UbbCode(HTMLEncode(blog_CommContent),rsc("comm_DisSM"),rsc("comm_DisUBB"),rsc("comm_DisIMG"),rsc("comm_AutoURL"),rsc("comm_AutoKEY"))&"</div>")
		    End If
           PageCount=PageCount+1
	   rsc.MoveNext
	   Loop
       End If
   rsc.Close
Set rsc=Nothing
Response.Write(MultiPages)
IF slog_DisComment=False and slog_IsShow=True Then
%>
       <script language="JavaScript" src="inc/ubbcode.js"></script>
           <table bgcolor='#ffffff' borderColor='#f0f0f0' Border='1' Cellspacing='0' Cellpadding='3' width='100%' align='Center' style="border-collapse: collapse">
               <form name="FrontPage_Form1" method="post" action="?action=addcomm" id="bnews">
                  <tr>
                    <td colspan="2" align="center"><a name="#comment"></a><b>发表评论</b></td>
                  </tr>
                  <tr>
                    <td width="20%" align="right"><b>作者：≤12</b></td>
                    <td width="80%">
                      <%If UserLogined=True Then
			  Response.Write("<input name=""comm_memName1"" type=""text"" id=""comm_memName1"" value="""&Hx66_Name&""" size=""12"" class=""input"">")
			  Response.Write("<input name=""comm_memName2"" type=""hidden"" value="""&Hx66_Name&""">")
			Else
			  Response.Write("<input name=""comm_memName1"" type=""text"" id=""comm_memName1"" size=""12"" class=""input"">&nbsp;")
			  Response.Write("<input name=""comm_memName2"" type=""hidden"" value="""">")
			End If%>
                         验证码：
                          <input name="blog_Code" type="text" id="blog_Code" size="12" class="input">
                          &nbsp;<img src="inc/lycode.asp" align="absmiddle" border="0"></td>
                  </tr>
                  <tr>
                     <td align="right" valign="top"><b>评论：≤600</b>
                         <div style="padding-left:5px;" align="left" width="100%">
                         <input name="comm_DisSM" type="checkbox" id="comm_DisSM" value="1">
                  禁止表情<br>
                  <input name="comm_DisUBB" type="checkbox" id="comm_DisUBB" value="1">
                  禁止UBB<br>
                  <input name="comm_DisIMG" type="checkbox" id="comm_DisIMG" value="1">
                  禁止图片<br>
                  <input name="comm_AutoURL" type="checkbox" id="comm_AutoURL" value="1" checked>
                  识别链接<br>
                  <input name="comm_AutoKEY" type="checkbox" id="comm_AutoKEY" value="1">
                  识别关键字</div></td>
                      <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="0" cellpadding="2">
                          <tr>
                            <td valign="top"><textarea name="message" style="width:450px" rows="8" wrap="VIRTUAL" id="Content" onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyDown="javascript: ctlent();" onKeyUp="javascript: storeCaret(this);" class="input"></textarea></td>
                          </tr></table></td>
                  </tr>
                  <tr>
                    <td width="100">&nbsp;&nbsp;表情图：<img alt='点击弹开所有表情图' onclick='opencat(Emot_open)' style='CURSOR: hand' src='img/info.gif' hspace='0' align='absmiddle'></td><td width="450" id='Emot_open' style='display: none'>
                       <%Dim emot_Nums,emot_i
			emot_Nums=Ubound(Arr_Emot,2)
			TempVar=""
			For emot_i=0 To emot_Nums
				Response.Write(TempVar&"<img style=""cursor:hand;"" onclick=""AddText('"&Arr_Emot(2,emot_i)&"');"" src=""img/blog/emot/"&Arr_Emot(1,emot_i)&""">")
				TempVar=" "
			Next%></td>
                  </tr>
                  <tr align="center">
                      <td colspan="2"><input name="PostBlogc" type="hidden" value="ok">
                      <input name="blog_ID" type="hidden" id="blog_ID" value="<%=sBlog_ID%>">
                      <input name="topicsubmit" type="submit" value="发表评论" onClick="this.disabled=true;document.bnews.submit();" class="input">&nbsp;<input name="Reset" type="reset" id="Reset" value="重置评论" class="input"> [可按 Ctrl+Enter 发布] </td>
                  </tr>
              </form>
       </table>
<%
Else
    IF slog_DisComment=False Then
        Response.Write("<div style=""height:26px""><li>隐藏日志不允许发表评论</li></div>")
    Else
        Response.Write("<div style=""height:26px""><li>此日志禁止发表评论</li></div>")
    End If
End If
End If%>
     </td>
   </tr>
</table>
<%
end sub

sub displayList_blog()
If CheckStr(Request.QueryString("Page"))<>Empty Then
   Curpage=CheckStr(Request.QueryString("Page"))
   If IsInteger(Curpage)=False OR Curpage<0 Then Curpage=1
Else
   Curpage=1
End If
    Dim Hx_Year,Hx_Month,Hx_Day,sCat_ID,SQLFiltrate,Url_Add,blog_Search
    Hx_Year=CheckStr(Trim(Request.QueryString("Hx_Year")))
    Hx_Month=CheckStr(Trim(Request.QueryString("Hx_Month")))
    Hx_Day=CheckStr(Trim(Request.QueryString("Hx_Day")))
    sCat_ID=CheckStr(Trim(Request.QueryString("cat_id")))
    tag=CheckStr(Trim(Request.QueryString("tags")))
    blog_Search=""
    SQLFiltrate="WHERE"
    Url_Add="?"
    IF tag<>empty then
	SQLFiltrate=SQLFiltrate&" tagsName='"&tag&"' AND"
        Url_Add=Url_Add&"tags="&tag&"&"
    End IF
    IF IsInteger(sCat_ID)=True Then
	SQLFiltrate=SQLFiltrate&" blog_CateID="&sCat_ID&" AND"
	Url_Add=Url_Add&"cat_id="&sCat_ID&"&"
    End IF
    IF IsInteger(Hx_Year)=True Then
	SQLFiltrate=SQLFiltrate&" blog_PostYear="&Hx_Year&" AND"
	Url_Add=Url_Add&"Hx_Year="&Hx_Year&"&"
    End IF
    IF IsInteger(Hx_Month)=True Then
	SQLFiltrate=SQLFiltrate&" blog_PostMonth="&Hx_Month&" AND"
	Url_Add=Url_Add&"Hx_Month="&Hx_Month&"&"
    End IF
    IF IsInteger(Hx_Day)=True Then
	SQLFiltrate=SQLFiltrate&" blog_PostDay="&Hx_Day&" AND"
	Url_Add=Url_Add&"Hx_Day="&Hx_Day&"&"
    End IF
    if Request("Search_keyword")<>empty then
        Dim blog_SearchContent,is_select,Search_class
           blog_SearchContent=CheckStr(Request.Form("Search_keyword"))
	   is_select=CheckStr(Request.Form("is_select"))
           IF blog_SearchContent=Empty Then blog_SearchContent=CheckStr(Request.Querystring("Search_keyword"))
	   IF is_select=Empty Then is_select=CheckStr(Request.Querystring("is_select"))
           select case is_select
           case "1" 
                 SQLFiltrate=SQLFiltrate&" blog_Title LIKE '%"&blog_SearchContent&"%' AND"
                 Url_Add=Url_Add&"is_select=1&Search_keyword="&Server.URLEncode(blog_SearchContent)&"&"
                 blog_Search="找到标题关键字为 <font color=red>"&blog_SearchContent&"</font> 的"
                 Search_class="<font color=green>标题</font>"
           case "2" 
                 SQLFiltrate=SQLFiltrate&" blog_Content LIKE '%"&blog_SearchContent&"%' AND"
                 Url_Add=Url_Add&"is_select=2&Search_keyword="&Server.URLEncode(blog_SearchContent)&"&"
                 blog_Search="找到内容关键字为 <font color=red>"&blog_SearchContent&"</font> 的"
                 Search_class="<font color=green>内容</font>"
           case else 
                 Response.Write "<script language=javascript>alert('搜索参数非法');javascript:history.back();</script>"
                 Response.End
          end select
   end if
set rs=server.createobject("adodb.recordset")
IF tag<>empty then
SQL="SELECT H.*,C.cate_Name,A.* FROM b_Content AS H,b_Cat AS C,b_tag AS A "&SQLFiltrate&" C.cate_ID=H.blog_CateID AND H.blog_ID=A.BlogID ORDER BY blog_IsTop ASC,blog_ID DESC"
else
SQL="SELECT H.*,C.cate_Name FROM b_Content AS H,b_cat AS C "&SQLFiltrate&" C.cate_ID=H.blog_CateID ORDER BY blog_IsTop ASC,blog_ID DESC"
End IF
rs.open sql,conn,1,1
if not rs.eof then
   Dim blog_Nums,MultiPages,i
   blogperpage=10
   rs.PageSize=blogperpage
   rs.AbsolutePage=CurPage
   blog_Nums=rs.RecordCount
   MultiPages="<div style=""margin-top:10px;"" align=""center"">"&MultiPage(blog_Nums,blogperpage,CurPage,Url_Add)&"</div>"
IF tag<>empty then
   Response.Write("<table border='0' width='100%' align='center' style='border:1px dashed #B7B7B7;margin-bottom:10px;'><tr><td>共有 "&totalcs&" 篇日志使用了该 TAG <B><font color=red>"&tag&"</font></B>&nbsp;&nbsp;&nbsp;<img alt='点击弹开所有Tags列表' onclick='opencat(Tags_open)' style='CURSOR: hand' src='img/info.gif' hspace='0' align='absmiddle'></td></tr></table>")
   Response.Write("<table border='0' width='100%' align='center' style='border:1px dashed #B7B7B7;margin-bottom:10px;' id='Tags_open' style='display: none'><tr><td>")
        Dim TagsNum,Ti
	TagsNum=Ubound(Arr_Tags,2)
	For Ti=0 To TagsNum
           Response.Write("<a href=""blog.asp?tags="&Server.URLEncode(Arr_Tags(1,Ti))&""">"&Arr_Tags(1,Ti)&"</a>("&Arr_Tags(2,Ti)&") | ")
        Next
Set TagsNum=Nothing
Response.Write("</td></tr></table>")
End IF
IF request("Search_keyword")<>empty then
   Response.Write("<table border='0' width='100%' align='center' style='border:1px dashed #B7B7B7;margin-bottom:10px;'><tr><td>共找到 "&totalcs&" 篇日志 "&Search_class&" 包含关键字<B> <font color=red>"&blog_SearchContent&"</font></B></td></tr></table>")
End IF
Do Until Rs.EOF OR i=blogperpage
                weblog_ID=rs("blog_ID")
		weblog_IsShow=rs("blog_IsShow")
		weblog_Author=rs("blog_Author")
		weblog_IsTop=rs("blog_IsTop")
		weblog_IsBest=rs("blog_IsBest")
		weblog_Weather=Split(rs("blog_Weather"),"|")
		weblog_Intro=Replace(rs("blog_Intro"),"&#39;&#39;","&#39;")
		If IsInteger(sCat_ID)=False Then
			weblog_ShowURL="<a href=""showblog.asp?blog_id="&weblog_ID&""">"
		Else
			weblog_ShowURL="<a href=""showblog.asp?blog_id="&weblog_ID&"&cat_id="&sCat_ID&""">"
		End If
%>
<table border="0" width="100%" align="center" cellpadding="0" cellspacing="0" style="border-collapse: collapse;word-break:break-all;table-layout:fixed;text-align:left;display:block;padding:5px 10px;">
    <%If weblog_IsShow=True or (checkmember=true and Hx66_name=weblog_Author) OR SupAdmin=true Then%>
        <tr<%If weblog_IsTop=True Then%> onclick='opencat(top_open_<%=i%>)' style='CURSOR: hand'<%End If%>>
          <td height="34" class="a1" width="65%"><img src="img/blog/<%=weblog_Weather(0)%>.gif" alt="<%=weblog_Weather(1)%>" align="absmiddle">&nbsp;<%=weblog_ShowURL%><strong><%=rs("blog_Title")%></strong></a><%If weblog_IsShow = False Then%>（隐）<%End If%></td><td height="26" class="a1" align="right">［<%=datevalue(rs("blog_PostTime"))%>&nbsp;|&nbsp;<a href="<%=rs("blog_FromURL")%>" target="_blank"><%=rs("blog_From")%></a>］<%If weblog_IsTop=True Then%><img src="img/blog/istop.gif" alt="置顶日志" align="absmiddle"><%End If%><%If weblog_IsBest=True Then%> <img src="img/blog/isbest.gif" alt="精华日志" align="absmiddle"><%End If%></td>
        </tr>
        <tr<%If weblog_IsTop=True Then%> id='top_open_<%=i%>' style='display: none'<%End If%>>
          <td colspan=2>
            <DIV style="margin-top:2px;margin-bottom:15px;"><%=Ubbcode(weblog_Intro,rs("blog_DisSM"),rs("blog_DisUBB"),rs("blog_DisIMG"),rs("blog_AutoURL"),rs("blog_AutoKEY"))%></DIV>
             <%if ShowTag(weblog_ID,"Show")<>empty then
		  Response.Write ("<DIV>"&ShowTag(weblog_ID,"Show")&"</DIV>")
	     end if%>
             <%If HtmlEncode(rs("blog_Content"))<>weblog_Intro Then%>
                <DIV><%=weblog_ShowURL%><img src="img/blog/icon_readmore.gif" align="absmiddle" border="0"> 全文阅读……</a></DIV><%End If%>
               <div align="right">发布：<%=weblog_Author%>&nbsp;|&nbsp;分类：<a href="blog.asp?cat_id=<%=rs("blog_CateID")%>"><%=rs("cate_Name")%></a>&nbsp;|&nbsp;<a href="showblog.asp?blog_id=<%=weblog_ID%>#comment">评论：<%=rs("blog_CommNums")%></a>&nbsp;|&nbsp;<a href="blog_tb.asp?blogID=<%=weblog_ID%>">引用：<%=rs("blog_QuoteNums")%></a>&nbsp;|&nbsp;查看：<%=rs("blog_ViewNums")%></div></TD>
        </tr>
<%Else
       Response.Write("<tr><td height=""26"" class=""a1""><strong>隐藏日志……</strong></TD></TR>")
End If%>
</table>
<div style="margin-top:8px;"></div>
<%
i=i+1
rs.movenext
loop
else
Response.Write("<div align=""center"" class=""a1"" style=""height:26px"">抱歉，没有找到"&blog_Search&"相关日志！</div>")
end if
Response.Write(MultiPages)
rs.close
set rs=nothing
end sub

select case request.QueryString("action")
case "addblog" 
           call blog_add()
case "editblog" 
           call blog_edit()
case "addcomm" 
           call blog_comm()
case "delcomm" 
           call blog_delcomm()
end select
sub blog_put()
IF checkmember<>true Then
   Response.Write "<Script Language=JavaScript>alert('对不起，你没有发表日志权限！');javascript :history.back();</Script>"
   Response.End
end if
%>
<script language="JavaScript" src="inc/ubbcode.js"></script>
<table bgcolor="#ffffff" borderColor="#f0f0f0" Border="1" Cellspacing="0" Cellpadding="5" width="98%" align="Center" style="border-collapse: collapse">
<form name="FrontPage_Form1" method="post" action="?action=addblog" id="bnews">
   <tr>
      <td width="12%" align="right">标题：</td>
      <td width="88%"><input name="alog_Title" type="text" id="alog_Title" size="50" class="input">&nbsp;
        <select name="alog_Weather" id="alog_Weather" onChange="document.images['show_Weather'].src='img/blog/'+options[selectedIndex].value.split('|')[0]+'.gif';" size="1" class="input">
          <option value="0|未知" selected>天气</option>
          <option value="1|晴天">晴天</option>
          <option value="2|多云">多云</option>
          <option value="3|雨天">雨天</option>
          <option value="4|刮风">刮风</option>
          <option value="5|雪天">雪天</option>
          <option value="6|彩虹">彩虹</option>
          <option value="7|露水">露水</option>
        </select>&nbsp;<img id="show_Weather" src="img/blog/0.gif" align="absmiddle"> </td>
   </tr>
   <tr>
      <td align="right">分类：</td>
      <td><select name="alog_CateID" id="alog_CateID" class="input">
           <%Dim Cat_Nums,Cat_NumI
	     Cat_Nums=Ubound(Arr_Cat,2)
	     For Cat_NumI=0 To Cat_Nums
	       Response.Write("<option value='"&Arr_Cat(0,Cat_NumI)&"'>"&Arr_Cat(1,Cat_NumI)&"</option>")
	     Next%></select></td>
   </tr>
   <tr>
      <td align="right">属性：</td>
      <td><input name="alog_IsShow" type="radio" value="0" checked>公开日志&nbsp;
          <input name="alog_IsShow" type="radio" value="1">隐藏日志&nbsp;&nbsp;||&nbsp;
          <input name="alog_IsTop" type="checkbox" id="alog_IsTop" value="1">置顶日志&nbsp;
          <input name="alog_IsBest" type="checkbox" id="alog_IsBest" value="1">精华日志&nbsp;
          <input name="alog_DisComment" type="checkbox" id="alog_DisComment" value="1">禁止评论</td>
   </tr>
   <tr>
      <td align="right">来源：</td>
      <td><input name="alog_From" type="text" id="alog_From" value="本站原创" size="12" class="input">&nbsp;<b>地址：
          <input name="alog_FromURL" type="text" id="alog_FromURL" value="<%=weburl%>" size="38" class="input"></td>
   </tr>
<script language=javascript>
function Hx_accept(addaccept)
{
  if (addaccept!="")
  { document.bnews.alog_Tags.value=addaccept; }
}
</script>
   <tr>
      <td align="right">TAGs：</td>
      <td><input name="alog_Tags" type="text" id="alog_Tags" size="30" class="input">
         <% dim rs_key,sql_key
set rs_key=Server.CreateObject("ADODB.RecordSet")
sql_key="SELECT * FROM b_tags order by tagid desc"
rs_key.open sql_key,conn,1,1%>
<select name="rs_key" id="rs_key" onchange="javascript:Hx_accept(this.options[this.selectedIndex].value);" class="input">
 <%if rs_key.bof and rs_key.eof then
  response.Write("<option value='HxBLOG'>没有TAGs</option>")
  else 
  response.Write (" <option value=''>选择已有TAG</option>")
 do Until rs_key.eof 
 response.Write (" <option value="&rs_key(1)&">"&rs_key(1)&"</option>")
 rs_key.movenext
 loop
 end if%></select> 多个Tag 用 | 分隔</td>
    </tr>
    <tr>
       <td align="right" valign="top">内容：</td>
        <td>
           <table width="98%" border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td>
                 <input name="alog_DisSM" type="checkbox" id="alog_DisSM" value="1">禁止表情
                 <input name="alog_DisUBB" type="checkbox" id="alog_DisUBB" value="1">禁止UBB
                 <input name="alog_DisIMG" type="checkbox" id="alog_DisIMG" value="1">禁止图片
                 <input name="alog_AutoURL" type="checkbox" id="alog_AutoURL" value="1" checked>识别链接
                 <input name="alog_AutoKEY" type="checkbox" id="alog_AutoKEY" value="1">识别关键字</td>
             </tr>
             <tr>
                <td width="100%"><!--#include file="ubbget.asp" --></td>
             </tr>
           </table>
           <table width="98%" border="0" cellpadding="0" cellspacing="0">
             <tr valign="top">
                <td><textarea name="message" style="width:100%" rows="12" wrap="VIRTUAL" id="Content" onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyDown="javascript: ctlent();" onKeyUp="javascript: storeCaret(this);" class="input"></textarea></td>
             </tr>
           </table></td></tr>
                  <tr>
                    <td align="right">表情：<img alt='点击弹开所有表情图' onclick='opencat(Emot_open)' style='CURSOR: hand' src='img/info.gif' hspace='0' align='absmiddle'></td>
                    <td width="500" id='Emot_open' style='display: none' bgcolor="#FFFFFF">
                    <%Dim emot_Nums,emot_i
			emot_Nums=Ubound(Arr_Emot,2)
			TempVar=""
			For emot_i=0 To emot_Nums
				Response.Write(TempVar&"<img style=""cursor:hand;"" onclick=""AddText('"&Arr_Emot(2,emot_i)&"');"" src=""img/blog/emot/"&Arr_Emot(1,emot_i)&""">")
				TempVar=" "
			Next%></td>
                  </tr>
                  <tr>
                    <td align="right">附件：</td>
                    <td><iframe border="0" frameBorder="0" frameSpacing="0" height="23" marginHeight="0" marginWidth="0" noResize scrolling="no" width="100%" vspale="0" src="blog_upload.asp"></iframe></td>
                  </tr>
                  <tr>
                    <td align="right">引用：</td>
                    <td><input name="alog_Quote" type="text" id="log_Quote" size="75" class="input">
                        <br>要引用另一用户的网络日志项，输入以上网络日志项的引用通告 URL。用 | 分隔多个地址</td>
                  </tr>
                  <tr align="center">
                    <td colspan="2">
                      <input name="PostBlog" type="hidden" value="ok">
                      <input name="topicsubmit" type="submit" value="提交日志" onClick="this.disabled=true;document.bnews.submit();" class="input">&nbsp;
                     <input name="Reset" type="reset" id="Reset" value="重置日志" class="input"> [可按 Ctrl+Enter 发布] </td>
                  </tr>
              </form>
        </table>
     <BR>
<%
end sub

sub blog_add()
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
Response.Write("<script language=javascript>alert('你提交的路径有误，禁止从站点外部提交数据请不要乱改参数！');this.location.href='http://vip138.com';</script>") 
response.end
end if
IF checkmember<>true or request.Form("PostBlog")<>"ok" Then
   Response.Write "<Script Language=JavaScript>alert('对不起，你没有发表日志权限！');javascript :history.back();</Script>"
   Response.End
end if
IF trim(Request.Form("message"))=Empty OR trim(Request.Form("alog_Title"))=Empty OR trim(Request.Form("alog_CateID"))=Empty Then
   Response.Write "<Script Language=JavaScript>alert('对不起，日志标题、分类和内容不能为空！');javascript :history.back();</Script>"
   Response.End
Else
dim ablog_Title,ablog_Content,ablog_From,ablog_FromURL,ablog_CateID2,ablog_Intro,ablog_Quote,ablog_DisSM,ablog_DisUBB,ablog_DisIMG,ablog_AutoURL,ablog_IsShow,ablog_AutoKEY,ablog_IsTop,ablog_IsBest,ablog_DisComment,ablog_Weather
				ablog_Title=CheckStr(Request.Form("alog_Title"))  
				ablog_Content=CheckStr(Request.Form("message"))  
				If InStr(ablog_Content,"[#seperator#]")>0 Then
					ablog_Intro=HTMLEncode(Left(ablog_Content,InStr(ablog_Content,"[#seperator#]")-1))
				Else
					ablog_Intro=SplitLines(HTMLEncode(ablog_Content),4)  
				End If
				ablog_From=CheckStr(Request.Form("alog_From"))      
				ablog_FromURL=CheckStr(Request.Form("alog_FromURL")) 
				ablog_CateID2=Request.Form("alog_CateID")             
				ablog_Quote=CheckStr(Request.Form("alog_Quote"))      
				ablog_DisSM=Request.Form("alog_DisSM")      
				ablog_DisUBB=Request.Form("alog_DisUBB")   
				ablog_DisIMG=Request.Form("alog_DisIMG")   
				ablog_AutoURL=Request.Form("alog_AutoURL")  
				ablog_AutoKEY=Request.Form("alog_AutoKEY")  
				ablog_Weather=Request.Form("alog_Weather")  
				ablog_tags=Request.Form("alog_tags")        
				IF Request.Form("alog_IsTop")="1" Then   
					ablog_IsTop=True
 				Else
					ablog_IsTop=False
				End IF
				IF Request.Form("alog_IsBest")="1" Then   
					ablog_IsBest=True
 				Else
					ablog_IsBest=False
				End IF
				IF Request.Form("alog_IsShow")="0" Then   
					ablog_IsShow=True
				Else
					ablog_IsShow=False
				End IF
				If Request.Form("alog_DisComment")="1" Then  
					ablog_DisComment=True
				Else
					ablog_DisComment=False
				End IF
                                IF ablog_DisSM=Empty Then ablog_DisSM=0
				IF ablog_DisUBB=Empty Then ablog_DisUBB=0
				IF ablog_DisIMG=Empty Then ablog_DisIMG=0
				IF ablog_AutoURL=Empty Then ablog_AutoURL=0
				IF ablog_AutoKEY=Empty Then ablog_AutoKEY=0
				Conn.ExeCute("INSERT INTO b_Content(blog_CateID,blog_Title,blog_Author,blog_Intro,blog_Content,blog_From,blog_FromURL,blog_Quote,blog_DisSM,blog_DisUBB,blog_DisIMG,blog_AutoURL,blog_AutoKEY,blog_IsShow,blog_IsTop,blog_IsBest,blog_DisComment,blog_Weather) VALUES ("&ablog_CateID2&",'"&ablog_Title&"','"&Hx66_name&"','"&ablog_Intro&"','"&ablog_Content&"','"&ablog_From&"','"&ablog_FromURL&"','"&ablog_Quote&"',"&ablog_DisSM&","&ablog_DisUBB&","&ablog_DisIMG&","&ablog_AutoURL&","&ablog_AutoKEY&","&ablog_IsShow&","&ablog_IsTop&","&ablog_IsBest&","&ablog_DisComment&",'"&ablog_Weather&"')")

				Dim PostLogID  
				PostLogID=Conn.ExeCute("SELECT TOP 1 blog_ID FROM b_Content ORDER BY blog_ID DESC")(0)
				if trim(ablog_tags)<>empty then
				ablog_tags=Split(ablog_tags,"|")
				Dim tabs,ts
				For tabs=0 to Ubound(ablog_tags)
				    Sql="Select TagName from b_tags where TagName='"&ablog_tags(tabs)&"'"
					Set ts=Server.CreateObject("Adodb.Recordset")
					ts.open sql,conn,1,1
					If ts.eof and ts.bof then
					   conn.execute ("insert into b_tags(TagName) values('"&ablog_tags(tabs)&"')")
					Else
					   conn.execute ("update b_tags set TagBlogCount=TagBlogCount+1 where tagName='"&ablog_tags(tabs)&"'")
					End If
					conn.execute ("insert into b_tag(blogID,tagsName) values("&PostLogID&",'"&ablog_tags(tabs)&"')")
					ts.close
				    Set ts=Nothing
				Next
				End IF

                                IF ablog_Quote<>Empty And ablog_IsShow=True Then 
					Dim blog_QuoteEvery,blog_QuoteArr
					blog_QuoteArr=Split(ablog_Quote,"|")
					For Each blog_QuoteEvery In blog_QuoteArr
						Dim TBlogID,TBlogTmp,tbCode,tbMessage
						TBlogID=Conn.Execute("SELECT TOP 1 blog_ID FROM b_Content WHERE blog_Author='"&Hx66_name&"' AND blog_Quote='"&ablog_Quote&"' ORDER BY blog_PostTime DESC")(0)
						If TBlogID>0 then
							TBlogTmp=Split(Trackback(Trim(blog_QuoteEvery), weburl&"/showblog.asp?blog_id="&TBlogID, ablog_Title, CutStr(ablog_Intro,252), webName),"$$")
							tbCode=TBlogTmp(0)
							tbMessage=TBlogTmp(1)
							If tbCode="0" Then 
								tbMessage="<br><font color=""red"">"&tbMessage&"</font>" 
							Else 
								tbMessage="<br><font color=""blue"">"&tbMessage&"</font>"
							End If
						End if
					Next
				End IF		
            Response.Write "<Script Language=JavaScript>alert('日志发表成功！');this.top.location.href='blog.asp';</Script>"
       Response.End
End IF
end sub
sub blog_edit()
Dim eput_id
eput_id=Trim(Request.Form("eblog_ID"))
If IsInteger(eput_id)=False or request.Form("editBlog")<>"ok" Then
   Response.Write "<Script Language=JavaScript>alert('对不起，参数非法错误！');javascript :history.back();</Script>"
   Response.End
Else
   eput_id=clng(eput_id)
   Dim rs_eput
   Set rs_eput=Server.CreateObject("ADODB.Recordset")
   SQL="SELECT blog_ID,blog_Author FROM b_Content WHERE blog_ID="&eput_id
   rs_eput.Open SQL,Conn,1,1
   If rs_eput.EOF AND rs_eput.BOF Then   
      Response.Write "<Script Language=JavaScript>alert('对不起，修改的日志不存在！');javascript :history.back();</Script>"
      Response.End
   Else
      If Not((rs_eput("blog_Author")=Hx66_name And checkmember=true) OR SupAdmin=true) Then
         Response.Write "<Script Language=JavaScript>alert('对不起，没有权限修改日志！');javascript :history.back();</Script>"
         Response.End
      Else
         If Request.Form("message")=Empty OR Request.Form("elog_Title")=Empty Then
	    Response.Write "<Script Language=JavaScript>alert('对不起，日志标题和内容不能为空！');javascript :history.back();</Script>"
            Response.End
	 ElseIf Request.Form("blogdele")="1" Then
	    Conn.ExeCute("DELETE * FROM b_Content WHERE blog_ID="&eput_id)
	    Conn.ExeCute("DELETE * FROM b_review WHERE blog_ID="&eput_id)
	    Response.Write "<Script Language=JavaScript>alert('日志日志及相关评论删除成功！');this.top.location.href='blog.asp';</Script>"
            Response.End		
	 Else
	 dim eblog_Title,eblog_Content,eblog_From,eblog_FromURL,eblog_ID,eblog_Intro,eblog_DisSM,eblog_DisUBB,eblog_DisIMG,eblog_AutoURL,eblog_Modify,eblog_IsShow,eblog_AutoKEY,eblog_IsTop,eblog_DisComment,eblog_Weather,eblog_tags,eblog_isbest
				eblog_Title=CheckStr(Request.Form("elog_Title"))
                                eblog_CateID=Request.Form("elog_CateID")
				eblog_Content=CheckStr(Request.Form("message"))
				If InStr(eblog_Content,"[#seperator#]")>0 Then
					eblog_Intro=HTMLEncode(Left(eblog_Content,InStr(eblog_Content,"[#seperator#]")-1))
				Else
					eblog_Intro=SplitLines(HTMLEncode(eblog_Content),4)
				End If
				eblog_From=CheckStr(Request.Form("elog_From"))
				eblog_FromURL=Request.Form("elog_FromURL")
				eblog_ID=eput_id
				eblog_DisSM=Request.Form("elog_DisSM")
				eblog_DisUBB=Request.Form("elog_DisUBB")
				eblog_DisIMG=Request.Form("elog_DisIMG")
				eblog_AutoURL=Request.Form("elog_AutoURL")
				eblog_AutoKEY=Request.Form("elog_AutoKEY")
				eblog_Weather=Request.Form("elog_Weather")
				eblog_tags=Request.Form("elog_tags")
				IF Request.Form("elog_IsTop")="1" Then
					eblog_IsTop=True
				Else
					eblog_IsTop=False
				End IF
				If Request.Form("elog_isbest")="1" Then
					eblog_isbest=True
				Else
					eblog_isbest=False
				End IF
				IF Request.Form("elog_IsShow")="0" Then
					eblog_IsShow = True
				Else
					eblog_IsShow = False
				End IF
				If Request.Form("elog_DisComment")="1" Then
					eblog_DisComment=True
				Else
					eblog_DisComment=False
				End IF
                                IF eblog_DisSM=Empty Then eblog_DisSM=0
				IF eblog_DisUBB=Empty Then eblog_DisUBB=0
				IF eblog_DisIMG=Empty Then eblog_DisIMG=0
				IF eblog_AutoURL=Empty Then eblog_AutoURL=0
				IF eblog_AutoKEY=Empty Then eblog_AutoKEY=0
				eblog_Modify="[本日志由"&Hx66_name&"于"&Now()&"编辑]"
				Conn.ExeCute("UPDATE b_Content Set blog_Title='"&eblog_Title&"',blog_CateID="&eblog_CateID&",blog_Intro='"&eblog_Intro&"',blog_Content='"&eblog_Content&"',blog_From='"&eblog_From&"',blog_FromURL='"&eblog_FromURL&"',blog_DisSM="&eblog_DisSM&",blog_DisUBB="&eblog_DisUBB&",blog_DisIMG="&eblog_DisIMG&",blog_AutoURL="&eblog_AutoURL&",blog_AutoKEY="&eblog_AutoKEY&",blog_isbest="&eblog_isbest&",blog_Modify='"&eblog_Modify&"',blog_IsShow="&eblog_IsShow&",blog_DisComment="&eblog_DisComment&",blog_Weather='"&eblog_Weather&"',blog_IsTop="&eblog_IsTop&" WHERE blog_ID="&eblog_ID&"")
				Dim tabs,ts,deltag
				Call EditTags(eblog_ID)
                                if trim(eblog_tags)<>empty then
				eblog_tags=Split(eblog_tags,"|")
				For tabs=0 to Ubound(eblog_tags)
				    Sql="Select TagName from b_tags where TagName='"&eblog_tags(tabs)&"'"
					Set ts=Server.CreateObject("Adodb.Recordset")
					ts.Open sql,conn,1,1
					IF ts.Eof AND ts.Bof Then
					   conn.execute ("Insert Into b_tags(TagName) Values('"&eblog_tags(tabs)&"')")
					Else 
					   conn.Execute ("Update b_tags Set TagBlogCount=TagBlogCount+1 where tagName='"&eblog_tags(tabs)&"'")
					End If
                                        conn.Execute ("Insert Into b_tag(blogID,tagsName) Values("&eblog_ID&",'"&eblog_tags(tabs)&"')")
					ts.Close
				    Set ts=Nothing
				Next
				End IF
                                rs_eput.Close
                                Set rs_eput=Nothing
                  Response.Write "<Script Language=JavaScript>alert('修改日志成功！');this.top.location.href='showblog.asp?blog_id="&eblog_ID&"';</Script>"
                  Response.End
	 End If
      End If
   End If
End IF
end sub

sub blog_putedit()
Dim blog_ID
blog_ID=Trim(Request.QueryString("blogID"))
If IsInteger(blog_ID)=False Then
   Response.Write "<Script Language=JavaScript>alert('对不起，参数非法错误！');javascript :history.back();</Script>"
   Response.End
Else
  Dim blog_Edit
  Set blog_Edit=Server.CreateObject("ADODB.Recordset")
  SQL="SELECT H.*,C.cate_Name FROM b_Content AS H,b_cat AS C WHERE blog_ID="&blog_ID&" AND C.cate_ID=H.blog_cateID"
  blog_Edit.Open SQL,Conn,1,1
  If blog_Edit.EOF AND blog_Edit.BOF Then
     Response.Write "<Script Language=JavaScript>alert('对不起，你要修改的日志不存在！');javascript :history.back();</Script>"
     Response.End
  Else
     IF Not((blog_Edit("blog_Author")=Hx66_name AND checkmember=true) OR SupAdmin=true) Then
        Response.Write "<Script Language=JavaScript>alert('对不起，你没有编辑日志权限！');javascript :history.back();</Script>"
        Response.End
     Else
Dim e_blogWeather
e_blogWeather=blog_Edit("blog_Weather")
%>
<script language="JavaScript" src="inc/ubbcode.js"></script>
<table bgcolor="#ffffff" borderColor="#f0f0f0" Border="1" Cellspacing="0" Cellpadding="5" width="98%" align="Center" style="border-collapse: collapse">
<form name="FrontPage_Form1" method="post" action="blog.asp?action=editblog" id="bnews">
   <tr>
      <td width="12%" align="right">标题：</td>
      <td width="88%"><input name="elog_Title" type="text" id="elog_Title" size="50" class="input" value="<%=EditDeHTML(blog_Edit("blog_Title"))%>">&nbsp;
        <select name="elog_Weather" id="elog_Weather" onChange="document.images['show_Weather'].src='img/blog/'+options[selectedIndex].value.split('|')[0]+'.gif';" size="1" class="input">
          <option value="0|未知" <%If e_blogWeather="0|未知" Then Response.Write("selected")%>>天气</option>
          <option value="1|晴天" <%If e_blogWeather="1|晴天" Then Response.Write("selected")%>>晴天</option>
          <option value="2|多云" <%If e_blogWeather="2|多云" Then Response.Write("selected")%>>多云</option>
          <option value="3|雨天" <%If e_blogWeather="3|雨天" Then Response.Write("selected")%>>雨天</option>
          <option value="4|刮风" <%If e_blogWeather="4|刮风" Then Response.Write("selected")%>>刮风</option>
          <option value="5|雪天" <%If e_blogWeather="5|雪天" Then Response.Write("selected")%>>雪天</option>
          <option value="6|彩虹" <%If e_blogWeather="6|彩虹" Then Response.Write("selected")%>>彩虹</option>
          <option value="7|露水" <%If e_blogWeather="7|露水" Then Response.Write("selected")%>>露水</option>
        </select>&nbsp;<img id="show_Weather" src="img/blog/0.gif" align="absmiddle"> </td>
   </tr>
   <tr>
      <td align="right">分类：</td>
      <td><select name="elog_CateID" id="elog_CateID" class="input">
           <%Dim Cat_Nums,Cat_NumI
	     Cat_Nums=Ubound(Arr_Cat,2)
	     For Cat_NumI=0 To Cat_Nums%>
	       <option value="<%=Arr_Cat(0,Cat_NumI)%>" <%If blog_Edit("blog_CateID")=Arr_Cat(0,Cat_NumI)  Then Response.Write("selected")%>><%=Arr_Cat(1,Cat_NumI)%></option>
	     <%Next%></select>&nbsp;|&nbsp;<input name="blogdele" type="checkbox" id="blogdele" value="1">删除此日志</td>
   </tr>
   <tr>
      <td align="right">属性：</td>
      <td><input name="elog_IsShow" type="radio" value="0" <%IF blog_Edit("blog_IsShow")=True Then Response.Write("checked")%>>公开日志&nbsp;<input type="radio" name="elog_IsShow" value="1" <%IF blog_Edit("blog_IsShow")=False Then Response.Write("checked")%>>隐藏日志&nbsp;||&nbsp;<input name="elog_IsTop" type="checkbox" id="elog_IsTop" value="1" <%IF blog_Edit("blog_IsTop")=True Then Response.Write("checked")%>>置顶日志&nbsp;<input name="elog_IsBest" type="checkbox" id="elog_IsBest" value="1" <%IF blog_Edit("blog_IsBest")=True Then Response.Write("checked")%>>精华日志&nbsp;<input name="elog_DisComment" type="checkbox" id="elog_DisComment" value="1" <%IF blog_Edit("blog_DisComment")=True Then Response.Write("checked")%>>禁止评论</td>
   </tr>
   <tr>
      <td align="right">来源：</td>
      <td><input name="elog_From" type="text" id="elog_From" size="12" class="input" value="<%=HTMLEncode(blog_Edit("blog_From"))%>">&nbsp;<b>地址：
          <input name="elog_FromURL" type="text" id="elog_FromURL" size="38" class="input" value="<%=HTMLEncode(blog_Edit("blog_FromURL"))%>"></td>
   </tr>
<script language=javascript>
function Hx_accept(addaccept)
{
  if (addaccept!="")
  { document.bnews.elog_Tags.value=addaccept; }
}
</script>
   <tr>
      <td align="right">TAGs：</td>
      <td><input name="elog_Tags" type="text" id="elog_Tags" size="30" class="input" value="<%=ShowTag(blog_Edit("blog_ID"),"Edit")%>">
         <% dim rs_key,sql_key
set rs_key=Server.CreateObject("ADODB.RecordSet")
sql_key="SELECT * FROM b_tags order by tagid desc"
rs_key.open sql_key,conn,1,1%>
<select name="rs_key" id="rs_key" onchange="javascript:Hx_accept(this.options[this.selectedIndex].value);" class="input">
 <%if rs_key.bof and rs_key.eof then
     response.Write("<option value='MBLOG'>没有TAGs</option>")
  else 
     response.Write (" <option value=''>选择已有TAG</option>")
  do Until rs_key.eof 
     response.Write (" <option value="&rs_key(1)&">"&rs_key(1)&"</option>")
  rs_key.movenext
  loop
  end if%></select> 多个Tag 用 | 分隔</td>
    </tr>
    <tr>
       <td align="right" valign="top">内容：</td>
        <td>
           <table width="98%" border="0" cellspacing="0" cellpadding="2">
             <tr>
               <td>
                 <input name="elog_DisSM" type="checkbox" id="elog_DisSM" value="1" <%IF blog_Edit("blog_DisSM")=1 Then Response.Write("checked")%>>禁止表情
                 <input name="elog_DisUBB" type="checkbox" id="elog_DisUBB" value="1" <%IF blog_Edit("blog_DisUBB")=1 Then Response.Write("checked")%>>禁止UBB
                 <input name="elog_DisIMG" type="checkbox" id="elog_DisIMG" value="1" <%IF blog_Edit("blog_DisIMG")=1 Then Response.Write("checked")%>>禁止图片
                 <input name="elog_AutoURL" type="checkbox" id="elog_AutoURL" value="1" <%IF blog_Edit("blog_AutoURL")=1 Then Response.Write("checked")%>>识别链接
                 <input name="elog_AutoKEY" type="checkbox" id="elog_AutoKEY" value="1" <%IF blog_Edit("blog_AutoKEY")=1 Then Response.Write("checked")%>>识别关键字</td>
             </tr>
             <tr>
                <td width="100%"><!--#include file="ubbget.asp" --></td>
             </tr>
           </table>
           <table width="98%" border="0" cellpadding="0" cellspacing="0">
             <tr valign="top">
                <td><textarea name="message" style="width:100%" rows="12" wrap="VIRTUAL" id="Content" onSelect="javascript: storeCaret(this);" onClick="javascript: storeCaret(this);" onKeyDown="javascript: ctlent();" onKeyUp="javascript: storeCaret(this);" class="input"><%=EditDeHTML(blog_Edit("blog_Content"))%></textarea></td>
             </tr>
           </table></td></tr>
                  <tr>
                    <td align="right">表情：<img alt='点击弹开所有表情图' onclick='opencat(Emot_open)' style='CURSOR: hand' src='img/info.gif' hspace='0' align='absmiddle'></td>
                    <td width="500" id='Emot_open' style='display: none' bgcolor="#FFFFFF">
                       <%Dim emot_Nums,emot_i
			emot_Nums=Ubound(Arr_Emot,2)
			TempVar=""
			For emot_i=0 To emot_Nums
				Response.Write(TempVar&"<img style=""cursor:hand;"" onclick=""AddText('"&Arr_Emot(2,emot_i)&"');"" src=""img/blog/Emot/"&Arr_Emot(1,emot_i)&""">")
				TempVar=" "
			Next%></td>
                  </tr>
                  <tr>
                    <td align="right">附件：</td>
                    <td><iframe border="0" frameBorder="0" frameSpacing="0" height="23" marginHeight="0" marginWidth="0" noResize scrolling="no" width="100%" vspale="0" src="blog_upload.asp"></iframe></td>
                  </tr>
                  <tr align="center">
                    <td colspan="2">
                     <input name="eblog_ID" type="hidden" id="eblog_ID" value="<%=blog_Edit("blog_ID")%>">
                     <input name="editBlog" type="hidden" value="ok">
                     <input name="topicsubmit" type="submit" value="确定编辑" onClick="this.disabled=true;document.bnews.submit();" class="input">&nbsp;
                     <input name="Reset" type="reset" id="Reset" value="重置编辑" class="input"> [可按 Ctrl+Enter 发布] </td>
                  </tr>
               </form>
          </table>
      <BR><%
          blog_Edit.Close
          Set blog_Edit=Nothing
       End IF
   End IF
End IF
end sub
sub blog_comm()
Dim blog_ID,Guest_IP,blog_Code
Guest_IP=Replace(Request.ServerVariables("HTTP_X_FORWARDED_FOR"),"'","")
If Guest_IP=Empty Then Guest_IP=Replace(Request.ServerVariables("REMOTE_ADDR"),"'","")
blog_ID=Request.Form("blog_ID")
server_v1=Cstr(Request.ServerVariables("HTTP_REFERER"))
server_v2=Cstr(Request.ServerVariables("SERVER_NAME"))
if mid(server_v1,8,len(server_v2))<>server_v2 then
Response.Write("<script language=javascript>alert('你提交的路径有误，禁止从站点外部提交数据请不要乱改参数！');this.location.href='http://vip138.com';</script>") 
response.end
end if
hx_Inf = split(hx_In,"|")
If Request.Form<>"" Then
	For Each hx_Post In Request.Form
		For hx_Xh=0 To Ubound(hx_Inf)
			If Instr(LCase(Request.Form(hx_Post)),hx_Inf(hx_Xh))<>0 Then
				Response.Write "<Script Language=JavaScript>alert('对不起，你发表的内容中包含系统禁止字符！');javascript :history.back();</Script>"
				Response.End
			End If
		Next
	Next
End If
IF Request("blog_Code")=Empty or IsInteger(Request("blog_Code"))=False Then 
     blog_Code=0
else
     blog_Code=Request("blog_Code")
End IF
IF int(blog_Code)<>int(Session("GetCode")) then
     Response.Write("<script language=javascript>alert('请输入正确的认证码！');javascript :history.back();</script>") 
     Response.End 
End If
IF IsInteger(blog_ID)=False or blog_ID=Empty or request.Form("PostBlogc")<>"ok" Then
     Response.Write "<Script Language=JavaScript>alert('对不起，请指定操作对象！');javascript :history.back();</Script>"
     Response.End
elseIF trim(Request.Form("message"))=Empty OR trim(Request.Form("comm_memName1"))=Empty Then
     Response.Write "<Script Language=JavaScript>alert('对不起，你的大名和评论内容不能为空！');javascript :history.back();</Script>"
     Response.End
elseIF Len(Request.Form("comm_memName1"))>12 OR Len(Request.Form("message"))>600 Then
     Response.Write "<Script Language=JavaScript>alert('对不起，你的大名大于12字符或评论内容大于600字符！');javascript :history.back();</Script>"
     Response.End
ElseIF DateDiff("n",Request.Cookies("HxBlog")("commPost"),Now())<2 Then
     Response.Write("<script language=javascript>alert('你发表评论速度太快了！');javascript :history.back();</script>") 
     Response.Cookies("HxBlog")("commpost")=Now()
     Response.End
Else
	Dim chk_Comm,IsOK
	Set chk_Comm=Conn.ExeCute("SELECT blog_DisComment,blog_IsShow FROM b_Content WHERE blog_ID="&clng(blog_ID))
	IF chk_Comm.EOF AND chk_Comm.BOF Then
		IsOK=1
	Else
		IF chk_Comm(0)=True OR chk_Comm(1)=False Then
			IsOK=2
		End IF
	End IF
        IF IsOK=1 Then
                Response.Write "<Script Language=JavaScript>alert('对不起，你所评论的日志不存在！');javascript :history.back();</Script>"
                Response.End
        ElseIF IsOK=2 Then
                Response.Write "<Script Language=JavaScript>alert('对不起，你所评论的日志不允许发表评论！');javascript :history.back();</Script>"
                Response.End
	Else
                Dim comm_Content,comm_memName,comm_memName1,comm_memName2,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_AutoKEY
	        comm_Content=CheckStr(Request.Form("message"))
	        comm_memName1=CheckStr(Request.Form("comm_memName1"))
                comm_memName2=CheckStr(Request.Form("comm_memName2"))
                IF comm_memName2<>Empty and comm_memName2=comm_memName1 Then
                    comm_memName=comm_memName2
                Else
                    comm_memName="[匿名]"&comm_memName1
                End IF
	        comm_DisSM=Request.Form("comm_DisSM")
	        comm_DisUBB=Request.Form("comm_DisUBB")
	        comm_DisIMG=Request.Form("comm_DisIMG")
	        comm_AutoURL=Request.Form("comm_AutoURL")
	        comm_AutoKEY=Request.Form("comm_AutoKEY")
	        IF comm_DisSM=Empty Then comm_DisSM=0
	        IF comm_DisUBB=Empty Then comm_DisUBB=0
	        IF comm_DisIMG=Empty Then comm_DisIMG=0
	        IF comm_AutoURL=Empty Then comm_AutoURL=0
	        IF comm_AutoKEY=Empty Then comm_AutoKEY=0
	        Conn.ExeCute("INSERT INTO b_review(blog_ID,comm_Content,comm_Author,comm_DisSM,comm_DisUBB,comm_DisIMG,comm_AutoURL,comm_AutoKEY,comm_PostIP) VALUES ("&blog_ID&",'"&comm_Content&"','"&comm_Memname&"',"&comm_DisSM&","&comm_DisUBB&","&comm_DisIMG&","&comm_AutoURL&","&comm_AutoKEY&",'"&Guest_IP&"')")
                Conn.ExeCute("UPDATE b_Content SET blog_CommNums=blog_CommNums+1 WHERE blog_ID="&clng(blog_ID))
                Response.Cookies("HxBlog")("commpost")=Now()
                Response.Write "<Script Language=JavaScript>alert('评论发表成功！');this.top.location.href='showblog.asp?blog_id="&blog_ID&"';</Script>"
                Response.End
        End IF
End IF
end sub
sub blog_delcomm()
IF IsInteger(Request.QueryString("commID"))=False OR IsInteger(Request.QueryString("blogID"))=False Then
    Response.Write "<Script Language=JavaScript>alert('对不起，参数非法错误！');javascript :history.back();</Script>"
    Response.End
Else
    Dim chk_Author,dele_commID,dele_blogID
    dele_commID=clng(Request.QueryString("commID"))
    dele_blogID=clng(Request.QueryString("blogID"))
    Set chk_Author=Conn.ExeCute("SELECT blog_Author FROM b_Content WHERE blog_ID="&dele_blogID)
    IF chk_Author.EOF AND chk_Author.BOF Then
	Response.Write "<Script Language=JavaScript>alert('对不起，参数非法错误！');javascript :history.back();</Script>"
        Response.End
    Else 
        IF Not (SupAdmin=true OR (checkmember=True And Hx66_name=chk_Author(0))) Then
              Response.Write "<Script Language=JavaScript>alert('对不起，你没有权限删除评论！');javascript :history.back();</Script>"
              Response.End
	Else
              Dim dele_Comm
	      Set dele_Comm=Conn.ExeCute("SELECT blog_ID,comm_Author FROM b_review WHERE comm_ID="&dele_commID)
	      IF dele_Comm.EOF AND dele_Comm.BOF Then
                  Response.Write "<Script Language=JavaScript>alert('对不起，没有找到指定评论！');javascript :history.back();</Script>"
                  Response.End
	      Else
                  Conn.Execute("DELETE * FROM b_review WHERE comm_ID="&dele_commID)
                  Conn.ExeCute("UPDATE b_Content SET blog_CommNums=blog_CommNums-1 WHERE blog_ID="&dele_blogID)
                  Response.Write "<Script Language=JavaScript>alert('删除评论成功！');this.top.location.href='showblog.asp?blog_id="&dele_blogID&"';</Script>"
                  Response.End
             End IF
        End IF
    End IF
End IF
end sub
%>