<!-- #Include File="../Include/Channel_Blog.asp" -->
<!-- #Include file="../Include/Cls_PageCute.asp" -->
<!-- #Include File="../Include/Cls_Search.asp" -->
<!-- #Include File="../Include/Inc_post.asp" -->
<!-- #Include File="../Editor/UBB/Editor.asp" -->
<!-- #Include File="Common.asp" -->
<% 
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

Call Channel_Load(0)

Dim BlogHtml:BlogHtml=""
    IsMaster = True
Select Case action
Case "write1"
  tit="签写日志"
Case "edit1"
  tit="编缉日志"
Case "write2"
  tit="添加照片"
Case "edit2"
  tit="编缉照片"
Case "sort"
  tit="编缉分类"
Case "adn1"
  tit="管理日志"
Case "adn2"
  tit="管理相册"
Case "handle"
  tit="管理"
Case "adn"
  tit="信息修改"
Case "adns"
  tit="选择模板"  
Case "adnc1","adnc2"
  tit="分类设置" 
Case "adnl"
  tit="友情链接设置"  
Case "adnse"
  tit="模板修改" 
Case "pl"
  tit="评论管理"   
Case "adng","chk_gbook","greply"
  tit="留言管理"   
Case "del_tags"
  tit="删除TAGS"
Case "article_tags"
  tit="日志TAGS"
Case "photo_tags"
  tit="图片TAGS"
Case "noblog"
  tit="没有注册"
Case "count"
  tit="博客信息统计"
Case "reg"
  tit="注册新的博客"
Case else
  tit="管理首页"
end Select
Call DoWebHead(2,1)

sql="Select id,hidden from AsaiMHBlog where username='"&login_username&"'"
dim rs_noblog
set rs_noblog=cls.exec(sql,1)
if rs_noblog.eof then
    if action="reg" then
        Call Blog_Reg() 
    else
        Call No_Blog() 
    end if
    rs_noblog.close
    set rs_noblog=nothing
else
    hidden=rs_noblog(1)
    if hidden=False then Call Cls.Out_Msg("您已经成功申请博客！请等待管理审核通过！\n\n点击返回上一页……","javascript:history.go(-1);")
    rs_noblog.close
    set rs_noblog=nothing
    Call Blog_Load(login_username)
'-----------------------------------------------------------------
Select Case action
Case "write1"
  Call Article_Write()
Case "edit1"
  Call Article_Edit()
Case "article_tags"
  Call Article_Tags()
Case "write2"
  Call Photo_Write()
Case "edit2"
  Call Photo_Edit()
Case "photo_tags"
  Call Photo_Tags()
Case "del_tags"
  Call Del_Tags()
Case "adn"
  Call BlogEdit()
Case "adns"
  Call SkinEdit()
Case "adnse"
  Call Skin_Edit()
Case "adng"
  Call Adn_Gbook()
Case "adnc1"
  Call ClassEdit(1)
Case "adnc2"
  Call ClassEdit(2)
Case "adnl"
  Call LinksEdit()
Case "adn1"
  Call Adn1()
Case "adn2"
  Call Adn2()
Case "count"
  Call BlogCount()
Case "handle"
  Call Chk_Handle()
Case "chk_gbook"
  Call Chk_Gbook()
Case "greply"
  Call GbookReply()
Case else
  Call Index_Blog()
end Select
end if

'输出页面
Cls.ReadPage "user"
Cls.HtmlRcod "user_main",BlogHtml
Cls.HtmlRcod "tit",tit
Cls.HtmlRcod "tit_dir",tit
Cls.HtmlRcod "img",cls.img("b_")&" "
Cls.HtmlRcod "blogurl",Cls.Web_Dir&"Blog/?"&login_username
Cls.HtmlRcod "ChannelID",ChannelIDs
Cls.HtmlRcod "ChannelTit",Cls.ChannelTit
Cls.HtmlRcod "ChannelDir",Cls.ChannelDir
Cls.HtmlRcod "ChannelName",Cls.ChannelName
Cls.HtmlRcod "ChannelUnit",Cls.ChannelUnit
Cls.OutPage
Call DoWebEnd()
'----------------------------------------------------
Sub Index_Blog()
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center' height=320>"
BlogHtml=BlogHtml&"<tr><td class=td colspan=2>&nbsp;欢迎进入博客管理</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td  height=60>"
BlogHtml=BlogHtml&"<font class=blue>◎ 欢迎光临</font><br /><br />"
BlogHtml=BlogHtml&"使用各项功能前请仔细阅读相关页面的说明<br />操作完成后记得退出管理，祝您使用愉快！ "
BlogHtml=BlogHtml&"</td><td rowspan=5 width=240><img src=images/index.jpg></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td  height=60>"
BlogHtml=BlogHtml&"<font class=blue>◎ 使用小帖士</font> <br /><br />"
BlogHtml=BlogHtml&"请随时关注您的个人博客，检查其中网友的评论的合法性  <br />"
BlogHtml=BlogHtml&"文章、相册均可进行预设分类操作，添加信息时可将相关信息归入对应的分类中，方便查找和游览  <br />"
BlogHtml=BlogHtml&"发表信息时，可以设置信息的标签，这样有利于读者的检索  <br />"
BlogHtml=BlogHtml&"当你不想不想让别人访问你的博客时你可以关闭它 <br />"
BlogHtml=BlogHtml&"</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td  height=60>"
BlogHtml=BlogHtml&"<font class=blue>◎ 亲切提醒</font> <br /><br />"
BlogHtml=BlogHtml&"请注意文明、坦诚、平等交流，对事不对人，尊重别人看法，哪怕有不全面的地方 <br />"
BlogHtml=BlogHtml&"</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td  height=60>"
BlogHtml=BlogHtml&"<font class=blue>◎ 博客管理快车道</font> <br /><br />"
BlogHtml=BlogHtml&">><a href=?action=write1>发表日志</a>  >><a href=?action=write2>发表相片</a>  >><a href=?action=adn>博客设置</a>  >><a href=?action=adng>留言管理</a> <br />"
BlogHtml=BlogHtml&"</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td  height=60>"
BlogHtml=BlogHtml&"<font class=blue>◎ 数据更新</font> <br /><br />"
BlogHtml=BlogHtml&"<a href=?action=count title='注:一般情况不用操作,当博客确实统计存在错误时,才使用此功能!'><b>点击这里</b></a> 开始更新你的博客数据!<br />"
BlogHtml=BlogHtml&"</td></tr>"
BlogHtml=BlogHtml&"</table>"
End Sub

Function user_top()
dim blogtophtml
blogtophtml=""
blogtophtml=blogtophtml&vbcrlf&"<table width='100%'  border='0' cellspacing='1' cellpadding='4' class=table>"
blogtophtml=blogtophtml&vbcrlf&"  <tr>"
blogtophtml=blogtophtml&vbcrlf&"  <td colspan='7' class=td>&nbsp;管理菜单</td>"
blogtophtml=blogtophtml&vbcrlf&"  </tr><tr class=tr><td>"
blogtophtml=blogtophtml&vbcrlf&"  <table width=400  border='0' cellspacing='1' cellpadding='4' >"
blogtophtml=blogtophtml&vbcrlf&"  <tr>"
blogtophtml=blogtophtml&vbcrlf&"    <td><a href=?action=write1><img src='../blog/images/user/ico_5.gif' border=0></img></a></td>"
blogtophtml=blogtophtml&vbcrlf&"    <td><a href=?action=write2><img src='../blog/images/user/ico_7.gif' border=0></img></a></td>"
blogtophtml=blogtophtml&vbcrlf&"    <td><a href=?action=manage><img src='../blog/images/user/ico_4.gif' border=0></img></a></td>"
blogtophtml=blogtophtml&vbcrlf&"    <td><img src='../blog/images/user/ico_3.gif' border=0></img></td>"
blogtophtml=blogtophtml&vbcrlf&"    <td><img src='../blog/images/user/ico_2.gif' border=0></img></td>"
blogtophtml=blogtophtml&vbcrlf&"    <td><img src='../blog/images/user/ico_1.gif' border=0></img></td>"
blogtophtml=blogtophtml&vbcrlf&"    <td><a href='../'><img src='../blog/images/user/ico_6.gif' border=0></img></a></td>"
blogtophtml=blogtophtml&vbcrlf&"	  </tr>"
blogtophtml=blogtophtml&vbcrlf&"</table>"
blogtophtml=blogtophtml&vbcrlf&"</td>"
blogtophtml=blogtophtml&vbcrlf&"  </tr>"
blogtophtml=blogtophtml&vbcrlf&"</table>"
user_top=blogtophtml
end Function

sub Article_Write()
  dim found_err,c_id,drauthor,drtopic,dricon,drword,drhidden,drweather,drtim,drtags,drcod
  if cls.chk() then
    drtopic=trim(request.form("wrtopic"))
	c_id=Cls.ChkNumeric(request.form("c_id"))
	drtags=trim(request.form("wrtags"))
    drtags=key_tags2(drtags)
	drauthor=trim(request.form("author"))
    drweather=Cls.ChkNumeric(request.form("weather"))
    dricon=Cls.ChkNumeric(request.form("icon"))
    drword=request.form("wrword")
    drhidden=trim(request.form("wrhidden"))
'-------保存日志--------------------------------------
    found_err=""
    if drtopic="" or isnull(drtopic) then
      found_err=found_err & "+日志的 <font class=red>主题</font> 是必需要的！请输入。<br />"
    end if
    if drword="" or isnull(drword) then
      found_err=found_err & "+日志的 <font class=red>内容</font> 是必需要的！请输入。<br />"
    end if
    if len(drword)>15000 then
      found_err=found_err & "+日志的 <font class=red>内容</font> 不能大于15000字。<br />"
    end if
    if found_err<>"" then
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
    sql="Select * from AsaiMHblogdata where (id is null)"
    Call cls.exec("",-1)
    rs.open sql,conn,1,3
    rs.addnew
	rs("cid")=c_id
	rs("count")=0
	rs("type")=1
	rs("username")=login_username
	rs("tags")=drtags
	rs("weather")=drweather
	rs("icon")=dricon
	rs("topic")=drtopic
	rs("pic")=""
	rs("word")=drword
	rs("author")=drauthor
	rs("year")=year(date)
	rs("month")=month(date)
	rs("day")=day(date)
	rs("tim")=now()
	rs("reply")=0
    if drhidden="yes" then
      rs("hidden")=true
    else
      rs("hidden")=false
    end if
    rs.update
    rs.close
	Call key_tags(drtags,"AsaiMHblogtags",1,1)  
	if drhidden="yes" then
	Call cls.exec("update AsaiMHblog set count1=count1+1 where id="&b_id,0)
	if c_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count+1 where id="&c_id,0)
	end if
BlogHtml=BlogHtml&vbcrlf&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td class=td>&nbsp;→日志发表成功</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&vbcrlf&"<font class=red>恭喜！你的日志已经成功保存!</font><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"<a href='?action=adn1'>返回日志管理页面</a><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adn1'>"
BlogHtml=BlogHtml&vbcrlf&"</td></tr></table>"
    exit sub
end if
BlogHtml=BlogHtml&cls.js_put(Cls.web_dir&"Blog/Images/key.js",0)
BlogHtml=BlogHtml&vbcrlf&"<table cellpadding='4' cellspacing='1' width='100%'  class=table>"
BlogHtml=BlogHtml&vbcrlf&"<form name=write_frm action='User.asp?action=write1' method=post onsubmit='return checkBlogPost();'>"
BlogHtml=BlogHtml&vbcrlf&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td height=23 class=td colspan=2>签写日志</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80>日志主题：</td><td><input type=text name=wrtopic value='' size=60 maxlength=50></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80 class=reply_t2>日志分类：</td><td>"&chk_class("AsaiMHBlogSort",1,0)&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>日志标签：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=wrtags value='' size=30 maxlength=100>&nbsp;请用空格隔开，如：计算所 CMS "
BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onClick=""if(document.getElementById('ulTag').style.display=='none'){document.getElementById('ulTag').style.display='block';}else{document.getElementById('ulTag').style.display='none'};""><font color=#0000FF></font><font color=#0000FF>&lt;已用Tags&gt;</font></span>"
BlogHtml=BlogHtml&vbcrlf&"<div id=""ulTag"" style=""display:none;"">"
dim sqltag,rstag
sqltag="Select Tags from AsaiMHblogtags where username='"&login_username&"' and type=1 group by Tags"
   set rstag=cls.exec(sqltag,1)
     while not rstag.Eof
      	BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onclick='AddKey("""&RStag("tags")&""")' /><font color=Gys>"&RStag("tags")&"</font>&nbsp;</span>"
          rstag.MoveNext
     wend
     BlogHtml=BlogHtml&vbcrlf&"</div>"
   rstag.close
BlogHtml=BlogHtml&vbcrlf&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr><td>文章作者：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=author value='"&login_username&"' size=30 maxlength=20></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>今日天气：</td><td>"&show_weather(3)&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>我的心情： </td><td>"&show_face(1)&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&ShowUBBEditor("10","write_frm","wrword","日志内容","","default",555,250)
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>上传图片： </td><td><iframe id=UploadFiles width='98%' height=30 frameborder=0 scrolling=no src='"&Cls.Web_Dir&"Include/Upload.asp?ID="&ChannelIDs&"&Type=4&Obj=wrword'></iframe></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr>"
BlogHtml=BlogHtml&vbcrlf&"<td>是否公开：</td><td><input type=radio name=wrhidden value='yes' checked >公开<input type=radio name=wrhidden value='no'>私人</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=trb><td colspan=3 align=center ><input type=submit class=btn name=wsubmit value=' 确认提交 '>　　<input type=reset class=btn value=' 表单重置 ' onClick='return reset()'></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"</form></table>"
end sub

sub Article_Edit()
  dim found_err,id,c_id,oc_id,drauthor,drtopic,dricon,drword,drhidden,ohidden,drweather,drtim,drtags,drcod
      id=trim(request.querystring("id"))
      if not(isnumeric(id)) then
         Call format_redirect("?action=adn1")
       end if 
  sql="Select top 1 * from AsaiMHblogdata where type=1 and username='"&login_username&"' and id="&id
  Call cls.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>你要编辑的日志不存在或没有权限!</td></tr></table>"
    exit sub
  end if
  if cls.chk() then
    drtopic=trim(request.form("wrtopic"))
	c_id=Cls.ChkNumeric(request.form("c_id"))
	drtags=trim(request.form("wrtags"))
    drtags=key_tags2(drtags)
	drauthor=trim(request.form("author"))
    drweather=Cls.ChkNumeric(request.form("weather"))
    dricon=Cls.ChkNumeric(request.form("icon"))
    drword=request.form("wrword")
    drhidden=trim(request.form("wrhidden"))
'-------保存日志--------------------------------------
    found_err=""
    if drtopic="" or isnull(drtopic) then
      found_err=found_err & "+日志的 <font class=red>主题</font> 是必需要的！请输入。<br />"
    end if
    if drword="" or isnull(drword) then
      found_err=found_err & "+日志的 <font class=red>内容</font> 是必需要的！请输入。<br />"
    end if
    if len(drword)>15000 then
      found_err=found_err & "+日志的 <font class=red>内容</font> 不能大于15000字。<br />"
    end if
    if found_err<>"" then
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
	oc_id=rs("cid")
	rs("cid")=c_id
	rs("tags")=drtags
    rs("weather")=drweather
    rs("icon")=dricon
    rs("topic")=drtopic
	rs("pic")=""
    rs("word")=drword
    rs("author")=drauthor
	if rs("hidden")=true then
	   ohidden="yes"
	else
	   ohidden="no"
	end if
    if drhidden="yes" then
      rs("hidden")=true
    else
      rs("hidden")=false
    end if
    rs.update
    rs.close
	Call key_tags(drtags,"AsaiMHblogtags",1,2)
	if ohidden=drhidden then
       if c_id<>oc_id and drhidden="yes" then
	      if c_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count+1 where id="&c_id,0)
	      if oc_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count-1 where id="&oc_id,0)
	   end if
	else
	   if ohidden="yes" then 
	      Call cls.exec("update AsaiMHblog set count1=count1-1 where id="&b_id,0)
	      if oc_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count-1 where id="&oc_id,0)
	   else
	      Call cls.exec("update AsaiMHblog set count1=count1+1 where id="&b_id,0)
	      if c_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count+1 where id="&c_id,0)
	   end if
	end if
BlogHtml=BlogHtml&vbcrlf&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td class=td>&nbsp;→日志修改成功</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&vbcrlf&"<font class=red>恭喜！你的日志已经成功修改!</font><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"<a href='?action=adn1'>返回日志管理页面</a><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adn1'>"
BlogHtml=BlogHtml&vbcrlf&"</td></tr></table>"
    exit sub
end if
BlogHtml=BlogHtml&cls.js_put(Cls.web_dir&"Blog/Images/key.js",0)
BlogHtml=BlogHtml&vbcrlf&"<table cellpadding='4' cellspacing='1' width='100%'  class=table>"
BlogHtml=BlogHtml&vbcrlf&"<form name=write_frm action='User.asp?action=edit1&id="&id&"' method=post onsubmit='return checkBlogPost();'>"
BlogHtml=BlogHtml&vbcrlf&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td height=23 class=td colspan=2>修改日志</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80>日志主题：</td><td><input type=text name=wrtopic value='"&Replace(rs("topic"),"'","’")&"' size=60 maxlength=50></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80 class=reply_t2>日志分类：</td><td>"&chk_class("AsaiMHBlogSort",1,rs("cid"))&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>日志标签：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=wrtags value='"&Replace(rs("tags"),"'","’")&"' size=30 maxlength=100>&nbsp;请用空格隔开，如：计算所 CMS "
BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onClick=""if(document.getElementById('ulTag').style.display=='none'){document.getElementById('ulTag').style.display='block';}else{document.getElementById('ulTag').style.display='none'};""><font color=#0000FF></font><font color=#0000FF>&lt;已用Tags&gt;</font></span>"
BlogHtml=BlogHtml&vbcrlf&"<div id=""ulTag"" style=""display:none;"">"
dim sqltag,rstag
sqltag="Select Tags from AsaiMHblogtags where username='"&login_username&"' and type=1 group by Tags"
   set rstag=cls.exec(sqltag,1)
     while not rstag.Eof
      	BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onclick='AddKey("""&RStag("tags")&""")' /><font color=Gys>"&RStag("tags")&"</font>&nbsp;</span>"
          rstag.MoveNext
     wend
     BlogHtml=BlogHtml&vbcrlf&"</div>"
   rstag.close
BlogHtml=BlogHtml&vbcrlf&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr><td>文章作者：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=author value='"&rs("author")&"' size=30 maxlength=20></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>今日天气：</td><td>"&show_weather(rs("weather"))&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>我的心情： </td><td>"&show_face(rs("icon"))&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&ShowUBBEditor("10","write_frm","wrword","日志内容",rs("word"),"default",555,250)
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>上传图片： </td><td><iframe id=UploadFiles width='98%' height=30 frameborder=0 scrolling=no src='"&Cls.Web_Dir&"Include/Upload.asp?ID="&ChannelIDs&"&Type=4&Obj=wrword'></iframe></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr>"
BlogHtml=BlogHtml&vbcrlf&"<td>是否公开：</td><td><input type=radio name=wrhidden value='yes'" 
if rs("hidden")=true then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&">公开<input type=radio name=wrhidden value='no'"
if rs("hidden")=false then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&">私人</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=trb><td colspan=3 align=center ><input type=submit class=btn name=wsubmit value=' 确认提交 '>　　<input type=reset class=btn value=' 表单重置 ' onClick='return reset()'></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"</form></table>"
end sub

sub Photo_Write()
  dim found_err,c_id,drauthor,drtopic,drpic,dricon,drword,drhidden,drweather,drtim,drtags,drcod
  if cls.chk() then
    drtopic=trim(request.form("wrtopic"))
	c_id=Cls.ChkNumeric(request.form("c_id"))
	drtags=trim(request.form("wrtags"))
    drtags=key_tags2(drtags)
	drauthor=trim(request.form("author"))
    drweather=0
    dricon=0
	drpic=request.form("wrpic")
    drword=request.form("wrword")
    drhidden=trim(request.form("wrhidden"))
'-------保存相片--------------------------------------
    found_err=""
    if drtopic="" or isnull(drtopic) then
      found_err=found_err & "+相片的 <font class=red>主题</font> 是必需要的！请输入。<br />"
    end if
    if drpic="" or isnull(drpic) then
      found_err=found_err & "+相片的 <font class=red>地址</font> 是必需要的！请输入。<br />"
    end if		
    if drword="" or isnull(drword) then
      found_err=found_err & "+相片的 <font class=red>简介</font> 是必需要的！请输入。<br />"
    end if
    if len(drword)>2000 then
      found_err=found_err & "+相片的 <font class=red>简介</font> 不能大于2000字。<br />"
    end if
	if found_err<>"" then
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
    sql="Select * from AsaiMHblogdata where (id is null)"
    Call cls.exec("",-1)
    rs.open sql,conn,1,3
    rs.addnew
	rs("cid")=c_id
	rs("count")=0
	rs("type")=2
    rs("username")=login_username
	rs("tags")=drtags
    rs("weather")=drweather
    rs("icon")=dricon
    rs("topic")=drtopic
	rs("pic")=drpic	
    rs("word")=drword
    rs("author")=drauthor
	rs("year")=year(date)
	rs("month")=month(date)
	rs("day")=day(date)
	rs("tim")=now()
	rs("reply")=0
    if drhidden="yes" then
      rs("hidden")=true
    else
      rs("hidden")=false
    end if
    rs.update
    rs.close
	Call key_tags(drtags,"AsaiMHblogtags",2,1) 
	if drhidden="yes" then
	   Call cls.exec("update AsaiMHblog set count2=count2+1 where id="&b_id,0)
	   if c_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count+1 where id="&c_id,0)
	end if
BlogHtml=BlogHtml&vbcrlf&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td class=td>&nbsp;→相片发表成功</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&vbcrlf&"<font class=red>恭喜！你的相片已经成功保存!</font><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"<a href='?action=adn2'>返回相片管理页面</a><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adn2'>"
BlogHtml=BlogHtml&vbcrlf&"</td></tr></table>"
    exit sub
end if
BlogHtml=BlogHtml&cls.js_put(Cls.web_dir&"Blog/Images/key.js",0)
BlogHtml=BlogHtml&vbcrlf&"<table cellpadding='4' cellspacing='1' width='100%'  class=table>"
BlogHtml=BlogHtml&vbcrlf&"<form name=write_frm action='User.asp?action=write2' method=post onsubmit='return checkBlogPost();'>"
BlogHtml=BlogHtml&vbcrlf&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td height=23 class=td colspan=2>发布相片</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80>相片主题：</td><td><input type=text name=wrtopic value='' size=60 maxlength=50></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80 class=reply_t2>相片分类：</td><td>"&chk_class("AsaiMHBlogSort",2,0)&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>相片标签：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=wrtags value='' size=30 maxlength=100>&nbsp;请用空格隔开，如：计算所 CMS "
BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onClick=""if(document.getElementById('ulTag').style.display=='none'){document.getElementById('ulTag').style.display='block';}else{document.getElementById('ulTag').style.display='none'};""><font color=#0000FF></font><font color=#0000FF>&lt;已用Tags&gt;</font></span>"
BlogHtml=BlogHtml&vbcrlf&"<div id=""ulTag"" style=""display:none;"">"
dim sqltag,rstag
sqltag="Select Tags from AsaiMHblogtags where username='"&login_username&"' and type=2 group by Tags"
   set rstag=cls.exec(sqltag,1)
     while not rstag.Eof
      	BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onclick='AddKey("""&RStag("tags")&""")' /><font color=Gys>"&RStag("tags")&"</font>&nbsp;</span>"
          rstag.MoveNext
     wend
     BlogHtml=BlogHtml&vbcrlf&"</div>"
   rstag.close
BlogHtml=BlogHtml&vbcrlf&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr><td>相片作者：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=author value='"&login_username&"' size=30 maxlength=20></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>相片地址：</td><td><input type=text name=wrpic value='' size=60></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>上传相片： </td><td><iframe id=UploadFiles1 width='98%' height=30 frameborder=0 scrolling=no src='"&Cls.Web_Dir&"Include/Upload.asp?ID="&ChannelIDs&"&Type=0&Obj=wrpic'></iframe></td></tr>"
BlogHtml=BlogHtml&vbcrlf&ShowUBBEditor("10","write_frm","wrword","相片简介","","default",555,250)
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr>"
BlogHtml=BlogHtml&vbcrlf&"<td>是否公开：</td><td><input type=radio name=wrhidden value='yes' checked >公开<input type=radio name=wrhidden value='no'>私人</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=trb><td colspan=3 align=center ><input type=submit class=btn name=wsubmit value=' 确认提交 '>　　<input type=reset class=btn value=' 表单重置 ' onClick='return reset()'></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"</form></table>"
end sub

sub Photo_Edit()
  dim found_err,id,c_id,oc_id,drauthor,drtopic,drpic,dricon,drword,drhidden,ohidden,drweather,drtim,drtags,drcod
      id=trim(request.querystring("id"))
      if not(isnumeric(id)) then
         Call format_redirect("?action=adn2")
       end if 
  sql="Select top 1 * from AsaiMHblogdata where type=2 and username='"&login_username&"' and id="&id
  Call cls.exec(sql,-1)
  rs.open sql,conn,1,3
  if rs.eof then
    rs.close
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>你要编辑的相片不存在!</td></tr></table>"
    exit sub
  end if
  if cls.chk() then
    drtopic=trim(request.form("wrtopic"))
	c_id=Cls.ChkNumeric(request.form("c_id"))
	drtags=trim(request.form("wrtags"))
    drtags=key_tags2(drtags)
	drauthor=trim(request.form("author"))
    drweather=0
    dricon=0
	drpic=request.form("wrpic")	
    drword=request.form("wrword")
    drhidden=trim(request.form("wrhidden"))
'-------保存相片--------------------------------------
    found_err=""
    if drtopic="" or isnull(drtopic) then
      found_err=found_err & "+相片的 <font class=red>主题</font> 是必需要的！请输入。<br />"
    end if
    if drpic="" or isnull(drpic) then
      found_err=found_err & "+相片的 <font class=red>地址</font> 是必需要的！请输入。<br />"
    end if	
    if drword="" or isnull(drword) then
      found_err=found_err & "+相片的 <font class=red>内容</font> 是必需要的！请输入。<br />"
    end if
    if len(drword)>2000 then
      found_err=found_err & "+相片的 <font class=red>简介</font> 不能大于2000字。<br />"
    end if
    if found_err<>"" then
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
	oc_id=rs("cid")
	rs("cid")=c_id
	rs("tags")=drtags
    rs("weather")=drweather
    rs("icon")=dricon
    rs("topic")=drtopic
	rs("pic")=drpic
    rs("word")=drword
    rs("author")=drauthor
	if rs("hidden")=true then
	   ohidden="yes"
	else
	   ohidden="no"
	end if
    if drhidden="yes" then
      rs("hidden")=true
    else
      rs("hidden")=false
    end if
    rs.update
    rs.close
	Call key_tags(drtags,"AsaiMHblogtags",2,2)  
	if ohidden=drhidden then
       if c_id<>oc_id and drhidden="yes" then
	      if c_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count+1 where id="&c_id,0)
	      if oc_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count-1 where id="&oc_id,0)
	   end if
	else
	   if ohidden="yes" then 
	      Call cls.exec("update AsaiMHblog set count2=count2-1 where id="&b_id,0)
	      if oc_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count-1 where id="&oc_id,0)
	   else
	      Call cls.exec("update AsaiMHblog set count2=count2+1 where id="&b_id,0)
	      if c_id<>0 then Call cls.exec("update AsaiMHBlogSort set count=count+1 where id="&c_id,0)
	   end if
	end if
BlogHtml=BlogHtml&vbcrlf&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td class=td>&nbsp;→相片修改成功</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&vbcrlf&"<font class=red>恭喜！你的相片已经成功修改!</font><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"<a href='?action=adn2'>返回相片管理页面</a><br /><br />"
BlogHtml=BlogHtml&vbcrlf&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adn2'>"
BlogHtml=BlogHtml&vbcrlf&"</td></tr></table>"
    exit sub
end if
BlogHtml=BlogHtml&cls.js_put(Cls.web_dir&"Blog/Images/key.js",0)
BlogHtml=BlogHtml&vbcrlf&"<table cellpadding='4' cellspacing='1' width='100%'  class=table>"
BlogHtml=BlogHtml&vbcrlf&"<form name=write_frm action='User.asp?action=edit2&id="&id&"' method=post onsubmit='return checkBlogPost();'>"
BlogHtml=BlogHtml&vbcrlf&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&vbcrlf&"<tr><td height=23 class=td colspan=2>修改相片</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80>相片主题：</td><td><input type=text name=wrtopic value='"&Replace(rs("topic"),"'","’")&"' size=60 maxlength=50></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td width=80 class=reply_t2>相片分类：</td><td>"&chk_class("AsaiMHBlogSort",2,rs("cid"))&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>相片标签：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=wrtags value='"&Replace(rs("tags"),"'","’")&"' size=30 maxlength=100>&nbsp;请用空格隔开，如：计算所 CMS "
BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onClick=""if(document.getElementById('ulTag').style.display=='none'){document.getElementById('ulTag').style.display='block';}else{document.getElementById('ulTag').style.display='none'};""><font color=#0000FF></font><font color=#0000FF>&lt;已用Tags&gt;</font></span>"
BlogHtml=BlogHtml&vbcrlf&"<div id=""ulTag"" style=""display:none;"">"
dim sqltag,rstag
sqltag="Select Tags from AsaiMHblogtags where username='"&login_username&"' and type=2 group by Tags"
   set rstag=cls.exec(sqltag,1)
     while not rstag.Eof
      	BlogHtml=BlogHtml&vbcrlf&"<span style='cursor:pointer;' onclick='AddKey("""&RStag("tags")&""")' /><font color=Gys>"&RStag("tags")&"</font>&nbsp;</span>"
          rstag.MoveNext
     wend
     BlogHtml=BlogHtml&vbcrlf&"</div>"
   rstag.close
BlogHtml=BlogHtml&vbcrlf&"</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr><td>相片作者：</td>"
BlogHtml=BlogHtml&vbcrlf&"<td><input type=text name=author value='"&rs("author")&"' size=30 maxlength=20></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>相片地址：</td><td><input type=text name=wrpic value='"&Cls.Reword(rs("pic"))&"' size=60></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=tr><td>上传相片： </td><td><iframe id=UploadFiles1 width='98%' height=30 frameborder=0 scrolling=no src='"&Cls.Web_Dir&"Include/Upload.asp?ID="&ChannelIDs&"&Type=0&Obj=wrpic'></iframe></td></tr>"
BlogHtml=BlogHtml&vbcrlf&ShowUBBEditor("10","write_frm","wrword","相片内容",rs("word"),"default",555,250)
BlogHtml=BlogHtml&vbcrlf&"<tr height=25 class=tr>"
BlogHtml=BlogHtml&vbcrlf&"<td>是否公开：</td><td><input type=radio name=wrhidden value='yes'" 
if rs("hidden")=true then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&">公开<input type=radio name=wrhidden value='no'"
if rs("hidden")=false then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&">私人</td></tr>"
BlogHtml=BlogHtml&vbcrlf&"<tr height=30 class=trb><td colspan=3 align=center ><input type=submit class=btn name=wsubmit value=' 确认提交 '>　　<input type=reset class=btn value=' 表单重置 ' onClick='return reset()'></td></tr>"
BlogHtml=BlogHtml&vbcrlf&"</form></table>"
end sub

sub Adn1()
dim obj_page,id,c_id,d_name,topic,hidden,tim,weather
  set obj_page=New Cls_PageCute
  obj_page.nummer=15
  obj_page.page_tit="日志"
  obj_page.page_unit="篇"
  obj_page.v_id="id"
  obj_page.pageurl="?action=adn1&"
  Call obj_page.p_init("","[AsaiMHblogdata] ","type=1 and username='"&login_username&"'","")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
  if int(obj_page.rssum)<1 then
     BlogHtml = "<table cellpadding='4' cellspacing='1' class=table><tr><td class=td>没有日志</td></tr><tr class=tr height=150><td align=center >你暂时还没有写日志!</td></tr></table>"
  exit Sub
  end if
  Call obj_page.p_main("*","[AsaiMHblogdata] ","type=1 and username='"&login_username&"'","id desc")
BlogHtml=BlogHtml&cls.js_put(Cls.web_dir&"style/Select.js",0)
BlogHtml=BlogHtml&"<table cellpadding='4' cellspacing='1' class=table>"
BlogHtml=BlogHtml&"<form name=sel_form action='?action=handle&type=1' method=post>"
BlogHtml=BlogHtml&"<tr align=center>"
BlogHtml=BlogHtml&"<td class=td>ID</td>"
BlogHtml=BlogHtml&"<td class=td>主题</td>"
BlogHtml=BlogHtml&"<td class=td>时间</td>"
BlogHtml=BlogHtml&"<td class=td>天气</td>"
BlogHtml=BlogHtml&"<td class=td>公开</td>"
BlogHtml=BlogHtml&"<td class=td colspan=2>操作</td></tr>"
  for i=1 to obj_page.page_num
    id=rs("id")
	c_id=rs("cid")
    topic=rs("topic")
    tim=rs("tim")
    weather=rs("weather")
if rs("author")<>"" then
d_name=rs("author")
else
d_name=rs("username")
end if	
BlogHtml=BlogHtml&"<tr class=tr align=center><td>"&id&"</td>"
BlogHtml=BlogHtml&"<td align=left><a href='View/?"&id&"' target='_blank'><font alt='"&cls.code_html(topic,1,0)&"'>"&cls.code_html(topic,1,30)&"</font></a></td>"
BlogHtml=BlogHtml&"<td>"&Cls.Time_Type(tim,7)&"</td>"
BlogHtml=BlogHtml&"<td><img src="&cls.web_dir&"blog/Images/Weather/"&weather&".gif border=0></td>"
BlogHtml=BlogHtml&"<td>"
if rs("hidden")=true then
hidden="yes"
BlogHtml=BlogHtml&"<font color=blue><b alt=公开>√</b></font>"
else
hidden="no"
BlogHtml=BlogHtml&"<font color=red><b alt=不公开>×</b></font>"
end if
BlogHtml=BlogHtml&"</td>"
BlogHtml=BlogHtml&"<td><a href=?action=edit1&id="&id&" title=编缉此日志><img src="&cls.web_dir&"Blog/Images/Main/icon_edit.gif border=0  align=absmiddle>编辑</a></td><td><input type=checkbox name=sel_id value="&id&"|"&c_id&"|"&hidden&"></td>"
BlogHtml=BlogHtml&"</tr>"
    rs.movenext
  next
  rs.close
BlogHtml=BlogHtml&"<tr class=trp><td colspan=3><table border=0 cellspacing=0 cellpadding=1><tr><td>"&obj_page.page_var&"</td><td width=5></td><td>分页：</td><td>"&obj_page.page_cute&"</td><td width=5></td>"&obj_page.page_shortcut&"</tr></table></td>"
BlogHtml=BlogHtml&"<td colspan=3 align=center>执行<Select name=sel_type size=1><option value='公开'>公开日志</option><option value='取消公开'>取消公开</option><option value='删除'>删除日志</option></Select>"
BlogHtml=BlogHtml&"<input type=submit class=btn value='操作' onClick=""return sel_click(this.form);"">"
BlogHtml=BlogHtml&"</td><td align=center><input type=checkbox name=sel_all value='yes' onClick=""javascript:Select_all(this.form);""></td>"
BlogHtml=BlogHtml&"</tr></form></table>"
end sub

sub Adn2()
dim obj_page,id,c_id,d_name,topic,hidden,tim
  set obj_page=New Cls_PageCute
  obj_page.nummer=15
  obj_page.page_tit="相片"
  obj_page.page_unit="张"
  obj_page.v_id="id"
  obj_page.pageurl="?action=adn2&"
  Call obj_page.p_init("","[AsaiMHblogdata] ","type=2 and username='"&login_username&"'","")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
  if int(obj_page.rssum)<1 then
     BlogHtml = "<table cellpadding='4' cellspacing='1' class=table><tr><td class=td>没有相片</td></tr><tr class=tr height=150><td align=center >你暂时还没有发布相片!</td></tr></table>"
  exit Sub
  end if
  Call obj_page.p_main("*","[AsaiMHblogdata] ","type=2 and username='"&login_username&"'","id desc")
BlogHtml=BlogHtml&cls.js_put(Cls.web_dir&"style/Select.js",0)
BlogHtml=BlogHtml&"<table cellpadding='4' cellspacing='1' class=table>"
BlogHtml=BlogHtml&"<form name=sel_form action='?action=handle&type=2' method=post>"
BlogHtml=BlogHtml&"<tr align=center>"
BlogHtml=BlogHtml&"<td class=td>ID</td>"
BlogHtml=BlogHtml&"<td class=td>主题</td>"
BlogHtml=BlogHtml&"<td class=td>时间 </td>"
BlogHtml=BlogHtml&"<td class=td>公开</td>"
BlogHtml=BlogHtml&"<td class=td colspan=2>操作</td></tr>"
  for i=1 to obj_page.page_num
    id=rs("id")
	c_id=rs("cid")
    topic=rs("topic")
    tim=rs("tim")
if rs("author")<>"" then
d_name=rs("author")
else
d_name=rs("username")
end if	
BlogHtml=BlogHtml&"<tr class=tr align=center><td>"&id&"</td>"
BlogHtml=BlogHtml&"<td align=left><a href='View/?"&id&"' target='_blank'><font alt='"&cls.code_html(topic,1,0)&"'>"&cls.code_html(topic,1,30)&"</font></a></td>"
BlogHtml=BlogHtml&"<td>"&Cls.Time_Type(tim,7)&"</td>"
BlogHtml=BlogHtml&"<td>"
if rs("hidden")=true then
hidden="yes"
BlogHtml=BlogHtml&"<font color=blue><b alt=公开>√</b></font>"
else
hidden="no"
BlogHtml=BlogHtml&"<font color=red><b alt=不公开>×</b></font>"
end if
BlogHtml=BlogHtml&"</td>"
BlogHtml=BlogHtml&"<td><a href=?action=edit2&id="&id&" title=编缉此日志><img src="&cls.web_dir&"Blog/Images/Main/icon_edit.gif border=0  align=absmiddle>编辑</a></td><td><input type=checkbox name=sel_id value="&id&"|"&c_id&"|"&hidden&"></td>"
BlogHtml=BlogHtml&"</tr>"
    rs.movenext
  next
  rs.close
BlogHtml=BlogHtml&"<tr class=trp><td colspan=2><table border=0 cellspacing=0 cellpadding=1><tr><td>"&obj_page.page_var&"</td><td width=5></td><td>分页：</td><td>"&obj_page.page_cute&"</td><td width=5></td>"&obj_page.page_shortcut&"</tr></table></td>"
BlogHtml=BlogHtml&"<td colspan=3 align=center>执行<Select name=sel_type size=1><option value='公开'>公开相片</option><option value='取消公开'>取消公开</option><option value='删除'>删除相片</option></Select>"
BlogHtml=BlogHtml&"<input type=submit class=btn value='操作' onClick=""return sel_click(this.form);"">"
BlogHtml=BlogHtml&"</td><td align=center><input type=checkbox name=sel_all value='yes' onClick=""javascript:Select_all(this.form);""></td>"
BlogHtml=BlogHtml&"</tr></form></table>"
end sub

sub Adn_Gbook()
dim obj_page,id,c_id,d_name,topic,hidden,tim
  set obj_page=New Cls_PageCute
  obj_page.nummer=10
  obj_page.page_tit="留言"
  obj_page.page_unit="条"
  obj_page.v_id="id"
  obj_page.pageurl="?action=adng&"
  Call obj_page.p_init("","[AsaiMHblogbook] ","buser='"&login_username&"'","")
  sql=obj_page.sql_count
  set rs=Cls.exec(sql,1)
  obj_page.rssum=rs(0)
  rs.close
  if int(obj_page.rssum)<1 then
     BlogHtml = "<table cellpadding='4' cellspacing='1' class=table><tr><td class=td>没有留言</td></tr><tr class=tr height=150><td align=center >你的博客暂时还没有留言!</td></tr></table>"
  exit Sub
  end if
  Call obj_page.p_main("*","[AsaiMHblogbook] ","buser='"&login_username&"'","id desc")    
BlogHtml=BlogHtml&cls.js_put(Cls.web_dir&"style/Select.js",0)
BlogHtml=BlogHtml&"<table cellpadding='4' cellspacing='1' class=table>"
BlogHtml=BlogHtml&"<form name=sel_form action='?action=chk_gbook' method=post>"
BlogHtml=BlogHtml&"<tr align=center>"
BlogHtml=BlogHtml&"<td class=td>ID</td>"
BlogHtml=BlogHtml&"<td class=td>标题</td>"
BlogHtml=BlogHtml&"<td class=td>时间</td>"
BlogHtml=BlogHtml&"<td class=td>公开</td>"
BlogHtml=BlogHtml&"<td class=td colspan=2>操作</td></tr>"
  for i=1 to obj_page.page_num
    id=rs("id")
    topic=rs("topic")
    tim=rs("tim")
BlogHtml=BlogHtml&"<tr class=tr align=center><td>"&id&"</td>"
BlogHtml=BlogHtml&"<td align=left><a href='Gbook/?"&B_user&"' target='_blank'><font alt='"&cls.code_html(topic,1,0)&"'>"&cls.code_html(topic,1,30)&"</font></a></td>"
BlogHtml=BlogHtml&"<td>"&Cls.Time_Type(tim,7)&"</td>"
BlogHtml=BlogHtml&"<td>"
if rs("hidden")=true then
hidden="yes"
BlogHtml=BlogHtml&"<font color=blue><b alt=公开>√</b></font>"
else
hidden="no"
BlogHtml=BlogHtml&"<font color=red><b alt=不公开>×</b></font>"
end if
BlogHtml=BlogHtml&"</td>"
BlogHtml=BlogHtml&"<td><a href=?action=greply&id="&id&">回复留言</a> </td><td><input type=checkbox name=sel_id value="&id&"></td>"
BlogHtml=BlogHtml&"</tr>"
    rs.movenext
  next
  rs.close
BlogHtml=BlogHtml&"<tr class=trp><td colspan=2><table border=0 cellspacing=0 cellpadding=1><tr><td>"&obj_page.page_var&"</td><td width=5></td><td>分页：</td><td>"&obj_page.page_cute&"</td><td width=5></td>"&obj_page.page_shortcut&"</tr></table></td>"
BlogHtml=BlogHtml&"<td colspan=3 align=center>执行<Select name=sel_type size=1><option value='公开'>公开留言</option><option value='取消公开'>取消公开</option><option value='删除'>删除留言</option></Select>"
BlogHtml=BlogHtml&"<input type=submit class=btn value='操作' onClick=""return sel_click(this.form);"">"
BlogHtml=BlogHtml&"</td><td align=center><input type=checkbox name=sel_all value='yes' onClick=""javascript:Select_all(this.form);""></td>"
BlogHtml=BlogHtml&"</tr></form></table>"
end sub

sub GbookReply()
  dim id,found_err,drword,drhidden
    id=Cls.ChkNumeric(request.QueryString("id"))
      sql="Select * from AsaiMHblogbook where buser='"&login_username&"' and id="&id
    Call cls.exec("",-1)
    rs.open sql,conn,1,3
  if rs.eof then 
        BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>相关参数有误</td></tr></table>"
  exit sub
  end if
  if cls.chk() then
    drword=request.form("wrword")
    drhidden=trim(request.form("wrhidden"))
    found_err=""
    if drword="" or isnull(drword) or len(drword)>1000 then
      found_err=found_err & "+回复的 <font class=red>内容</font> 是必需要的！请输入(1-1000字)<br />"
      BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
		rs("reply")=drword
		if not rs("isreply") then rs("retim")=now()
		if drhidden="yes" then
		  rs("hidden")=true
		else
		  rs("hidden")=false
		end if
		rs("isreply")=true

		rs.update
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功回复留言</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！您已成功回复了这条留言!</font><br /><br />"
BlogHtml=BlogHtml&"<a href='?action=adng'>返回我的留言列表</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adng'>"
BlogHtml=BlogHtml&"</td></tr></table>"
    exit sub
  end if
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<form name=write_frm action='User.asp?action=greply&id="&rs("id")&"' method=post >"
BlogHtml=BlogHtml&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&"<tr>"
BlogHtml=BlogHtml&"<td class=td colspan=2>留言回复</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td width='18%' height=25>留言用户：</td>"
BlogHtml=BlogHtml&"<td width='*'>"&rs("luser")&"</td>"
BlogHtml=BlogHtml&"</tr>"
if rs("email")<>"" then
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td width='18%' height=25>用户邮件：</td>"
BlogHtml=BlogHtml&"<td width='*'><a href='mailto:"&rs("email")&"'>"&rs("email")&"<a></td>"
BlogHtml=BlogHtml&"</tr>"
end if
if rs("home")<>"" then
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td width='18%' height=25>用户主页：</td>"
BlogHtml=BlogHtml&"<td width='*'><a href='"&rs("home")&"' target=_blank>"&rs("home")&"</a></td>"
BlogHtml=BlogHtml&"</tr>"
end if
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>留言标题：</td>"
BlogHtml=BlogHtml&"<td>"&rs("topic")&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>留言内容：</td>"
BlogHtml=BlogHtml&"<td>"&Cls.code_html(rs("word"),2,0)&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>留言时间：</td>"
BlogHtml=BlogHtml&"<td>"&rs("tim")&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td valign=top><br />回复内容：<br /><br /><font class=Gys>* 长度1－1000字</font></td>"
BlogHtml=BlogHtml&"<td ><textarea rows=7 name=wrword cols=65 maxlength=250>"&cls.reword(rs("reply"))&"</textarea></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td>留言状态：</td>"
BlogHtml=BlogHtml&"<td><input type=radio name=wrhidden value='yes' "
if rs("hidden")=true then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&"> 公开 <input type=radio name=wrhidden value='no' "
if rs("hidden")=false then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&"> 隐藏   &nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys></font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr height=40 class=trb>"
BlogHtml=BlogHtml&"<td colspan=2 align=center><input type=submit class=btn name=wsubmit value=' 确定修改 ' >　　<input type=reset class=btn value=' 选择重置 ' ></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"</form>"
BlogHtml=BlogHtml&"</table>"
rs.close()
end sub

sub BlogEdit()
  dim found_err,drcid,drname,druser,drword,drhidden,drpassword,drlinks
  dim drleftcut,drmaincut,drlisttype,drshownum,drleftnum,drlistnum,drphotonum,drphotohnum,drlistphoto,drlistFriend
  if cls.chk() then
    drname=trim(request.form("wrname"))
	druser=trim(request.form("wruser"))
    drword=request.form("wrword")
    drhidden=trim(request.form("wrhidden"))
	drpassword=trim(request.form("wrpassword"))
	drlinks=trim(request.form("wrlinks"))
	drcid=Cls.Code_Int("ClassID",0)
	drleftcut=Cls.Code_Int("wrleftcut",20)
	drmaincut=Cls.Code_Int("wrmaincut",40)
	drlisttype=Cls.Code_Int("wrlisttype",0)
	drshownum=Cls.Code_Int("wrshownum",300)
	drleftnum=Cls.Code_Int("wrleftnum",10)
	drlistnum=Cls.Code_Int("wrlistnum",12)
	drphotonum=Cls.Code_Int("wrphotonum",20)
	drphotohnum=Cls.Code_Int("wrphotohnum",4)
	drlistphoto=Cls.Code_Int("wrlistphoto",4)
	drlistFriend=Cls.Code_Int("wrlistFriend",4)
    found_err=""
	if drcid<=0 then
      found_err=found_err & "+请选择您的 <font class=red>博客分类</font><br />"
	end if
    if drname="" or isnull(drname) then
      found_err=found_err & "+请正确输入您的 <font class=red>博客名</font>（长度1-20）<br />"
    end if
    if drword="" or isnull(drword) then
      found_err=found_err & "+博客的 <font class=red>简介内容</font> 是必需要的！请输入。<br />"
    end if
	if len(drword)>250 then
      found_err=found_err & "+博客的 <font class=red>简介内容</font> 不能大于250字。<br />"
    end if
    if drleftnum<1 or drlistnum<1 or drphotonum<1 or drphotohnum<1 or drlistphoto<1 or drlistFriend<1 then
      found_err=found_err & "+博客参数设置中的 <font class=red>各项目调用数量</font> 必需大于 <font class=red>0</font>。<br />"
    end if	
    if found_err<>"" then
      BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if	
    sql="Select * from AsaiMHblog where id="&b_id
    Call cls.exec("",-1)
    rs.open sql,conn,1,3
	if not rs.eof then 
	    rs("classid")=drcid
		rs("blogname")=drname
		rs("content")=Cls.CheckScript(drword)
		if drhidden="yes" then
		  rs("hidden")=true
		else
		  rs("hidden")=false
		end if
		rs("password")=drpassword
		rs("left_cut")=drleftcut
	    rs("main_cut")=drmaincut
	    rs("list_type")=drlisttype
	    rs("show_num")=drshownum
	    rs("left_num")=drleftnum
	    rs("list_num")=drlistnum
	    rs("list_photo")=drlistphoto
	    rs("list_Friend")=drlistFriend
	    rs("photo_num")=drphotonum
	    rs("photo_hnum")=drphotohnum
		rs.update
    else
		found_err=found_err&"+找不到你的博客信息！可能你的博客尚未申请或已被删除！<br />"
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
	    Exit sub
	End if
    rs.close
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功修改信息</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！成功修改了您的博客了!</font><br /><br />"
BlogHtml=BlogHtml&"<a href='?action=adn'>返回我的博客配制页面</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adn'>"
BlogHtml=BlogHtml&"</td></tr></table>"
    exit sub
  end if 
sql="Select * from AsaiMHblog where id="&b_id
set rs=cls.exec(sql,1)
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<form name=write_frm action='User.asp?action=adn' method=post>"
BlogHtml=BlogHtml&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&"<tr>"
BlogHtml=BlogHtml&"<td class=td colspan=4>博客信息修改</td></tr>"
BlogHtml=BlogHtml&"<tr class=trb><td align=center height=30 colspan=4><font class=red><b>基本信息</b></font></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td width='18%' height=25>博客名字：</td>"
BlogHtml=BlogHtml&"<td width='*' colspan=3><input type=text name=wrname value="""&replace(rs("blogname"),"""","'")&""" size=27 maxlength=20></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td width='18%' height=25>博客分类：</td>"
BlogHtml=BlogHtml&"<td width='*' colspan=3>"&LoadClassSelect(ChannelIDs,rs("classid"),Cls.ClassDepth)&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>博客站长：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=text name=wruser value='"&rs("username")&"' size=27 maxlength=20 readonly></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td valign=top><br />博客简介：<br /><br /><font class=Gys>* 长度1－250字</font></td>"
'BlogHtml=BlogHtml&"<td colspan=3><textarea rows=7 name=wrword cols=65 maxlength=250>"&cls.reword(rs("content"))&"</textarea></td>"
BlogHtml=BlogHtml&"<td colspan=3>"&LoadEditor(channelids,0,"write_frm","wrword","",server.HTMLEncode(replace(rs("content"),"","")))&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=trb><td align=center height=30 colspan=4><font class=red><b>参数设置</b></font></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>侧边标题长度：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=text name=wrleftcut value="""&(rs("left_cut"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 指博客页面侧边栏中标题字符的最大长度(字节)</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>侧边调用条数：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=text name=wrleftnum value="""&(rs("left_num"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 页面侧边栏中调用日志，留言，评论等项目的条数</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>日志标题长度：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=text name=wrmaincut value="""&(rs("main_cut"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 指博客页面主体栏中标题字符的最大长度(字节)</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>日志显示条数：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=text name=wrlistnum value="""&(rs("list_num"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 显示日志列表的条数</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>日志显示模式：</td>"
BlogHtml=BlogHtml&"<td colspan=3><Select name=wrlisttype><option value='0'"
if rs("list_type")=0 then BlogHtml=BlogHtml&" Selected"
BlogHtml=BlogHtml&">显示标题和摘要</option> <option value='1'"
if rs("list_type")=1 then BlogHtml=BlogHtml&" Selected"
BlogHtml=BlogHtml&">仅显示标题</option></Select></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>摘要显示字数：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=text name=wrshownum value="""&(rs("show_num"))&""" size=5 maxlength=4>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 假如你选择[显示标题和摘要],这里可以设置显示摘要的字数</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>相片显示张数：</td>"
BlogHtml=BlogHtml&"<td><input type=text name=wrphotonum value="""&(rs("photo_num"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 显示相片的总张数</font></td>"
BlogHtml=BlogHtml&"<td>侧边调用相片数：</td>"
BlogHtml=BlogHtml&"<td><input type=text name=wrlistphoto value="""&(rs("list_photo"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 侧边调用相片个数</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>相片每行张数：</td>"
BlogHtml=BlogHtml&"<td><input type=text name=wrphotohnum value="""&(rs("photo_hnum"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 相片列表中每行显示的张数</font></td>"
BlogHtml=BlogHtml&"<td>侧边显示好友数：</td>"
BlogHtml=BlogHtml&"<td><input type=text name=wrlistFriend value="""&(rs("list_Friend"))&""" size=5 maxlength=2>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 侧边显示好友个数</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=trb><td align=center height=30 colspan=4><font class=red><b>高级功能</b></font></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>访问密码：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=text name=wrpassword value='"&rs("password")&"' size=15 maxlength=20>&nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 若密码不为空，则需要输入密码才能访问你的博客</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td>博客开关：</td>"
BlogHtml=BlogHtml&"<td colspan=3><input type=radio name=wrhidden value='yes' "
if rs("hidden")=true then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&"> 正常 <input type=radio name=wrhidden value='no' "
if rs("hidden")=false then BlogHtml=BlogHtml&" checked"
BlogHtml=BlogHtml&"> 隐藏   &nbsp;&nbsp;&nbsp;&nbsp;<font class=Gys>* 选择隐藏后，别人无法访问你的博客</font></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr height=40 class=trb>"
BlogHtml=BlogHtml&"<td colspan=4 align=center><input type=submit class=btn name=wsubmit value=' 确定修改 ' >　　<input type=reset class=btn value=' 选择重置 ' ></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"</form>"
BlogHtml=BlogHtml&"</table>"
rs.close()
end sub

sub ClassEdit(ctype)
  dim uc_id,uc_sort,uc_order,uc_stype,uc_sort2,uc_order2,uc_stype2,found_err
  if trim(request.form("cid"))<>"" then
    uc_id=trim(request.form("cid"))
	uc_sort=trim(request.form("sort"))
	uc_order=trim(request.form("orders"))
	uc_stype=trim(request.form("stype"))
    found_err=""
    if uc_sort="" or isnull(uc_sort) then
      found_err=found_err & "+<font class=red>请输入分类内容名称,此项不可为空！</font><br />"
    end if
    if uc_order="" or not isnumeric(uc_order) then
      found_err=found_err & "+<font class=red>请输入分类排序必须要是数字！</font><br />"
    end if
    if found_err<>"" then
      BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr class=trp><td align=center height=50>"&found_err&"</td></tr></table>"&ukong
    else
        sql="Select top 1 * from AsaiMHBlogSort where type="&ctype&" And username='"&login_username&"' and id="&uc_id
        Call cls.exec("",-1)
        if sqltype = 1 then
            rs.cursorlocation=3 
	end if
        rs.open sql,conn,1,3
	    if not rs.eof then
	        rs("sort")=uc_sort
	        rs("orders")=uc_order
		rs("showtype")=uc_stype
	    	rs.update
	    end if
       	rs.close
    end if
  end if
  if trim(request.form("add"))="yes"  then
    uc_id=trim(request.form("cid"))
	uc_sort=trim(request.form("sort"))
	uc_order=trim(request.form("orders"))
	uc_stype=trim(request.form("stype"))
    found_err=""
    if uc_sort="" or isnull(uc_sort) then
      found_err=found_err & "+<font class=red>请输入分类内容名称,此项不可为空！</font><br />"
    end if
    if uc_order="" or not isnumeric(uc_order) then
      found_err=found_err & "+<font class=red>请输入分类排序,此项必须要是数字！</font><br />"
    end if
    if found_err<>"" then
	  uc_sort2=uc_sort
	  uc_order2=uc_order
	  uc_stype2=uc_stype
      BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr class=trp><td align=center height=50>"&found_err&"</td></tr></table>"&ukong
    else
        sql="Select count(id) from AsaiMHBlogSort where type="&ctype&" And username='"&login_username&"'"
		set rs=cls.exec(sql,1)
		if rs(0)>=10 then
		    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr class=trp><td align=center height=50>+<font class=red>对不起,每个用户最多只能设置10个分类！</font></td></tr></table>"&ukong
            rs.close
		else
		    rs.close
            sql="Select * from AsaiMHBlogSort"
            Call cls.exec("",-1)
            rs.open sql,conn,1,3
		    rs.addnew
		    rs("type")=ctype
		    rs("username")=login_username
		    rs("sort")=uc_sort
		    rs("showtype")=uc_stype
		    rs("orders")=uc_order
		    rs("count")=0
	        rs.update
           	rs.close
		end if
    end if
  end if 
   if trim(request.querystring("dcid"))<>""  then
      dim dcid:dcid=trim(request.querystring("dcid"))
	  if not isnumeric(dcid) then
         BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr class=trp><td align=center height=50><font class=red>请不要非法提交数据!</font></td></tr></table>"&ukong
      else
        if sqltype = 1 then
		sql="delete from AsaiMHBlogSort where type="&ctype&" And username='"&login_username&"' and id="&dcid
        else
		sql="delete * from AsaiMHBlogSort where type="&ctype&" And username='"&login_username&"' and id="&dcid
        End If
		Call cls.exec(sql,0)
	  end if
   end if       
  sql="Select * from AsaiMHBlogSort where type="&ctype&" And username='"&login_username&"' order by orders,id desc"
  set rs=cls.exec(sql,1)
  dim ctypename
  if ctype=1 then
  ctypename="日志"
  else
  ctypename="相册"
  end if
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>修改"&ctypename&"分类</td></tr>"	
BlogHtml=BlogHtml&"<tr class=trb><td><b>修改原有分类:</b></td></tr>"
if rs.eof then BlogHtml=BlogHtml&"<tr><td class=tr>你还没有添加分类哦!</td></tr>"
do while not rs.eof
BlogHtml=BlogHtml&"<form name=class_frm"&ctype&" action='User.asp?action=adnc"&ctype&"' method=post >"
BlogHtml=BlogHtml&"<input type=hidden name=cid value='"&rs("id")&"'>"
BlogHtml=BlogHtml&"<tr class=tr><td>名称：<input type='text' name='sort' value='"&rs("sort")&"' size=20> 排序：<input type='text' name='orders' value='"&rs("orders")&"' size=2> "&class_stype(rs("showtype"))&" <input type=submit class=btn name=wsubmit value=' 修改 '> <input type=button class=btn name=wdelete value=' 删除 ' onclick=""javascript:window.location.href='User.asp?action=adnc"&ctype&"&dcid="&rs("id")&"';""></td></tr>"
BlogHtml=BlogHtml&"</form>"
rs.movenext
loop
BlogHtml=BlogHtml&"<tr><td class=trb><b>新增一个分类:</b></td></tr>"
BlogHtml=BlogHtml&"<form name=class_frmadd action='User.asp?action=adnc"&ctype&"' method=post >"
BlogHtml=BlogHtml&"<input type=hidden name=add value='yes'>"
BlogHtml=BlogHtml&"<tr class=tr><td>名称：<input type='text' name='sort' value='"&uc_sort2&"' size=20> 排序：<input type='text' name='orders' value='"&uc_order2&"' size=2> "&class_stype(uc_stype2)&" <input type=submit class=btn name=wsubmit value=' 添加 '> </td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"</form>"
BlogHtml=BlogHtml&"<tr><td class=trb><b>说明:</b>排序框内请输入数字,填入数字越小,该分类显示就愈前.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;默认显示指侧边和顶部都会显示分类名称</td></tr>"
BlogHtml=BlogHtml&"</table>"
end sub

function class_stype(st)
 dim uc_str
	uc_str = uc_str & vbcrlf &  "<Select name=stype>"
	uc_str = uc_str & vbcrlf &  "<option value='0'"
	If st=0 Then uc_str = uc_str & " Selected"
	uc_str = uc_str & ">默认显示</option>" & vbcrlf & "<option value='1'"
	If st=1 Then uc_str = uc_str &  " Selected"	
	uc_str = uc_str & ">侧边显示</option>" & vbcrlf & "<option value='2'"
	If st=2 Then uc_str = uc_str &  " Selected"	
	uc_str = uc_str & ">顶部显示</option>" & vbcrlf & "<option value='3'"
	If st=3 Then uc_str = uc_str &  " Selected"			
	uc_str = uc_str & ">不显示</option>" & vbcrlf & "</Select>"
	class_stype = uc_str
end function

sub LinksEdit()
dim links_dim,links_str,links_num
if request.form("linknum")<>"" then
   links_str=""
   links_num=Cls.ChkNumeric(request.form("linknum"))
   for i=1 to links_num
     If request.form("linkname"&i)<>"" and request.form("linkurl"&i)<>"" then
        links_str=links_str&Replace(Replace(request.form("linkname"&i),"|||",""),"@@@","")&"|||"&Replace(Replace(request.form("linkurl"&i),"|||",""),"@@@","")&"@@@"
     end if
   next
   if instr(links_str,"@@@")>0 then links_str=left(links_str,len(links_str)-3)
   Call cls.exec("update AsaiMHblog set links='"&links_str&"' where id="&b_id,0)
end if
sql="Select * from AsaiMHblog where id="&b_id
set rs=cls.exec(sql,1)
links_dim=split(rs("links"),"@@@")
rs.close
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<form name=write_frm action='User.asp?action=adnl' method=post >"
BlogHtml=BlogHtml&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&"<tr><td class=td colspan=2>友情链接设置</td></tr>"
BlogHtml=BlogHtml&"<tr class=trb><td><b>修改原有友情链接:</b></td></tr>"	
links_num=ubound(links_dim)
if links_num=-1 then BlogHtml=BlogHtml&"<tr><td class=tr>你还没有添加友情链接哦!</td></tr>"
for i=1 to links_num+1
links_str=split(links_dim(i-1),"|||")
if ubound(links_str)<>1 then exit for
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>名称：<input type=text name=linkname"&i&" value='"&links_str(0)&"' size=10 maxlength=20>&nbsp;&nbsp;地址：<input type=text  name=linkurl"&i&" value='"&links_str(1)&"' size=40 maxlength=100></td>"
BlogHtml=BlogHtml&"</tr>"
next
BlogHtml=BlogHtml&"<tr class=trb><td><b>新增一个友情链接:</b></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td>名称：<input type=text name=linkname"&links_num+2&" value='' size=10 maxlength=20>&nbsp;&nbsp;地址：<input type=text name=linkurl"&links_num+2&" value='http://' size=40 maxlength=100></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=trb>"
BlogHtml=BlogHtml&"<td align=center><input type=submit class=btn name=wsubmit value=' 确定修改 ' >　　<input type=reset class=btn value=' 选择重置 ' ></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<input type=hidden name=linknum value='"&links_num+2&"'>"
BlogHtml=BlogHtml&"</form>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td>若需要添加友情链接,请在添加框完整填写并提交即可<br />若需要修改友情链接,请在要修改的友情链接框中更改并提交即可<br />若需要删除友情链接,请把要删除的友情链接的名称或地址设置为空即可<br />特别注意:名称和地址务必填写清楚,其中有一项为空,即表示你要删除此链接!</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"</table>"
end sub

'dsf|||http://00000@@@sfdsf|||http://1111@@@sdfsdf|||http://222@@@sdfsdfsdf|||http://33@@@gfgfffffffff|||http://4@@@vv|||http://

sub SkinEdit()
  if cls.chk() then
    dim found_err,drskin
    drskin=trim(request.form("skin"))
    found_err=""
    if drskin="" or isnull(drskin) then
      found_err=found_err & "+您没有选择 <font class=red>模板</font> ！<br />"
    end if
    if found_err<>"" then
      BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
	Dim SQL3,rs3,skinmain,skinshowlog
	sql3="Select * from AsaiMHUserSkin where id="&drskin
    set rs3=cls.exec(sql3,1)
    if not rs3.eof then 
	    skinmain=rs3("skinmain")
		skinshowlog=rs3("skinshowlog")
		rs3.close
		set rs3=nothing
	Else
	    found_err=found_err&"+您选择的 模板 为空或有错误，请勿非法提交！<br />"
	    BlogHtml="<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
       	rs3.close
		set rs3=nothing
	    exit sub
	end if		
    sql="Select * from AsaiMHblog where id="&b_id
    Call cls.exec("",-1)
    rs.open sql,conn,1,3
	if not rs.eof then 		
		rs("skin")=drskin
		rs("user_skin_main")=skinmain
		rs("user_skin_showlog")=skinshowlog
		rs.update
    else
		found_err=found_err&"+找不到你的博客信息！可能你的博客尚未申请或已被删除！<br />"
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
	    Exit sub
	End if
    rs.close
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功选择模板</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！成功选择了您的博客模板界面!</font><br /><br />"
BlogHtml=BlogHtml&"<a href='?action=adns'>返回选择模板页面</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adns'>"
BlogHtml=BlogHtml&"</td></tr></table>"
    exit sub	
  end if
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<form name=write_frm action='User.asp?action=adns' method=post >"
BlogHtml=BlogHtml&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&"<tr><td class=td>请选择博客样式：</td></tr>"	
BlogHtml=BlogHtml&"<tr class=tr><td>"&UserSkinList(b_skinid,"?action=adns&")&"</td></tr>"
BlogHtml=BlogHtml&"<tr class=trb>"
BlogHtml=BlogHtml&"<td align=center><input type=submit class=btn name=wsubmit value=' 确定修改 ' >　　<input type=reset class=btn value=' 选择重置 ' ></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"</form>"
BlogHtml=BlogHtml&"</table>"
end sub

sub Skin_Edit()
  dim found_err,s_skinmain,s_skinshowlog
  if cls.chk() then
    's_skinmain=trim(request.form("s_skinmain"))
	's_skinshowlog=trim(request.form("s_skinshowlog"))
    s_skinmain=replace(request.form("s_skinmain"),Cls.web_dir&"blog/skin/","skin/")
	s_skinshowlog=replace(request.form("s_skinshowlog"),Cls.web_dir&"blog/skin/","skin/")
    found_err=""
    if s_skinmain="" or isnull(s_skinmain) then
      found_err=found_err & "+请输入你博客的 <font class=red>主模板</font>内容！<br />"
    end if
    if s_skinshowlog="" or isnull(s_skinshowlog) then
      found_err=found_err & "+请输入你博客的 <font class=red>副模板</font>内容！<br />"
    end if
    if found_err<>"" then
      BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
    sql="Select * from AsaiMHBlog where id="&b_id
    Call cls.exec("",-1)
    rs.open sql,conn,1,3
	if not rs.eof then 
	    rs("user_skin_main")=Cls.CheckScript(s_skinmain)
	    rs("user_skin_showlog")=Cls.CheckScript(s_skinshowlog)
		rs.update
    else
		found_err=found_err&"+找不到你的博客信息！可能你的博客尚未申请或已被删除！<br />"
	    BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
	    Exit sub
	End if
    rs.close 
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功修改信息</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！成功修改了您的博客模板了!</font><br /><br />"
BlogHtml=BlogHtml&"<a href='?action=adnse'>返回我的博客模板修改页面</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adnse'>"
BlogHtml=BlogHtml&"</td></tr></table>"
    exit sub
  end if
sql="Select user_skin_main,user_skin_showlog from AsaiMHblog where id="&b_id
set rs=cls.exec(sql,1)
dim usm,uss,user_skin_main_html,user_skin_showlog_html
usm=rs("user_skin_main")
uss=rs("user_skin_showlog")
user_skin_main_html=replace(usm,"skin/",Cls.web_dir&"blog/skin/")
user_skin_showlog_html=replace(uss,"skin/",Cls.web_dir&"blog/skin/")
if cls.is_null(usm)="" or cls.is_null(uss)="" then
Response.Redirect("?action=adns")
Response.End()
end if
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<form name=write_frm action='User.asp?action=adnse' method=post>"
BlogHtml=BlogHtml&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&"<tr>"
BlogHtml=BlogHtml&"<td class=td colspan=3>模板修改</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td width=60>类型：</td><td colspan=2>&nbsp;&nbsp;>> <a href='javascript:;' onClick=""zmb.style.display='';fmb.style.display='none';zmb2.style.display='';fmb2.style.display='none';""><font class=red>修改主模板</font></a>&nbsp;&nbsp;&nbsp;&nbsp;>> <a href='javascript:;' onClick=""zmb.style.display='none';fmb.style.display='';zmb2.style.display='none';fmb2.style.display='';""><font class=red>修改副模板</font></a></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr id=zmb>"
BlogHtml=BlogHtml&"<td valign=top><br />主模板：</td>"
'BlogHtml=BlogHtml&"<td colspan=2><textarea rows=25 name=s_skinmain cols=90>"&cls.reword(usm)&"</textarea></td>"
BlogHtml=BlogHtml&"<td>"&LoadEditor(channelids,0,"write_frm","s_skinmain","主模板",user_skin_main_html)&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr id=fmb style='display:none'>"
BlogHtml=BlogHtml&"<td valign=top><br />副模板：</td>"
'BlogHtml=BlogHtml&"<td colspan=2><textarea rows=25 name=s_skinshowlog cols=90>"&cls.reword(uss)&"</textarea></td>"
BlogHtml=BlogHtml&"<td>"&LoadEditor(channelids,0,"write_frm","s_skinshowlog","副模板",user_skin_showlog_html)&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr id=zmb2><td></td><td>"
BlogHtml=BlogHtml&"<table align=left cellspacing=0 cellpadding=0 border=0><tr><td colspan=2>"
BlogHtml=BlogHtml&"----------------------------------------------------------------------<br />"
BlogHtml=BlogHtml&"//以下为博客用户模板调用标签。<FONT color=red>注意：标签字母必需使用小写。</FONT><br />"
BlogHtml=BlogHtml&"----------------------------------------------------------------------<br />"
BlogHtml=BlogHtml&"</td></tr>"
BlogHtml=BlogHtml&"<tr><td width='32%'>$show_blogname$</td><td width=*>此标记显示用户Blog名称，若名称为空则显示用户ID。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_blogurl$</td><td>此标记显示博客链接。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_calendar$</td><td>此标记显示日历。</td></tr>" 
BlogHtml=BlogHtml&"<tr><td>$show_comment$</td><td>此标记显示最新(评论)回复列表。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_hotblog$</td><td>此标记为热门日志调用。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_hotphoto$</td><td>此标记为热门相片调用。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_info$</td><td>此标记显示Blog名称，统计信息等。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_links$</td><td>此标记显示链接信息。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_log$</td><td>此标记显示日志主体部分，包括评论等信息<FONT color=red>(重要)</FONT>。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_login$</td><td>此标记显示登录窗口。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_myfriend$</td><td>此标签显示我的好友。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_newblog$</td><td>此标记显示最新日志列表。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_newphoto$</td><td>此标记为最新相片调用。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_newmessage$</td><td>此标记显示最新留言列表。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_photo$</td><td>此标签调用相册。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_placard$</td><td>此标记显示用户公告。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_subject$</td><td>此标记显示专题分类。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_subject_l$</td><td>此标记横向显示专题分类。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_search$</td><td>此标记显示搜索表单。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_userface$</td><td>此标记显示用户头像(同等于用户中心头象)。</td></tr>"
BlogHtml=BlogHtml&"<tr><td>$show_xml$</td><td>此标记显示rss连接标志。</td></tr>"
'BlogHtml=BlogHtml&"<tr><td colspan=2>"
'BlogHtml=BlogHtml&"----------------------------------------------------------------------<br />"
'BlogHtml=BlogHtml&"//以下标签暂时无效<br />"
'BlogHtml=BlogHtml&"----------------------------------------------------------------------<br />"
'BlogHtml=BlogHtml&"</td></tr>"
'BlogHtml=BlogHtml&"<tr><td>$show_mygroups$</td><td>此标签显示我加入的群组。<br /></td></tr>"
BlogHtml=BlogHtml&"<tr><td colspan=2>"
BlogHtml=BlogHtml&"----------------------------------------------------------------------<br />"
BlogHtml=BlogHtml&"</td></tr></table></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr id=fmb2 style='display:none'><td></td><td>"
BlogHtml=BlogHtml&"<table align=left cellspacing=0 cellpadding=0 border=0><tr><td colspan=2>"
BlogHtml=BlogHtml&"----------------------------------------------------------------------<br />"
BlogHtml=BlogHtml&"//这里是副模板编辑帮助信息！<FONT color=red>(暂无)</FONT><br />"
BlogHtml=BlogHtml&"----------------------------------------------------------------------<br /><br />"
BlogHtml=BlogHtml&"</td></tr>"
BlogHtml=BlogHtml&"</table></td></tr>"
BlogHtml=BlogHtml&"<tr height=50 class=trb>"
BlogHtml=BlogHtml&"<td colspan=3 align=center>"
BlogHtml=BlogHtml&"<input type=submit class=btn name=wsubmit value='确定修改'>　　<input type=reset class=btn value='选择重置'></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"</form>"
BlogHtml=BlogHtml&"</table>"
rs.close()
end sub

sub BlogCount()
dim tcount1,tcount2,scount
sql="Select count(id) from AsaiMHblogdata where type = 1 and username='"&b_user&"'"
tcount1=cls.exec(sql,1)(0)
sql="Select count(id) from AsaiMHblogdata where type = 2 and username='"&b_user&"'"
tcount2=cls.exec(sql,1)(0)
sql="update AsaiMHblog set count1="&tcount1&",count2="&tcount2&" where id="&b_id
Call cls.exec(sql,0)
'更新分类
sql="Select id  from AsaiMHBlogSort where username='"&b_user&"'"
set rs=cls.exec(sql,1)
do while not rs.eof
   sql="Select count(id) from AsaiMHblogdata where cid = "&rs(0)&" and username='"&b_user&"'"
   scount=cls.exec(sql,1)(0)
   sql="update AsaiMHBlogSort set count="&scount&" where id = "&rs(0)&" and username='"&b_user&"'"
   Call cls.exec(sql,0)   
   rs.movenext
loop
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功更新博客信息</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！成功更新您的博客信息了!</font><br /><br />"
BlogHtml=BlogHtml&"<a href='User.asp'>返回主界面</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=User.asp'>"
BlogHtml=BlogHtml&"</td></tr></table>"
end sub

function chk_class(n_sort,n_type,cid)
  dim tmpcls,sql3,rs3,n_id
  tmpcls="<Select name=c_id size=1>"&vbcrlf&"<option value='0'>不选择分类</option>"
  sql3="Select id,sort from "&n_sort&"  where type = "&n_type&" and username='"&login_username&"' order by orders,id desc"
  set rs3=cls.exec(sql3,1)
  if not rs3.eof then
  do while not rs3.eof
    n_id=int(rs3(0))
    tmpcls=tmpcls& vbcrlf&"<option value='"&n_id&"'"
    if cid=n_id then tmpcls=tmpcls& " Selected"
    tmpcls=tmpcls& ">"&rs3(1)&"</option>"
    rs3.movenext
  loop
  else
  'tmpcls=tmpcls& vbcrlf&"<option value='0'>不选择分类</option>"
  end if
  rs3.close
  set rs3=nothing
  tmpcls=tmpcls& vbcrlf&"</Select> * 请选择一个分类"
  chk_class=tmpcls
end function

sub Chk_Handle()
  dim s_type,sel_type,seltype
  s_type=trim(request.querystring("type"))
  sel_type=trim(request.form("sel_type"))
  Select Case sel_type
  Case "公开"
    seltype="gk"
  Case "取消公开"
    seltype="qxgk"
  Case "删除"
    seltype="delete"
  Case else
    sel_type=""
    seltype=""
  end Select
  if s_type="" or sel_type="" or seltype="" then
    BlogHtml=BlogHtml&"<script>"
	BlogHtml=BlogHtml&"alert('您在提交用户操作时出现非法的数据');"
	BlogHtml=BlogHtml&"</script>"
    exit sub
  end if
  dim sel_id,sel_cid,hdim,tdim,hnum,id,c_id,hidden
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
  for i=0 to hnum
    tdim=split(hdim(i),"|")
    id=tdim(0)
	c_id=tdim(1)
	hidden=tdim(2)
    if isnumeric(id) then
      Select Case seltype
      Case "delete"
  	    Call cls.exec("delete from AsaiMHblogdata where username='"&login_username&"' and id="&id&"",0)
	 	Call cls.exec("update AsaiMHblog set count"&s_type&"=count"&s_type&"-1 where id="&b_id,0)
	    if c_id<>"0" then Call cls.exec("update AsaiMHBlogSort set count=count-1 where username='"&login_username&"' and id="&c_id,0)
      Case "gk"
        sql="update AsaiMHblogdata  set hidden=1 where username='"&login_username&"' and id="&id
		if hidden="no" then
		   Call cls.exec("update AsaiMHblog set count"&s_type&"=count"&s_type&"+1 where id="&b_id,0)
		   if c_id<>"0" then Call cls.exec("update AsaiMHBlogSort set count=count+1 where username='"&login_username&"' and id="&c_id,0)
		end if
        conn.execute(sql)
      Case "qxgk"
        sql="update AsaiMHblogdata  set hidden=0 where username='"&login_username&"' and id="&id
		if hidden="yes" then
		   Call cls.exec("update AsaiMHblog set count"&s_type&"=count"&s_type&"-1 where id="&b_id,0)
		   if c_id<>"0" then Call cls.exec("update AsaiMHBlogSort set count=count-1 where username='"&login_username&"' and id="&c_id,0)
		end if
        conn.execute(sql)
      Case else
      end Select
    end if
  next
  erase hdim
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功信息</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！成功（"&sel_type&"）操作了"&(hnum+1)&"条"&tit_fir&"记录！</font><br /><br />"
BlogHtml=BlogHtml&"<a href='User.asp?action=adn"&s_type&"'>返回上一页面</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=User.asp?action=adn"&s_type&"'>"
BlogHtml=BlogHtml&"</td></tr></table>"
end sub

sub Chk_Gbook()
  dim sel_id,sel_type,seltype,id
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  sel_type=trim(request.form("sel_type"))
  Select Case sel_type
  Case "公开"
    seltype="gk"
  Case "取消公开"
    seltype="qxgk"
  Case "删除"
    seltype="delete"
  Case else
    sel_type=""
    seltype=""
  end Select
  if sel_type="" or seltype="" then
    BlogHtml=BlogHtml&"<script>"
	BlogHtml=BlogHtml&"alert('您在提交用户操作时出现非法的数据');"
	BlogHtml=BlogHtml&"</script>"
    exit sub
  end if
  dim hdim,hnum
  sel_id=trim(request.form("sel_id"))
  sel_id=replace(sel_id," ","")
  hdim=split(sel_id,",")
  hnum=ubound(hdim)
    for i=0 to hnum
    id=hdim(0)
    if isnumeric(id) then
      Select Case seltype
      Case "delete"
  	    Call cls.exec("delete from AsaiMHblogbook where buser='"&login_username&"' and id="&id&"",0)
      Case "gk"
        sql="update AsaiMHblogbook  set hidden=1 where buser='"&login_username&"' and id="&id
        conn.execute(sql)
      Case "qxgk"
        sql="update AsaiMHblogbook  set hidden=0 where buser='"&login_username&"' and id="&id
        conn.execute(sql)
      Case else

      end Select
    end if
  next
  erase hdim
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功信息</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！成功（"&sel_type&"）操作了"&(hnum+1)&"条"&tit_fir&"留言！</font><br /><br />"
BlogHtml=BlogHtml&"<a href='User.asp?action=adng'>返回上一页面</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动返回）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=User.asp?action=adng'>"
BlogHtml=BlogHtml&"</td></tr></table>"
end sub

sub Article_Tags()
dim strTag
BlogHtml=BlogHtml&"<TABLE class=table cellSpacing=1 cellPadding=4><TBODY>"
BlogHtml=BlogHtml&"<tr><td class=td colspan=2>Tags管理</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td ><a href='?action=article_tags'>日志tag管理</a></td><td><a href='?action=photo_tags'>图片tag管理</a></td></tr>"
BlogHtml=BlogHtml&"</TBODY></table>"&ukong
BlogHtml=BlogHtml&"<TABLE class=table cellSpacing=1 cellPadding=4><TBODY>"
BlogHtml=BlogHtml&"<tr><td class=td colspan=2>日志Tags管理</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td>"
   sql="Select Tags,sum(Num)as Num2 from AsaiMHblogtags where type=1 and Username='"&login_username&"' group by Tags "
   set rs = cls.exec(sql,1)
   if not rs.Eof then
     while not rs.Eof
       	strTag= "<span class='tags'><a href=""Tags.asp?action=search&keyword=" &  Server.URLEncode(RS("tags")) & """ title=""共有日志"&rs("Num2")&"篇"" target='_blank'>" & Server.HTMLEncode(RS("tags")) & "</a></span><span class='other'>(<a href='?action=del_tags&tag="&rs("Tags")&"&type=article_tags' onclick=""return (confirm('真的要删除“"&rs("Tags")&"”标签吗？'))"">删除</a>)</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&vbCrLf      
      BlogHtml=BlogHtml & strTag      
      rs.MoveNext
     wend
	 else
      BlogHtml=BlogHtml & "暂时还没有标签"      
      end if
   rs.close	
BlogHtml=BlogHtml&"</td></tr></table></table>"
end sub

sub Photo_Tags()
dim strTag
BlogHtml=BlogHtml&"<TABLE class=table cellSpacing=1 cellPadding=4><TBODY>"
BlogHtml=BlogHtml&"<tr><td class=td colspan=2>Tags管理</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td ><a href='?action=article_tags'>日志tag管理</a></td><td><a href='?action=photo_tags'>图片tag管理</a></td></tr>"
BlogHtml=BlogHtml&"</TBODY></table>"&ukong
BlogHtml=BlogHtml&"<TABLE class=table cellSpacing=1 cellPadding=4><TBODY>"
BlogHtml=BlogHtml&"<tr><td class=td colspan=2>相册Tags管理</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td>"
   sql="Select Tags,sum(Num)as Num2,Max(Num)as Max2 from AsaiMHblogtags where type=2 and Username='"&login_username&"'  group by Tags "
 set rs = cls.exec(sql,1)
   if not rs.Eof then
       while not rs.Eof
           	strTag= "<span class='tags'><a href=""Tags.asp?action=seapic&keyword=" &  Server.URLEncode(RS("tags")) & """ title=""共有图片"&rs("Num2")&"张"" target='_blank'>" & Server.HTMLEncode(RS("tags")) & "</a></span><span class='other'>(<a href='?action=del_tags&tag="&rs("Tags")&"&type=photo_tags' onclick=""return (confirm('真的要删除“"&rs("Tags")&"”标签吗？'))"">删除</a>)</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"&vbCrLf 	
     BlogHtml=BlogHtml & strTag      
      rs.MoveNext
     wend
	 else
      BlogHtml=BlogHtml & "暂时还没有标签" 
    end if
   rs.close
BlogHtml=BlogHtml&"</td></tr></table></table>"
end sub

sub Del_Tags()
dim del_tags,dtype
del_tags=replace(trim(request.querystring("tag")),"'","''")
dtype=replace(trim(request.querystring("type")),"'","''")
if dtype="article" then
sql="delete from AsaiMHblogtags where Username='"&login_username&"' and tags='"&del_tags&"'"
Call cls.exec(sql,0)
else
sql="delete from AsaiMHblogtags where Username='"&login_username&"' and  tags='"&del_tags&"'"
Call cls.exec(sql,0)
end if
Response.Redirect("?action="&dtype)
end sub

sub No_Blog()
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;错误信息→你还没有申请博客</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td  height=120>"
BlogHtml=BlogHtml&"<li><font class=blue>"&login_username&"</font>，您好,您目前还没有申请博客"
BlogHtml=BlogHtml&"<li>您必须拥有博客后才能进行[<font class=blue>"&tit&"</font>]操作"
BlogHtml=BlogHtml&"<li>只要您是本站用户，您就有资格申请博客"
BlogHtml=BlogHtml&"<li>还犹豫什么,赶快加入我们吧，无限精彩尽在此处!"
BlogHtml=BlogHtml&"<li>请点击 <a href='?action=reg'><font class=red><B>这里</B></font></a> 开始申请博客!</td></tr>"
BlogHtml=BlogHtml&"</table>"
end sub

sub Blog_Reg()
  dim found_err,drcid,drname,druser,drword,drhidden,drpassword,drlinks
  if cls.chk() then
    drname=trim(request.form("wrname"))
	druser=trim(request.form("wruser"))
    drword=request.form("wrword")
	drcid=Cls.Code_Int("ClassID",0)
    found_err=""
	if drcid<=0 then
      found_err=found_err & "+请选择您的 <font class=red>博客分类</font><br />"
	end if
    if drname="" or isnull(drname) then
      found_err=found_err & "+请正确输入您的 <font class=red>博客名</font>（长度1-20）<br />"
    end if
    if drword="" or isnull(drword) then
      found_err=found_err & "+博客的 <font class=red>简介内容</font> 是必需要的！请输入。<br />"
    end if
	if len(drword)>250 then
      found_err=found_err & "+博客的 <font class=red>简介内容</font> 不能大于250字。<br />"
    end if
    if found_err<>"" then
      BlogHtml= "<table cellspacing=1 cellpadding=4 class=table align='center'><tr><td class=td>&nbsp;错误信息</td></tr><tr class=tr><td align=center height=150 colspan=3>"&found_error(found_err,460)&"</td></tr></table>"
      exit sub
    end if
    sql="Select * from AsaiMHBlog "
    Call cls.exec("",-1)
    rs.open sql,conn,1,3
	    rs.addnew
		rs("classid")=drcid
		rs("blogname")=drname
		rs("username")=login_username
		rs("content")=Cls.CheckScript(drword)
		if Int(UserGroup_Config(31))=1 then 
                    rs("hidden")=False
		else 
                    rs("hidden")=true
		end if
		rs("skin")=0
		rs("user_skin_main")=""
		rs("user_skin_showlog")=""
		rs("password")=""
		rs("links")=""
		rs("left_cut")=20
		rs("main_cut")=40
		rs("list_type")=0
		rs("show_num")=200
		rs("left_num")=10
		rs("list_num")=15
		rs("photo_num")=20
		rs("list_photo")=5
		rs("photo_hnum")=4
		rs("list_Friend")=5
		rs("count1")=0
		rs("count2")=0
		rs("isgood")=false
		rs("hits")=0
		rs("tim")=now
		rs.update
        rs.close
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<tr><td class=td>&nbsp;成功申请博客</td></tr>"
BlogHtml=BlogHtml&"<tr class=tr><td align=center height=150 colspan=2>"
BlogHtml=BlogHtml&"<font class=red>恭喜！您已经成功申请了一个新的博客!</font><br /><br />"
if Int(UserGroup_Config(31))=1 then 
BlogHtml=BlogHtml&"您现在的状态为：<font class=red>未审核</font><br /><br />"
BlogHtml=BlogHtml&"现在您还不能使用本站博客系统，请等待管理员的审核验证通过您的申请！<br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后返回用户中心）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url="&Cls.Web_Dir&"User/Index.asp'>"
else
BlogHtml=BlogHtml&"<a href='?action=adn'>进入我的博客配制页面</a><br /><br />"
BlogHtml=BlogHtml&"（系统将在 <font class=red>"&Format_Mid_Num(25)&"</font> 秒钟后自动转向）<meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=?action=adn'>"
end if
BlogHtml=BlogHtml&"</td></tr></table>"
    Call Cls.Channel_Count(ChannelIDs)
    exit sub
end if
BlogHtml=BlogHtml&"<table cellspacing=1 cellpadding=4 class=table align='center'>"
BlogHtml=BlogHtml&"<form name=write_frm action='User.asp?action=reg' method=post  onsubmit='frm_submitonce(this);'>"
BlogHtml=BlogHtml&"<input type=hidden name=chk value='yes'>"
BlogHtml=BlogHtml&"<tr>"
BlogHtml=BlogHtml&"<td class=td colspan=2>博客信息修改</td></tr>"
BlogHtml=BlogHtml&"<tr class=trb><td align=center height=30 colspan=2><font class=red><b>基本信息</b></font></td></tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td width='18%' height=25>博客名字：</td>"
BlogHtml=BlogHtml&"<td width='*'><input type=text name=wrname value="""&login_username&"的Blog"" size=27 maxlength=20></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td width='18%' height=25>博客分类：</td>"
BlogHtml=BlogHtml&"<td width='*'>"&LoadClassSelect(ChannelIDs,0,Cls.ClassDepth)&"</td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td height=25>博客站长：</td>"
BlogHtml=BlogHtml&"<td><input type=text name=wruser value='"&login_username&"' size=27 maxlength=20 readonly></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr class=tr>"
BlogHtml=BlogHtml&"<td valign=top><br />博客简介：<br /><br /><font class=Gys>* 长度1－250字</font></td>"
BlogHtml=BlogHtml&"<td ><textarea rows=7 name=wrword cols=65 maxlength=250>我很懒,连简介都懒得写啦...</textarea></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"<tr height=40 class=trb>"
BlogHtml=BlogHtml&"<td colspan=2 align=center><input type=submit class=btn name=wsubmit value=' 申请 ' >　　<input type=reset class=btn value=' 重置 ' ></td>"
BlogHtml=BlogHtml&"</tr>"
BlogHtml=BlogHtml&"</form>"
BlogHtml=BlogHtml&"</table>"
end sub

function show_face(wt)			  
show_face=""
for i=1 to 10
show_face=show_face& "<img src=Images/Face/"&i&".gif border=0 align=absmiddle><input type=radio name=icon value='"&i&"'"
if i=wt then
show_face=show_face& " checked"
end if 
show_face=show_face&">&nbsp;"
next
end function
			  
function show_weather(wt)			  
dim i
show_weather=""
for i=1 to 5
show_weather=show_weather& "<img src=Images/Weather/"&i&".gif border=0><input type=radio name=weather value='"&i&"'"
if i=wt then
show_weather=show_weather& " checked"
end if 
show_weather=show_weather&">&nbsp;"
next
end function

Sub key_tags(tags, data, ttype,etype)
  Dim TagArray, TagCount, UserID, key_sql
  Do While InStr(tags, "  ") > 0
  tags = Replace(tags, "  ", " ")
Loop
  TagArray = Split(tags, " ", -1, 1)
        TagCount = UBound(TagArray, 1)
        For I = 0 To TagCount
             key_sql = "Select * from " & data & " where type="&ttype&" and Username='" & login_username & "' and Tags='" & TagArray(I) & "'"
            Call cls.exec(key_sql, -1)
    rs.open key_sql, conn, 1, 3
    If rs.EOF Then
            rs.AddNew
                rs("Username") = login_username
		rs("type") = ttype
                rs("Tags") = TagArray(I)
                rs("num") = 0
                rs.Update
            If etype=2 Then  Call cls.exec("update " & data & " set Num=num+1 where type="&ttype&" and  Username='" & login_username & "' and Tags='" & TagArray(I) & "'", 0)
            End If
                rs.Close
            '重新计算
        If etype=1 Then Call cls.exec("update " & data & " set Num=num+1 where type="&ttype&" and  Username='" & login_username & "' and Tags='" & TagArray(I) & "'", 0)
        Next
   Erase TagArray
End Sub

Function key_tags2(tags)
    Do While InStr(tags, "  ") > 0
  tags = Replace(tags, "  ", " ")
  Loop
  key_tags2 = tags   
End Function
%>
