<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="conn.asp"-->
<!--#include file="session.asp"-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>乡下人仿百度留言本V1.2 浏览所有留言</title>
 <script language="vbscript">
sub sb(bh)
a=msgbox("确定你要删除此记录吗？",1,"友情提示")
if a=1 then
location="del_gbook.asp?bh="&bh
else
history.go(1)
end if
end sub
</script>
<style type="text/css">
<!--
body,td,th {
	font-size: 12px;
	color: #5B8B3F;
}
body {
	background-color: #023047;
}
table { table-layout: fixed;word-wrap:break-word;line-height:18px;}
.STYLE2 {color: #FF0000}
-->
</style>
</head>

<body topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<%'开始分页
				Const MaxPerPage=20 
   				dim totalPut   
   				dim CurrentPage
   				dim TotalPages
   				dim j
   				dim sql
    				if Not isempty(request("page")) then
      				currentPage=Cint(request("page"))
   				else
      				currentPage=1
   				end if 
		 set rs=server.createobject("adodb.recordset")
	rs.open "select * from gbook order by id desc",conn,1,1
		  
				if err.number<>0 then
				response.write "数据库中无数据"
				end if
				
  				if rs.eof And rs.bof then
       				Response.Write "<p align='center' class='contents'> 您还没有信息！</p>"
   				else
	  				totalPut=rs.recordcount

      				if currentpage<1 then
          				currentpage=1
      				end if

      				if (currentpage-1)*MaxPerPage>totalput then
	   					if (totalPut mod MaxPerPage)=0 then
	     					currentpage= totalPut \ MaxPerPage
	   					else
	      					currentpage= totalPut \ MaxPerPage + 1
	   					end if
      				end if

       				if currentPage=1 then
            			showContent
            			showpage totalput,MaxPerPage,"showbook.asp"
       				else
          				if (currentPage-1)*MaxPerPage<totalPut then
            				rs.move  (currentPage-1)*MaxPerPage
            				dim bookmark
            				bookmark=rs.bookmark
            				showContent
             				showpage totalput,MaxPerPage,"showbook.asp"
        				else
	        				currentPage=1
           					showContent
           					showpage totalput,MaxPerPage,"showbook.asp"
	      				end if
	   				end if
   				   				end if

   				sub showContent
       			dim i
	   			i=0

			%>		 
<table width="95%"  border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#c2c2d5" class="wb12hui">
  <tr bgcolor="#f1f0f5">
    <td bgcolor="#f1f0f5" width="3%">ID</td>
    <td width="50%" align="center" bgcolor="#f1f0f5">留言内容</td>
    <td width="10%" align="center" bgcolor="#f1f0f5">联系方式</td>
    <td width="10%" align="center" bgcolor="#f1f0f5">所在城市</td>
    <td align="center" bgcolor="#f1f0f5">留言时间</td>
    <td align="center" bgcolor="#f1f0f5">操作</td>
  </tr>
 <%do while not rs.eof%>
  <tr bgcolor="#FFFFFF">
    <td width="3%" height="38" align="center"><%=rs("id")%></td>
    <td><%= rs("title")%> <span class="STYLE2"><%=rs("pizhu")%></span></td>
    <td><%= rs("content")%></td>
    <td><%= rs("mail")%></td>
    <td width="12%" align="center"><%= rs("addtime")%></td>
    <td width="10%" align="center"><input type="button" name="Submit" value="删除" onClick="sb(<%=rs("id")%>)">&nbsp;&nbsp;<a href="addpz.asp?id=<%=rs("id")%>">批注</a></td>
  </tr>
<%i=i+1
if i>=MaxPerPage then Exit Do
rs.movenext
loop
rs.close
set rs=nothing%>
</table>

<table width="95%" align="center">
  <tr>
    <td align="right"><%  
	End Sub     
	Function showpage(totalnumber,maxperpage,filename)  
  				Dim n
  				
				If totalnumber Mod maxperpage=0 Then  
					n= totalnumber \ maxperpage  
				Else
					n= totalnumber \ maxperpage+1  
				End If
				
				Response.Write "<form method=Post action="&filename&">"  
				Response.Write "<p align='center' class='contents'> "  
				If CurrentPage<2 Then  
					Response.Write "<font class='contents'>首页 上一页</font> "  
				Else  
					Response.Write "<a href="&filename&"?page=1 class='contents'>首页</a> "  
					Response.Write "<a href="&filename&"?page="&CurrentPage-1&" class='contents'>上一页</a> "  
				End If
				
				If n-currentpage<1 Then  
					Response.Write "<font class='contents'>下一页 尾页</font>"  
				Else  
					Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&" class='contents'>"  
					Response.Write "下一页</a> <a href="&filename&"?page="&n&" class='contents'>尾页</a>"  
				End If  
					Response.Write "<font class='contents'> 每页显示20条 </font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
					Response.Write "<font class='contents'> 共有"&totalnumber&"条信息 " 
					 
				End Function  
%></td>
  </tr>
</table>

</body>
</html>
