<!--#include file="Inc/Conn.asp"-->
<!--#include file="Head.asp"-->
<!--#include file="Inc/Code.asp"-->
<!--#include file="Inc/eshopcode.asp"-->
<%
If Request.Form("cndok")="Go" Then Response.Redirect "BookList.asp?page="&Trim(Request.Form("pp"))
Set rs=Server.CreateObject("Adodb.Recordset")
Dim Cu 
Set Cu = Conn.ExeCute("Select IsCm From [index] where id =1")
If Cu(0)=1 Then
Sql="Select * From [Book] where Mcheck=1 Order by ID desc "
Else
Sql = "Select * From [Book] Order by ID desc"
End if
rs.Open Sql,Conn,1,1
dim MaxPerPage
MaxPerPage=20
Dim text,checkpage
text="0123456789"
Rs.PageSize=MaxPerPage
for i=1 to len(request("page"))
checkpage=instr(1,text,mid(request("page"),i,1))
if checkpage=0 then
exit for
end if
next

If checkpage<>0 then
If NOT IsEmpty(request("page")) Then
CurrentPage=Cint(request("page"))
If CurrentPage < 1 Then CurrentPage = 1
If CurrentPage > Rs.PageCount Then CurrentPage = Rs.PageCount
Else
CurrentPage= 1
End If
If not Rs.eof Then Rs.AbsolutePage = CurrentPage end if
Else
CurrentPage=1
End if

Function BookList()
Dim Bhtm
If rs.Eof or rs.Bof Then
Bhtm = Bhtm & "<center>没有留言!</center>"
Else
i=0
Do While Not rs.Eof
Bhtm = Bhtm & "<tr>" 
Bhtm = Bhtm & "<td><a href=BookShow.asp?id="&rs("ID")&">"&Server.HtmlEncode(rs("Title"))&"</a></td>"
Bhtm = Bhtm & "<td> <div align=center>"&rs("Name")&"</div></td>"
Bhtm = Bhtm & "<td> <div align=center>"&rs("Time")&"</div></td>"
Bhtm = Bhtm & "<td align=center>"&rs("Reply")&"</td>"
Bhtm = Bhtm & "</tr>"
i=i+1 
If i >= MaxPerpage Then Exit do 
rs.MoveNext
Loop
End if
Booklist = Bhtm
End Function

Din Bpage
Bpage = Bpage & "共 <font color='#ff0000'>" & Cstr(Rs.RecordCount) & "</font> 条留言&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
Bpage = Bpage & "第 " & Cstr(CurrentPage) & "/" & Cstr(rs.pagecount) & "&nbsp;"
If currentpage > 1 Then
Bpage = Bpage & "<a href='BookList.asp?page="+cstr(1)+"'>首页 </a>&nbsp;"
Bpage = Bpage & "<a href='BookList.asp?page="+Cstr(currentpage-1)+"'> 上一页 </a>&nbsp;"
Else
Bpage = Bpage & " 上一页 "
End if
If currentpage < Rs.PageCount Then
Bpage = Bpage & "<a href='BookList.asp?page="+Cstr(currentPage+1)+"'> 下一页</a>&nbsp;"
Bpage = Bpage & "<a href='BookList.asp?page="+Cstr(Rs.PageCount)+"'> 尾页</a>&nbsp;&nbsp;"
Else
Bpage = Bpage & "下一页&nbsp;&nbsp;"
End if
Bpage = Bpage & "</td><td align='right'>"
Bpage = Bpage & "转到：<input type='text' name='pp' size=4 maxlength=4 class=smallInput value="&Currentpage&">&nbsp;"
Bpage = Bpage & "<input type='submit'  value='Go'  name='cndok'>&nbsp;&nbsp;"

Dim BHtml
BHtml = application("JaBookList")
BHtml = Replace(BHtml,"{用户登陆}",UserLogin())
BHtml = Replace(BHtml,"{用户搜索}",FindProd())
BHtml = Replace(BHtml,"{用户投票}",ShowVote())
BHtml = Replace(BHtml,"{留言列表}",Booklist())
BHtml = Replace(BHtml,"{留言分页}",Bpage)
Response.Write BHtml
rs.Close
Set rs=Nothing
%>
<!--#Include File="bottom.Asp"-->