<% Language="VBScript" 

response.buffer=true
Response.Expires=0
if session("pas")<>"pas" then
response.redirect "ad_login.asp"
end if 
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>银色米兰，来样定做</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
body{font-family:"宋体";font-size:9pt;line-height: 12pt}
td{font-family:"宋体";font-size:9pt;line-height: 12pt}
A{text-decoration:none ;color:black;line-height: 12pt}
A:hover{text-decoration:none;color:#ff0000;line-height: 12pt}
.fontshadow {
	FILTER: dropshadow(color=#333333,offx=1,offy=1); WIDTH: 100%
}
.unnamed5 {  font-size: 9pt; font-style: normal; line-height: normal; font-weight: normal; font-variant: normal; height: 20px; clip:  rect(   ); color: #000000; border-color: black #000000 #000000 black; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: #FFFFFF}
.unnamed6 {  font-size: 10pt; line-height: 18pt; color: #000000}
.unnamed1 {  font-size: 9pt; line-height: 18pt; color: #000000}
.tdd {
	BORDER-RIGHT: 0px solid; PADDING-RIGHT: 5px; BORDER-TOP: 0px solid; PADDING-LEFT: 5px; FONT-SIZE: 9pt; PADDING-BOTTOM: 4px; BORDER-LEFT: 0px solid; WIDTH: 100%; CURSOR: hand; COLOR: buttontext; PADDING-TOP: 4px; BORDER-BOTTOM: 0px solid; HEIGHT: 20px; TEXT-DECORATION: none
}
.tdd:hover {
	BORDER-RIGHT: buttonshadow 1px solid; PADDING-RIGHT: 4px; BORDER-TOP: buttonhighlight 1px solid; PADDING-LEFT: 4px; PADDING-BOTTOM: 3px; BORDER-LEFT: buttonhighlight 1px solid; PADDING-TOP: 3px; BORDER-BOTTOM: buttonshadow 1px solid; TEXT-DECORATION: none
}
-->
</style>
</head>

<body topmargin="0">
<table width="709" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td bgcolor="0053A5">&nbsp;</td>
  </tr>
</table>
<table width="709" border="0" align="center" cellpadding="4" cellspacing="0">
  <tr> 
    <td width="80" height="336" rowspan="2" align="center" bgcolor="#CCCCCC"> 
      <p>&nbsp;</p>
      <p>&nbsp;</p>
    </td>
    <td width="609" rowspan="2"> 
      <% Language="VBScript" 
dim conn 
dim connstr 
dim totalPut 
dim CurrentPage 
dim TotalPages 
dim i,j 
dim sql 
dim rs 
on error resume next 
'打开数据库 

set conn=Server.CreateObject("ADODB.Connection")
dbpath=Server.MapPath("lydata/guest.mdb")
conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};DBQ="&dbpath
set rs=Server.CreateObject("ADODB.Recordset")

'定义每页文章显示数 
const MaxPerPage=18 
if not isempty(request("page")) then 
currentPage=cint(request("page")) 
else 
currentPage=1 
end if 
sql="select * from ly order by id desc" 
Set rs= Server.CreateObject("ADODB.Recordset") 
rs.open sql,conn,1,1 
liuyan=replace(rs("liuyan"),chr(10)+chr(13),"<br>")
if rs.eof and rs.bof then 
response.write "<p align='center'> 还没有任何留言</p>" 
else totalPut=rs.recordcount '数据库中留言数totalput
if currentpage<1 then 
currentpage=1 
end if 
'统计总页数currentpage 
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 
showpage totalput,MaxPerPage,"adviewguest.ASP" 
showContent 
showpage totalput,MaxPerPage,"adviewguest.ASP" 
else 
if (currentPage-1)*MaxPerPage<totalPut then 
rs.move (currentPage-1)*MaxPerPage 
dim bookmark 
bookmark=rs.bookmark 
showpage totalput,MaxPerPage,"adviewguest.ASP" 
showContent 
showpage totalput,MaxPerPage,"adviewguest.ASP" 
else currentPage=1 
showpage totalput,MaxPerPage,"adviewguest.ASP" 
showContent 
showpage totalput,MaxPerPage,"adviewguest.ASP" 
end if 
end if 
rs.close 
end if 
set rs=nothing 
conn.close 
set conn=nothing 
sub showContent 
dim i 
i=0 
do while not rs.eof 
%>
      <table width="597" border="0" cellpadding="1" cellspacing="1" bgcolor="#666666">
        <tr> 
          <td rowspan="2" height="39" align="center" bgcolor="#FFFFFF" width="27"><img src="bright.gif" width="15" height="15"></td>
          <td width="61" align="center" bgcolor="#CCCCCC"><font color="#000000">姓名：</font></td>
          <td width="111" align="center" bgcolor="#CCCCCC"><%=rs("cname")%></td>
          <td width="44" align="center" bgcolor="#CCCCCC">公司<font color="#000000">：</font></td>
          <td colspan="3" align="center" bgcolor="#CCCCCC"><%=rs("company")%></td>
        </tr>
        <tr> 
          <td width="61" align="center" bgcolor="#CCCCCC"><font color="#000000">地址：</font></td>
          <td colspan="3" align="center" bgcolor="#CCCCCC"><%=rs("adress")%></td>
          <td width="66" align="center" bgcolor="#CCCCCC"><font color="#000000">Email：</font></td>
          <td width="139" align="center" bgcolor="#CCCCCC"><%=rs("mail")%></td>
        </tr>
        <tr> 
          <td height="20" align="center" bgcolor="#FFFFFF" width="27"><a href="del.asp?id=<%=rs("id")%>"><font color="#FF0000">删除</font></a></td>
          <td height="20" align="center" bgcolor="#CCCCCC" width="61"><font face="Arial, Helvetica, sans-serif">电话：</font></td>
          <td align="center" bgcolor="#CCCCCC" width="111"><%=rs("tel")%></td>
          <td align="center" bgcolor="#CCCCCC" width="44"><font face="Arial, Helvetica, sans-serif">传真：</font></td>
          <td align="center" bgcolor="#CCCCCC" width="127"><%=rs("fax")%></td>
          <td align="center" bgcolor="#CCCCCC" width="66">留言时间：</td>
          <td align="center" bgcolor="#CCCCCC" width="139"><%=rs("ctime")%></td>
        </tr>
        <tr> 
          <td height="20" colspan="2" align="center" bgcolor="#FFFFFF"> 来样具体要求 ：</td>
          <td colspan="5" bgcolor="#FFFFFF"><%=rs("liuyan")%></td>
        </tr>
      </table>
      <br>
      <% '当显示记录大于maxperpage时结束这页 
i=i+1 
if i>=MaxPerPage then exit do 
rs.movenext 
loop 
end sub 
function showpage(totalnumber,maxperpage,filename) 
'求出当每页18条记录时总共的页数 
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'><font color='#000080'>>>分页</font> " 
'显示页数链接的条件 
if CurrentPage<2 then 
response.write "<font color='#000080'>首页 上一页</font> " 
else response.write "<a href="&filename&"?page=1&>首页</a> " 
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> " 
end if 
if n-currentpage<1 then 
response.write "<font color='#000080'>下一页 尾页</font>" 
else response.write "<a href="&filename&"?page="&(CurrentPage+1) 
response.write ">下一页</a> <a href="&filename&"?page="&n&">尾页</a>" 
end if 
response.write "<font color='#000080'> 页次：</font><strong><font color=red>"&CurrentPage&"</font><font color='#000080'>/"&n&"</strong>页</font>" 
response.write "<font color='#000080'> 共<b>"&totalnumber&"</b>笔记录<b>&nbsp;"&maxperpage&"</b>笔记录/页</font>" 
response.write "<font color='#000080'>转到：</font><input class=smallInput type='text' name='page' size=4 maxlength=10 value="&Currentpage&">"
response.write "<input class=buttonface type='submit' value=' Goto ' name='cndok'></span></p></form>" 
end function 
%>
    </td>
  </tr>
  <tr> </tr>
</table>
<table width="709" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td align="center" bgcolor="0053A5"><font color="#FFFFFF" face="Arial, Helvetica, sans-serif"></font></td>
  </tr>
</table>
</body>
</html>
