<!--#include file="../conn.asp" -->
<%
Function aanewlistre0(ByVal str,ByVal bt)
set rslist0=server.CreateObject("adodb.recordset")
sql="select top "&(diarylistno+1)&" * from diary order by diaryid desc"
rslist0.open sql,conn,1,1
rb=bt Mod diarylistno
rslist0.movenext
Do While Not rslist0.eof
booklistm="<table width='272' border='0' cellpadding='0' cellspacing='0'  id='table11'><tr bordercolor='DDE7AB'><td width='2'></td><td width='53'>{xq}</td><td width='170'><font color='#51300C'><a target='_blank' title='{title}' href='{diarydir}{htmldir}/riji{diaryid}.htm'>{title}</a></font></td><td width='26'><img src='{diarydir}diary/{tq}' border='0' align='middle'></td><td width='23'><a title='{time}' href='#'><img border='0' src='{diarydir}diary/TIME.gif' width='24' height='20'></a></td></tr></table>"
booklistm=replace(booklistm,"{title}",rslist("title"))
booklistm=replace(booklistm,"{diarydir}",diarydir)
booklistm=replace(booklistm,"{htmldir}",htmldir)
booklistm=replace(booklistm,"{tq}",rslist("tq"))
booklistm=replace(booklistm,"{time}",rslist("diarytime"))
Set rx = Server.CreateObject("ADODB.Recordset")
  sql="select * from xqlist where xqorder="&CInt(rslist("xq"))
   rx.open sql,conn,3,2
   xq=rx("xqcontent")
   rx.update
   rx.close
booklistm=replace(booklistm,"{xq}",xq)
booklistm=replace(booklistm,"{diaryid}",rslist("diaryid"))
booklistall=booklistall&booklistm
rslist0.movenext
Loop
rslist0.close
Set rslist0=Nothing

If bt=diarylistno+1 Then
booklistp="<a href='"&diarydir&sitelistdir&"\newlist.htm'><font color=#5690BE>首页</font></a>&nbsp;<a href='"&diarydir&sitelistdir&"\newlist.htm'><font color=#5690BE>上页</a>&nbsp;</font><font color='#808080'>下页</font>&nbsp;<font color='#808080'>尾页</font>"
Else
If bt>diarylistno*2 then
booklistp="<a href='"&diarydir&sitelistdir&"\newlist.htm'><font color=#5690BE>首页</font></a>&nbsp;<a href='"&diarydir&sitelistdir&"\newlist_"&(Int((bt-1)/diarylistno)+1)&".htm'><font color=#5690BE>上页</font></a>&nbsp;</font><a href='"&diarydir&sitelistdir&"\newlist_"&(Int((bt-1)/diarylistno)-1)&".htm' ><font color='#5690BE'>下页</font></a>&nbsp;<a href='"&diarydir&sitelistdir&"\newlist_1.htm'><font color='#5690BE'>尾页</font></a>"
End if
End If
booklistp=booklistp&"<font color='#5690BE'> 当前页:"&(maxpage-page+1)&" 总页数:"
str=replace(str,"{rijibenlistpage}",booklistp)
aanewlistre0=replace(str,"{rijibenlist}",booklistall)
End Function

Function aanewlistre(ByVal str)
set rslist=server.CreateObject("adodb.recordset")
sql="select * from diary order by diaryid desc"
rslist.open sql,conn,1,1
booktotal=rslist.recordcount
rb=booktotal Mod diarylistno
If rb=0 Then rb=diarylistno
'For i=1 To rb tempuseless
For i=1 To diarylistno
booklistm="<table width='272' border='0' cellpadding='0' cellspacing='0'  id='table11'><tr bordercolor='DDE7AB'><td width='2'></td><td width='53'>{xq}</td><td width='170'><font color='#51300C'><a target='_blank' title='{title}' href='{diarydir}{htmldir}/riji{diaryid}.htm'>{title}</a></font></td><td width='26'><img src='{diarydir}diary/{tq}' border='0' align='middle'></td><td width='23'><a title='{time}' href='#'><img border='0' src='{diarydir}diary/TIME.gif' width='24' height='20'></a></td></tr></table>"
booklistm=replace(booklistm,"{title}",rslist("title"))
booklistm=replace(booklistm,"{diarydir}",diarydir)
booklistm=replace(booklistm,"{htmldir}",htmldir)
booklistm=replace(booklistm,"{tq}",rslist("tq"))
booklistm=replace(booklistm,"{time}",rslist("diarytime"))
Set rx = Server.CreateObject("ADODB.Recordset")
sql="select * from xqlist where xqorder="&CInt(rslist("xq"))
rx.open sql,conn,3,2
xq=rx("xqcontent")
rx.update
rx.close
booklistm=replace(booklistm,"{xq}",xq)
booklistm=replace(booklistm,"{diaryid}",rslist("diaryid"))
booklistall=booklistall&booklistm

rslist.movenext
Next
rslist.close
Set rslist=Nothing

If thisword="tempuseless" Then
Randomize
set rslist=server.CreateObject("adodb.recordset")
sqlrdn="select top "&(diarylistno-rb)&" * from diary order by Rnd("&Rnd()&"-diaryid)"
rslist.open sqlrdn,conn,1,1
j=0
Do While Not rslist.eof

booklistm="<table width='272' border='0' cellpadding='0' cellspacing='0'  id='table11'><tr bordercolor='DDE7AB'><td width='2'></td><td width='53'>{xq}</td><td width='170'><font color='#51300C'><a target='_blank' title='{title}' href='{diarydir}{htmldir}/riji{diaryid}.htm'>{title}</a></font></td><td width='26'><img src='{diarydir}diary/{tq}' border='0' align='middle'></td><td width='23'><a title='{time}' href='#'><img border='0' src='{diarydir}diary/TIME.gif' width='24' height='20'></a></td></tr></table>"
booklistm=replace(booklistm,"{title}",rslist("title"))
booklistm=replace(booklistm,"{diarydir}",diarydir)
booklistm=replace(booklistm,"{htmldir}",htmldir)
booklistm=replace(booklistm,"{tq}",rslist("tq"))
booklistm=replace(booklistm,"{time}",rslist("diarytime"))
Set rx = Server.CreateObject("ADODB.Recordset")
  sql="select * from xqlist where xqorder="&CInt(rslist("xq"))
   rx.open sql,conn,3,2
   xq=rx("xqcontent")
   rx.update
   rx.close
booklistm=replace(booklistm,"{xq}",xq)
booklistm=replace(booklistm,"{diaryid}",rslist("diaryid"))
booklistall=booklistall&booklistm

j=j+1
If j=(diarylistno-rb) Then Exit do
rslist.movenext
Loop
rslist.close
Set rslist=nothing
End If

If booktotal<diarylistno+1 Then
booklistp="<font color=#808080>首页&nbsp;上页&nbsp;</font><font color='#808080'>下页</font><font color='#808080'>尾页</font><font color='#5690BE'> 页次:1/1&nbsp;&nbsp; </font></td></tr></table>"
else
booklistp="<font color=#808080>首页&nbsp;上页&nbsp;</font><a href='"&diarydir&sitelistdir&"\newlist_"&Int((booktotal-1)/diarylistno)&".htm' ><font color='#5690BE'>下页</font></a>&nbsp;<a href='"&diarydir&sitelistdir&"\newlist_1.htm'><font color='#5690BE'>尾页</font></a>"
End If
booklistp=booklistp&"<font color='#5690BE'> 当前页:"&(maxpage-page+1)&" 总页数:"
booklistbnav="<span id='navi'><a href='"&diarydir&"index.asp'>首页</a>　<a href='"&diarydir&sitelistdir&"/NewList.htm'>最新日记</a> <a href='"&diarydir&sitelistdir&"/goodList.htm'>佳作推荐</a> <a href='"&diarydir&sitelistdir&"/newbook.htm'>最新日记本</a> <a href='"&diarydir&sitelistdir&"/BookOrder.htm'>日记本排行</a> <a href='"&diarydir&"u/search.asp'>日记搜索</a> <a href='/mybook.asp'>管理日记</a> <a href='/?i=128' target='_blank'>服务中心</a></span>"
str=replace(str,"{bnav}",booklistbnav)
str=replace(str,"{rijibenlistpage}",booklistp)
aanewlistre=replace(str,"{rijibenlist}",booklistall)
End Function
Function rijiree(ByVal str)
rijiree=replace(str,"{title}",title)
rijiree=replace(rijiree,"{emot}",xq)
rijiree=replace(rijiree,"{weather}",tq)
rijiree=replace(rijiree,"{class}",dtypen)
rijiree=replace(rijiree,"{diaryname}",bookname)
rijiree=replace(rijiree,"{writer}",user)
rijiree=replace(rijiree,"{time}",now())
rijiree=replace(rijiree,"{content}",content)
rijiree=replace(rijiree,"{diarynameid}",userid)
rijiree=replace(rijiree,"{diaryid}",did)
rijiree=replace(rijiree,"{topbg}",bg)
rijiree=replace(rijiree,"{diarybg}",diarybg)
rijiree=replace(rijiree,"{diarydir}",diarydir)
booklistbnav="<span id='navi'><a href='"&diarydir&"index.asp'>首页</a>　<a href='"&diarydir&sitelistdir&"/NewList.htm'>最新日记</a> <a href='"&diarydir&sitelistdir&"/goodList.htm'>佳作推荐</a> <a href='"&diarydir&sitelistdir&"/Newbook.htm'>最新日记本</a> <a href='"&diarydir&sitelistdir&"/BookOrder.htm'>日记本排行</a> <a href='"&diarydir&"u/search.asp'>日记搜索</a> <a href='/mybook.asp'>管理日记</a> <a href='/?i=128' target='_blank'>服务中心</a></span>"
rijiree=replace(rijiree,"{bnav}",booklistbnav)
End Function
user=Trim(Request("user"))
title=Trim(Request("title"))
content=Trim(Request("content"))
content=replace(content,"%26ldquo;")
content=replace(content,"%26rdquo;")
If content<>"" And title<>"" then
'content=replace(content,"'600')this.width='600';")
'content=replace(content," class="previewimg")
'xq="100"
  Randomize
  xq=Int(10*Rnd+1)*11
  If xq=110 Then xq=100
  dim kd
  kd=cint(rnd*33)
  if kd=0 then 
    kd=kd+1
  end if
  if kd<10 then 
  kd="0"&kd
  end if
bg="play/bg/"&kd&".jpg"
tq="tq/1.gif"
display="1"
mtype="2"
select case request("typeid")
case 25
dtype=830
dtypen="经典语录"
case 24
dtype=831
dtypen="名家语录"
case 26
dtype=832
dtypen="娱乐语录"
case 27
dtype=833
dtypen="爱情语录"
case 28
dtype=834
dtypen="生活语录"
case 29
dtype=835
dtypen="网络语录"
case 62
dtype=1017
dtypen="倾城之恋"
case 61
dtype=1018
dtypen="纯爱校园"
case 63
dtype=1019
dtypen="红粉蓝颜"
case 69
dtype=1020
dtypen="哲理寓言"
case 70
dtype=1021
dtypen="百味人生"
case 71
dtype=1022
dtypen="乡野风情"
case 72
dtype=1023
dtypen="伦理故事"
case 65
dtype=1024
dtypen="围城风景"
case 66
dtype=1025
dtypen="武侠风云"
case 67
dtype=1026
dtypen="悠幻玄迷"
case 68
dtype=1027
dtypen="民间传奇"
case 73
dtype=1028
dtypen="另类先锋"
case 100
dtype=1029
dtypen="感悟生活"
case 101
dtype=1030
dtypen="爱情滋味"
case 102
dtype=1031
dtypen="挚爱亲情"
case 103
dtype=1032
dtypen="友情天地"
case 104
dtype=1033
dtypen="青春校园"
case 105
dtype=1034
dtypen="婚姻物语"
case 106
dtype=1035
dtypen="山河雅韵"
case 107
dtype=1036
dtypen="随笔小札"
case 110
dtype=1038
dtypen="乱弹八卦"
case 111
dtype=1039
dtypen="百家杂谈"
case 112
dtype=1040
dtypen="处事之道"
case 113
dtype=1041
dtypen="局外观史"
case 114
dtype=1042
dtypen="针砭时弊"
case 115
dtype=1043
dtypen="影视时评"
case 120
dtype=1044
dtypen="现代诗歌"
case 121
dtype=1045
dtypen="古词风韵"
case 122
dtype=1046
dtypen="天涯行歌"
case 123
dtype=1047
dtypen="谈诗论道"
end Select
If request("typeid")<30 Then userid=1578
If request("typeid")<74 And request("typeid")>60 Then userid=1756
If request("typeid")<108 And request("typeid")>99 Then userid=1757
If request("typeid")<116 And request("typeid")>109 Then userid=1759
If request("typeid")<125 And request("typeid")>119 Then userid=1760
response.write Request.querystring("title")
title=stripHTML(title)
'content=stripHTML(content)
set rs=server.CreateObject("adodb.recordset")
sql="select * from diary"
rs.open sql,conn,1,3
booktotal0=rs.recordcount
rs.addnew
rs("title")=title
rs("content")=content
rs("tq")=tq
rs("xq")=xq
rs("mtype")=mtype
rs("bg")=bg
rs("typeid")=dtype
rs("diarytime")=now()
rs("userid")=userid
rs("display")=display
rs.update
did=rs("diaryid")
rs.close
booktotal=booktotal0+1
Set rx = Server.CreateObject("ADODB.Recordset")
  sql="select * from xqlist where xqorder="&CInt(xq)
   rx.open sql,conn,3,2
   xq=rx("xqcontent")
   rx.update
   rx.close

Set r = Server.CreateObject("ADODB.Recordset")
  sql="select * from diaryuser where userid="&userid
   r.open sql,conn,3,2
   r("amount")=r("amount")+1
   bookname=r("bookname")
   user=r("username")
   r.update
   r.close

File = diarydir&"m\riji2.htm"
rijibody=LoadFile(File)
rijibody=rijiree(rijibody)
FileName = "riji"&did&".htm"
FilePath = diarydir&htmldir&"\"&FileName
SaveToFile rijibody,FilePath

rb=booktotal Mod diarylistno
rb0=booktotal0 Mod diarylistno
File = diarydir&"m\newlist.htm"
rijibody=LoadFile(File)
rijibody=aanewlistre(rijibody)
FileName = "newlist.htm"
FilePath = diarydir&sitelistdir&"\"&FileName
SaveToFile rijibody,FilePath
FilePath = diarydir&sitelistdir&"\"&"newlist_"&(Int(booktotal0/diarylistno)+1)&".htm"
SaveToFile rijibody,FilePath
If rb0=0 Then
File = diarydir&"m\newlist.htm"
rijibody=LoadFile(File)
rijibody=aanewlistre0(rijibody,booktotal)
FileName = "newlist_"&Int(booktotal0/diarylistno)&".htm"
FilePath = diarydir&sitelistdir&"\"&FileName
SaveToFile rijibody,FilePath
End if

okstring="<html><head><meta http-equiv=Content-Type content=text/html; charset=gb2312><title>成功添加</title><link href=blueyr.css rel=stylesheet type=text/css></head>"
okstring=okstring+"<body><font color=#FF6600><div align=center>日记提交成功</div></font></body></html>"
response.Write(okstring)

End if
%>



