<!--#include file="../conn.asp" -->
<%
if session("admin")="" then
Response.Write("<script language=JavaScript>alert('对不起,您没有权限使用该功能!!');history.back();</script>")
response.end
end If 

File = diarydir&"m\newbook.htm"
rijibody=LoadFile(File)
set rslist=server.CreateObject("adodb.recordset")
sql="select * from diaryuser order by userid asc"
rslist.open sql,conn,1,1

booktotal=rslist.recordcount
pageno=Int(booktotal/diarylistno)
If pageno=0 Then pageno=1
rb=booktotal Mod diarylistno
If rb<>0 Then pageno=pageno+1
k=0
Do While Not rslist.eof
j=0
booklistmmm=rijibody
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='3'><img border='0' src='../diary/kon.gif' width='2' height='20'></td><td width='125'><a target='_blank' href='{diarydir}?i={userid}'><font color='#51300C'>{bookname}</font></a></td><td width='97'><a target='_blank' href='{diarydir}?i={userid}'><font color=#00ACF0>{username}</font></a><td><font color=#FF6600><p align='right'>{amount}篇</font></td></tr></table>"
booklistm=replace(booklistm,"{userid}",rslist("userid"))
booklistm=replace(booklistm,"{diarydir}",diarydir)
booklistm=replace(booklistm,"{username}",rslist("username"))
booklistm=replace(booklistm,"{bookname}",rslist("bookname"))
booklistm=replace(booklistm,"{amount}",rslist("amount"))
booklistall=booklistall&booklistm
j=j+1
rslist.movenext
If rslist.eof Then Exit for
If j=diarylistno Then Exit For
Next

If booktotal<=diarylistno Then
Else
If j<>diarylistno Then
Randomize
set rslist1=server.CreateObject("adodb.recordset")
sqlrdn="select top "&(diarylistno-j)&" * from diaryuser order by Rnd("&Rnd()&"-userid)"
rslist1.open sqlrdn,conn,1,1
Do While Not rslist1.eof
booklistm="<table width='272' border='0' cellpadding='0' cellspacing='0' id='table11'><tr bordercolor='DDE7AB'><td width='2'></td><td width='3'><img border='0' src='../diary/kon.gif' width='2' height='20'></td><td width='125'><a target='_blank' href='{diarydir}?i={userid}'><font color='#51300C'>{bookname}</font></a></td><td width='97'><a target='_blank' href='{diarydir}?i={userid}'><font color=#00ACF0>{username}</font></a><td><font color=#FF6600><p align='right'>{amount}篇</font></td></tr></table>"
booklistm=replace(booklistm,"{userid}",rslist1("userid"))
booklistm=replace(booklistm,"{diarydir}",diarydir)
booklistm=replace(booklistm,"{username}",rslist1("username"))
booklistm=replace(booklistm,"{bookname}",rslist1("bookname"))
booklistm=replace(booklistm,"{amount}",rslist1("amount"))
booklistall=booklistall&booklistm
rslist1.movenext
Loop
rslist1.close
Set rslist1=Nothing
End if
End If
k=k+1

maxpage=pageno
page=k
'if page="" or page=0 then page=1
'if page>maxpage then page=maxpage

if cint(page)=cint(maxpage) then
booklistp="<font color=#808080>首页&nbsp;上页&nbsp;</font>"
else
if page=maxpage then
booklistp="<a href='Newbook.htm'> <font color='#5690BE'>首页</font></a> <a href='Newbook.htm'><font color='#5690BE'>上页</font></a>"
else
booklistp="<a href='Newbook.htm'> <font color='#5690BE'>首页</font></a> <a href='Newbook_"&(page+1)&".htm'><font color='#5690BE'>上页</font></a>"
end if
end if

if cint(page)=1 then
booklistp=booklistp&" <font color='#808080'>下页</font> <font color='#808080'>尾页</font>"
else
if cint(page)<>cint(maxpage) then
booklistp=booklistp&" <a href='Newbook_"&(page-1)&".htm'><font color='#5690BE'>下页</font></a> <a href='Newbook_1.htm'><font color='#5690BE'>尾页</font></a>"
Else
booklistp=booklistp&" <a href='Newbook_"&(page-1)&".htm'><font color='#5690BE'>下页</font></a> <a href='Newbook_1.htm'><font color='#5690BE'>尾页</font></a>"
end if
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>"
booklistmmm=replace(booklistmmm,"{bnav}",booklistbnav)
booklistmmm=replace(booklistmmm,"{rijibenlist}",booklistall)
booklistmmm=replace(booklistmmm,"{rijibenlistpage}",booklistp)

booklistall=""
If booktotal<=diarylistno Then
FilePath = diarydir&sitelistdir&"\"&"newbook.htm"
SaveToFile booklistmmm,FilePath
Else
booklistmmm=replace(booklistmmm,"{rijibenlistpage}",booklistp)
FilePath = diarydir&sitelistdir&"\"&"newbook_"&k&".htm"
SaveToFile booklistmmm,FilePath
If k=pageno Then
FilePath = diarydir&sitelistdir&"\"&"newbook.htm"
SaveToFile booklistmmm,FilePath
End If

End if
response.write "已生成第"&k&"页<br>"
Loop

rslist.close
Set rslist=Nothing
%>




