<!--#include file="conn.asp" -->
<!--#include file="admin.asp" -->
<link href="../css/css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style11 {font-size: 12px}
.style2 {color: #FF0000}
.STYLE12 {color: #0099CC}
.STYLE13 {color: #999999}
-->
</style></head>
<body>
<%
IF Request("work")="sh" Then
sql="update liuyan set B_sh=1 where id="&Request("id")&""
Conn.execute(sql)
End IF
%>
<%
if Request("work")="add" then
session("verifycode")=""
 set rs=server.createobject("adodb.recordset") 
 sql="select * from liuyan where id="&Request("id")&"" 
 rs.open sql,conn,1,2
  rs("B_dom")     =Request("B_dom")
  rs("B_hui")     =Request("B_hui")
 rs.update 		'更新数据表记录
 rs.close
 set rs=nothing
 Response.Redirect "book_index.asp?ok=ck"
 End IF
%>
<script LANGUAGE="JavaScript">
function check()
{
   if (document.Form1.B_dom.value=="")
     {
      alert("请填写您的留言内容！")
      document.Form1.B_dom.focus()
      document.Form1.B_dom.select()		
      return
	       }
     document.Form1.submit()
}
</SCRIPT>
<table width="95%" border="0" align="center" cellpadding="5" cellspacing="1" bgcolor="#CCCCCC">
  <tr>
    <td bgcolor="#FFFFFF">认真填写以下内容 |</td>
  </tr>
<%if Request("work")="edit" and session("admin_name")<>"" then
 set rs=server.createobject("adodb.recordset") 
 sql="select * from liuyan where id="&Request("id")&""
 rs.open sql,conn,1,1
%>
  <tr>
    <td bgcolor="#FFFFFF"><TABLE class=tdtop cellSpacing=0 cellPadding=0 width=100% align=center 
  border=0>
      <TBODY>
        <TR>
          <TD><TABLE cellSpacing=0 cellPadding=3 width=100% align=center border=0>
              <FORM name=Form1 action=book_index.asp method=post>
                <TBODY>
                  <TR>
                    <TD><DIV align=right>留言内容:&nbsp;</DIV></TD>
                    <TD width="213"><TEXTAREA class=ss1 id=B_dom name=B_dom rows=5 wrap=VIRTUAL cols=60><%=rs("B_dom")%></TEXTAREA>
                      <FONT 
            color=#ff6600>*</FONT></TD>
                  </TR>
                  <TR>
                    <TD nowrap><DIV align=right>版主回复:&nbsp;</DIV></TD>
                    <TD><TEXTAREA class=ss1 id=B_hui name=B_hui rows=5 wrap=VIRTUAL cols=60><%=rs("B_hui")%></TEXTAREA>
                      <FONT 
            color=#ff6600>*</FONT></TD>
                  </TR>

                  <TR>
                    <TD colSpan=2><DIV align=center>
                      <input type="button" name="Submit" value="提交留言" onClick="check()">
                      &nbsp;
                      <INPUT class=STYLE1 type=reset value=" 重新输入 " name=Submit2>
                      <INPUT id=work type=hidden value=add name=work>
                      <INPUT id=id type=hidden value=<%=Request("id")%> name=id>
                    </DIV></TD>
                  </TR>
                </FORM>
          </TABLE></TD>
        </TR>
      </TBODY>
    </TABLE></td>
  </tr>
  <%
 rs.close
 set rs=nothing
 end if%>
<%IF session("admin_name")<>"" and Request("ok")="ck" Then%>
  <tr>
    <td bgcolor="#FFFFFF">
      <TABLE class=tdtop cellSpacing=0 cellPadding=0 width=100% align=center border=0>
        <TBODY>
          <TR>
		
          </TR>
        </TBODY>
      </TABLE>    </td>
  </tr>
  
  <tr>
    <td bgcolor="#FFFFFF"><TABLE cellSpacing=0 cellPadding=5 width=100% align=center border=0>
      <TBODY>
	  
        <TR>
          <TD colSpan=2><TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
              <TBODY>
                <TR>
                  <TD width="11%">&nbsp; <SPAN class=bigFont>留言列表</SPAN></TD>
                  <TD width="89%">&nbsp;</TD>
                </TR>
              </TBODY>
          </TABLE></TD>
        </TR>
  <%
 shou        =Request("shou")
 if shou="" then
  sql="select * from liuyan order by id DESC"
 else
  sql="select * from liuyan where B_name like '%"&shou&"%' or  B_dom like '%"&shou&"%' order by  id DESC "
 end if
 set rs=server.createobject("adodb.recordset") 
 rs.open sql,conn,1,1
 IF Not rs.eof Then
 proCount=rs.recordcount
	rs.PageSize=20					  '定义显示数目
		if not IsEmpty(Request("ToPage")) then
	       ToPage=CInt(Request("ToPage"))
		   if ToPage>rs.PageCount then
					rs.AbsolutePage=rs.PageCount
					intCurPage=rs.PageCount
		   elseif ToPage<=0 then
					rs.AbsolutePage=1
					intCurPage=1
				else
					rs.AbsolutePage=ToPage
					intCurPage=ToPage
				end if
			else
			        rs.AbsolutePage=1
					intCurPage=1
		  end if
	intCurPage=CInt(intCurPage)
	For i = 1 to rs.PageSize
	if rs.EOF then     
	Exit For 
	end if
%>

        <TR>
          <TD width=20>&nbsp;</TD>
          <TD><b><%=rs("B_name")%></b> 在 (<%=rs("B_date")%>) </TD>
        </TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD><span class="STYLE13">电话: <%=rs("B_tel")%> | QQ/Msn <%=rs("B_msn")%> | E-Mail <%=rs("B_mail")%> | <a href="del.asp?id=<%=rs("id")%>">删除留言</a> | <a href="?work=edit&id=<%=rs("id")%>">修改(回复)留言</a> </span></TD>
        </TR>
        <TR>
          <TD>&nbsp;</TD>
          <TD class=formatU>
		  <%=rs("B_dom")%> <br><br>
		  <span class="STYLE12">
		  <%if trim(rs("B_hui"))<>"" then%>
			  管理员回复: <BR>
                <%=rs("B_hui")%>
				<%end if%>
		  </span></TD>
        </TR>
        <TR>
          <TD colspan="2"><hr size="1"></TD>
          </TR>
<%
rs.MoveNext 
next
%>
        <TR>
          <TD>&nbsp;</TD>
          <TD><TABLE width="100%" align="center">
            <TR>
              <TD>
                  <span style="font-size: 9pt;"> 总共：<font color="#ff0000"><%=rs.PageCount%></font>页, <font color="#ff0000"><%=proCount%></font>条留言, 当前页：<font color="#ff0000"> <%=intCurPage%> </font>
                  <% if intCurPage<>1 then
		  %>
                  <a href="?ToPage=1&shou=<%=shou%>"></a>|<a href="?ToPage=<%=intCurPage-1%>&shou=<%=shou%>">上一页</a>|
                    <% end if
if intCurPage<>rs.PageCount then %>
                  <a href="?ToPage=<%=intCurPage+1%>&shou=<%=shou%>">下一页</a>|<a href="?ToPage=<%=rs.PageCount%>&shou=<%=shou%>"> 最后页</a>|
                    <% end if%>
                  </span></TD>
            </TR>
          </TABLE>
            <%
else
%>
            <TABLE width="80%" align="center">
              <TR>
                <TD>对不起！目前库中没有您要查询记录！[===<span class="style2"><%= Request("shou") %></span>===]</TD>
              </TR>
            </TABLE>
            <%
end if
rs.close
set rs=nothing
%></TD>
        </TR>
      </TBODY>
    </TABLE></td>
  </tr>
<%end if%>
<%
if Request("work")="yz" then
'可以下面设管理员密码 现在的密码是admin admin

session("admin_name")="admin"
Response.Redirect "book_index.asp?ok=ck"

end if
if Request("work")="long" then
%>
  <tr>
    <td bgcolor="#FFFFFF"><form name="form2" method="post" action="book_index.asp?work=yz">
      用户名:
      <input name="L_name" type="text" id="L_name" value="admin">
        密码:
        <label>
        <input name="B_pss" type="text" id="B_pss" value="admin">
        </label>
        <input type="submit" name="Submit4" value="提交">
    </form>
    </td>
  </tr>
  <%end if%>
</table>
<div align="center"></div>
</body>
</html>
