<!--#include file ="../connadmin.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
'======================================================================================
 %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></title>
<style type=text/css>
body  {
SCROLLBAR-FACE-COLOR: #9CC5D7;
SCROLLBAR-HIGHLIGHT-COLOR: #ffffff; 
SCROLLBAR-SHADOW-COLOR: #006699; 
SCROLLBAR-3DLIGHT-COLOR: #006699; 
SCROLLBAR-ARROW-COLOR: #330000; 
SCROLLBAR-TRACK-COLOR: #E2F3F1; 
SCROLLBAR-DARKSHADOW-COLOR: #ffffff;}
</style>
<link rel="stylesheet" type="text/css" href="../img/css.css">
</head>
<body>
<table class="border" width="98%" border="0" align="center" cellpadding="1" cellspacing="0">
  <tr>
    <td height="565" align="center" valign="top" class="bg_low"><table width="100%" height="25" border="0" cellpadding="0" cellspacing="0">
      <tr>
        <td align="center" valign="middle" class="bgtop"><font color="#FFFFFF"><b>管理留言</b></font> </td>
      </tr>
    </table>


          
      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td><%
set rs=server.createobject("adodb.recordset")'利用Server内置对象创建一个记录集
sql="select id,name,sex,pci,qq,email,home,title,content,date,repcontent from main order by id desc"   'SQL语句，这里的意思是选择数据库中的id,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 %>
  <!--此代码表示判断语句:如果RS记录指针的EOF结尾和BOF开头都为空,就返回真,执行下标签,即输出暂无留言这个表格,而不输出下面的其它标签了-->
  <table style="BORDER-BOTTOM: #d2e8b5 1px dotted" cellspacing=0 cellpadding=0 
width=520 border=0>
    <tbody>
      <tr>
        <td></td>
      </tr>
    </tbody>
  </table>
  <TABLE cellSpacing=0 cellPadding=0 width=525 align=center border=0>
  </TABLE> 
  <% response.end %> 
  <% end if %>
  <!--完成判断条件,Response.end表示输出结束,不再输出以下的代码-->
  <table style="BORDER-BOTTOM: #d2e8b5 1px dotted" cellspacing=0 cellpadding=0 
width=520 border=0>
    <tbody>
      <tr>
        <td></td>
      </tr>
    </tbody>
  </table>
  <TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=0> 
    <TBODY> 
      <TR> 
        <TD height=30 bgcolor="#DFF0F9"><table width="100%" border="0" cellspacing="0" cellpadding="0"> 
            <tr> 
              <td width="165"> 
                <% =rs("sex") %> 
&nbsp;&nbsp;：
                <% =rs("name") %> 
                &nbsp;&nbsp;</td> 
              <td width="557">发表于：&nbsp;
                <% =rs("Date") %>
&nbsp; </td>
              <td width="297"><A href="mailto:<%=rs("email")%>"><IMG 
            src="../images/email.gif" alt=给<%=rs("name")%>发邮件 width="16" height="16" border=0></A>&nbsp; 　 &nbsp;<A 
            href="<%=rs("home")%>" target=_blank><IMG 
            src="../images/home.gif" alt=访问<%=rs("name")%>的主页 width="16" height="16" border=0></A>&nbsp; &nbsp;　<A 
            href="http://search.tencent.com/cgi-bin/friend/user_show_info?ln=<%=rs("qq")%>" 
            target=_blank><IMG 
            src="../images/oicq.gif" alt=给<%=rs("name")%>发信息 width=16 height=16 
            border=0></A>&nbsp;&nbsp; 　<a href="del.asp?id=<%=rs("id")%>" onClick="return confirm('是否确定删除本留言？');">删除留言</a>　　<a href="reply.asp?id=<%=rs("id")%>" >回复</a></td> 
            </tr> 
          </table></TD> 
      </TR> 
      <TR> 
        <TD><TABLE cellSpacing=0 cellPadding=0 width=100% align=center border=0> 
            <TBODY> 
              <TR> 
                <TD width=100 align="center" valign="top"><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> 
                        <TD align=middle width=10>　</TD> 
                      </TR> 
                      <TR> 
                        <TD align=middle colSpan=2 height=10></TD> 
                      </TR> 
                    </TBODY> 
                  </TABLE></TD> 
                <TD vAlign=top><table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" style="word-break:break-all"> 
                    <tr> 
                      <td height="25" valign="bottom"><font color="#FF6600"><b>主　　题：</b></font> 
                        <% =rs("title") %> </td> 
                    </tr> 
                    <tr> 
                      <td height="2""></td> 
                    </tr> 
                    <tr> 
                      <td height="6"></td> 
                    </tr> 
                    <tr> 
                      <td><font color="#FF6600"><b>留言内容：</b></font><br> 
                        　　　 <%=replace(rs("content"),chr(10),"<br>")%> </td> 
                    </tr> 
                    <tr> 
                      <td height="10"></td> 
                    </tr> 
                    <tr> 
                      <td height="22"><font color="#006600"><b>站长回复:<br> 
                        </b> </font> 　　　 <%=replace(rs("repcontent"),chr(10),"<br>")%></td> 
                    </tr> 
                    <tr> 
                      <td height="2""></td> 
                    </tr> 
                    <tr> 
                      <td class="rptext">&nbsp; </td> 
                    </tr> 
                  </table></TD> 
              </TR> 
            </TBODY> 
          </TABLE></TD> 
      </TR> 
      <TR bgColor=#ffffff> 
        <TD height=2 bgcolor="#99CFFB"></TD> 
      </TR> 
    </TBODY> 
  </TABLE> 
  <%
'用以下这三句代码可以分页显示数据库的记录
rs.MoveNext
j=j+1
Loop
%>
  <table style="BORDER-BOTTOM: #d2e8b5 1px dotted" cellspacing=0 cellpadding=0 
width=520 border=0>
    <tbody>
      <tr>
        <td></td>
      </tr>
    </tbody>
  </table>
  <table style="BORDER-BOTTOM: #d2e8b5 1px dotted" cellspacing=0 cellpadding=0 
width=520 border=0>
    <tbody>
      <tr>
        <td></td>
      </tr>
    </tbody>
  </table>
  <table width="525" border="0" cellspacing="1" cellpadding="3" height="26" align="center"> 
    <tr> 
      <td height="26"><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; 
			</form>
			</td>
        </tr>
      </table></td>
  </tr>
</table>