<!--#include file="conn.asp"-->
<% 
'解决留言不会自动换行的Bug
function HTMLEncode(fString)
if not isnull(fString) then
fString=replace(fstring,">","&gt;")
fString=replace(fString,"<","&lt;")

fString = Replace(fString, CHR(32), "&nbsp;")
fString = Replace(fString, CHR(9), "&nbsp;")
fString = Replace(fString, CHR(34), "&quot;")
fString = Replace(fString, CHR(39), "&#39;")
fString = Replace(fString, CHR(10) & CHR(10), "<P></P> ")
fString = Replace(fString, CHR(10), "<BR> ")
HTMLEncode=fString
end if
end function
 %>
 <%
'======================================也属于分页显示程序的一部分===================== 
if not isempty(request("pageno")) or request("pageno")<>0 then
pageno=request.querystring("pageno")
else
pageno=1
end if
'======================================================================================
 %>
<!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>本站留言</title>
<link href="style.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.STYLE1 {
	color: #FF0000;
	font-weight: bold;
}
.STYLE2 {color: #FFFFFF}
-->
</style>
</head>
<body> 
<!--#include file="top.asp"-->
  <div id="box">
<div id="left">
<div id="nav4">栏目导航</div>
<div id="nav_content">
<ul class="cannel2">
<li><a href="index.asp">查看留言</a></li>
<li><a href="addload.asp">签写留言</a></li>
</ul>

</div>

<div id="nav4">点击排行</div>
<div id="nav4_content">
<ul>
<%
 Set rs = Server.CreateObject("ADODB.RecordSet")
rs.open "select top 6 * from news order by hit desc",conn,1,1
if rs.eof and rs.bof then
response.Write("")
else
do while not rs.eof
%>
<li>·<a href="list.asp?yiid=<%=rs("yiid")%>"><%=rs("title")%></a></li>
<%
rs.movenext
loop
end if
rs.close
set rs=nothing
 %>
</ul>
</div>
</div>


<div id="right">
<div id="address">您的位置：本站首页&gt;留言列表</div>

<div id="content">
  <%
set rs=server.createobject("adodb.recordset")'利用Server内置对象创建一个记录集
sql="select name,sex,pci,qq,email,home,title,content,date,repcontent from main order by id desc"   'SQL语句，这里的意思是选择数据库中的name,sex,pci,qq,email,home,title,content,date,repcontent字段，指定该数据表的名称是“main”数据的排列顺序是倒序
rs.open sql,conn,1,1   '用刚才创建的名为rs的记录集打开数据库，设置属性为只读（1,1为只读数据,1,3为插入数据，2,3是修改数据)
%>
  <%
'=====以下为分页显示数据库中的记录的代码======
DIM Pages,PageNum
         rs.PageSize=5
         Pages=rs.PageCount
         if request("page")=""  OR trim(request("page"))>trim(Pages) then
            rs.AbsolutePage=1
            PageNo=1
         else
            rs.AbsolutePage=request("page")
            PageNo=request("page")
         end if
j=0
Do While Not rs.EOF AND j<rs.PageSize
%> 
  <% if rs.eof and rs.bof then %>
 <暂无留言>
  <% response.end %> 
  <% end if %>
    <TABLE width=100% border=0 align=center cellPadding=0 cellSpacing=1 bgcolor="#7BA5DD" style="margin-bottom:5px;"> 
    <TBODY> 
      <TR> 
        <TD height=30 bgcolor="#FFFFFF"><table width="100%" height="29" border="0" cellpadding="0" cellspacing="0" bgcolor="#50A8BE">
          <tr>
            <td width="119"><span class="STYLE2">&nbsp;&nbsp;
                <% =rs("sex") %>
              ：
              <% =rs("name") %>
            </span></td>
            <td width="445"><span class="STYLE2">发表于：&nbsp;
                <% =rs("Date") %>
            </span></td>
            <td width="38"><a href="mailto:<%=rs("email")%>" class="STYLE2"><img 
            src="images/email.gif" alt="给<%=rs("name")%>发邮件" width="16" height="16" border="0" /></a></td>
            <td width="37"><a 
            href="<%=rs("home")%>" target="_blank" class="STYLE2"><img 
            src="images/home.gif" alt="访问<%=rs("name")%>的主页" width="16" height="16" border="0" /></a></td>
            <td width="32"><a 
            href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("qq")%>" 
            target="_blank" class="STYLE2"><img 
            src="images/oicq.gif" alt="给<%=rs("name")%>发信息" width="16" height="16" 
            border="0" /></a></td>
          </tr>
        </table></TD>
      </TR> 
      <TR> 
        <TD><TABLE width=100% border=0 align=center cellPadding=0 cellSpacing=0> 
            <TBODY> 
              <TR> 
                <TD width=132 align="center" valign="top" bgcolor="#EBF3E2"><TABLE cellSpacing=0 cellPadding=0 width=100 align=center 
              border=0> 
                    <TBODY> 
                      <TR> 
                        <TD vAlign=middle align=center height=130><IMG src="<%=rs("pci")%>" width=85 
                  height=90 class=mytext></TD> 
                      </TR> 
                    </TBODY> 
                  </TABLE></TD> 
                <TD width="852" vAlign=top bgcolor="#FFFFFF"><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="word-break:break-all">
                  <tr>
                    <td height="30" valign="bottom" bgcolor="#FFFFFF">主　　题：
                        <% =rs("title") %>                    </td>
                  </tr>
                 
                  <tr>
                    <td width="384" height="31" bgcolor="#EBF3E2"><span class="style3">留言内容：</span><br />
                      <%=replace(rs("content"),chr(30),"<br>")%> </td>
                  </tr>
                  
                  <tr>
                    <td bgcolor="#FFFFFF"><span class="style4 STYLE1">站长回复:</span><font color="#006600"><b><br />
                    </b> </font> 　　　 <%=replace(rs("repcontent"),chr(10),"<br>")%></td>
                  </tr>
                  <tr>
                    <td height="2""></td>
                  </tr>
                </table></TD> 
              </TR> 
            </TBODY> 
          </TABLE></TD> 
      </TR> 
    </TBODY> 
</TABLE> 
  <%
'用以下这三句代码可以分页显示数据库的记录
rs.MoveNext
j=j+1
Loop
%>
<div align="center"> 
          <FORM name="p2" Action='<%=request.servervariables("URL")%>' Method="POST" style="margin-bottom:0;margin-top:0">
             共<%=pages%>页&nbsp; <a href='<%=request.servervariables("URL")%>?page=1' style="color:#0066ff">首页</a>&nbsp; 
            <%if PageNo>1 then%> 
            <a href='<%=request.servervariables("URL")%>?page=<%=PageNo-1%>' style="color:#0066ff">上页</a>&nbsp; 
            <%else%> 
            <font color='#555555'>上页</font>&nbsp; 
            <%end if%> 
            <%if PageNo<trim(pages) then%> 
            <a href='<%=request.servervariables("URL")%>?page=<%=PageNo+1%>' style="color:#0066ff">下页</a>&nbsp; 
            <%else%> 
            <font color='#555555'>下页</font>&nbsp; 
            <%end if%> 
            <a href='<%=request.servervariables("URL")%>?page=<%=pages%>' style="color:#0066ff">尾页</a>&nbsp; 第
            <select name="page" style="width:52" onChange="javascript:document.p2.submit()"> 
              <%for n=1 to Pages%> 
              <option value="<%=n%>" <%if trim(PageNo)=trim(n) then response.write "selected"%>><%=n%> 
              <%next%> 
            </select> 
            页
          </FORM> 
      </div>
</div>
</div>
</div>
<!--#include file="bottom.asp"-->
</body>
</html>
<%
rs.close    '关闭记录集
set rs=nothing    '销毁记录集
conn.close      '关闭数据库连接
set conn=nothing   '销毁数据库连接
%>