<!--#include file=conn.asp--> 


<%
Set Rs = Server.CreateObject("ADODB.Recordset")
Sql = "Select * From setting"
Rs.Open Sql,conn,1,3
Rs.Movefirst

backimage=Rs("backimage")               '可选1到14之间的任何数，用来指定留言本背景
websitename=Rs("websitename")        '你的网上昵称
website=Rs("website")                            '你的网站首页地址（如没有请填#）
LogName=Rs("LogName")                      '用于登陆和管理的 用户名称
LogPWD= Rs("LogPWD")                         '用于登陆和管理的 用户密码   
outnum=Rs("outnum")                            '每页的留言数
gbookname=Rs("gbookname")              '留言本名字

Rs.Close


IF Request("del")<>"" and Session("PROADMIN")=True Then
   Sql = "Delete From guestbook Where id="&Request("del")
   Conn.Execute(Sql)
End IF

IF Request("del")<>"" and Session("PROADMIN")<>True Then
Response.Write "<script language='javascript'>alert('非法操作!');</script>"
End IF

function code(fString)
    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," ","&nbsp;")
	
    fString = Replace(fString, CHR(13), "")
	fString = Replace(fString, CHR(10) & CHR(10), "<br><br>")
	fString = Replace(fString, CHR(10), "<BR>")
	code = fString
end function




IF Request("POST")<>"" Then
Call WriteData
End IF

Function WriteData

IF Request("author")="" or Request("content")="" Then
 Response.Write "<font color=red size=18>请将 昵称 和 留言内容 填写完全。谢谢。</font>" %><BR><a href="JavaScript:history.back()">返回</a>
 <%
response.end
ELSE


Set Rs = Server.CreateObject("ADODB.Recordset")
Sql = "Select * From guestbook"
Rs.Open Sql,conn,1,3
Rs.AddNew

Rs("e-mail")=Request("e-mail")
Rs("address")=Request("address")
Rs("author")=Request("author")
Rs("content")=Request("content")
Rs("date")=year(now)&"-"&month(now)&"-"&day(now)  
 


Rs.Update
Rs.Close


Set Rs=Nothing
Call CloseDB

Response.Redirect "default.asp"

END IF
End Function
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<META content="轻尘火 LDF在线 轻尘火多彩留言本v1.0" name=keywords>
<title><%=gbookname%></title>
<style type="text/css">
<!--
body {
	background-image: url(back/<%=backimage%>.gif);
}
.style3 {color: #666666}
.style20 {color: #33FF00}
-->
</style></head>
<LINK href="style.css" type=text/css rel=stylesheet>
<body>
<table width=660 height="534" align=center cellpadding=0 cellspacing=0>
  <tbody>
    <tr>
      <td height="66" valign=top background="images/left_1.gif" class="style18">&nbsp;</td>
      <td valign=top background="images/center_1.gif" class="style18">&nbsp;</td>
      <td valign=top background="images/right_1.gif" class="style18">&nbsp;</td>
    </tr>
    <tr>
      <td width="68" height="205" valign=top background="images/left_2.gif" class="style18">&nbsp;</td>
      <td width="555" align="left" valign=top bgcolor="#FFFFFF" class="style18"><table width="550"  border="0" cellspacing="1">
       
        <tr bgcolor="#FFFFCC">
          <td align="center" bgcolor="#FFFFFF" class="style16"><img src="images/top.jpg" width="548" height="80"></td>
          </tr>
        
      </table>      <table width="550"  border="0" cellspacing="1">
          <tr>
            <td background=images/dotlineh.gif colspan=4 height=1></td>
          </tr>
          <tr bgcolor="#FFFFCC">
            <td width="66%" align="left">银色米兰留言本</td>
            <td width="34%" align="center" bgcolor="#FFCEFF" class="style18">
			<%IF Session("PROADMIN")<>True Then%>
			<a href="login.asp" title="管理员对留言本进行管理及回复">管理</a> 
			| 
			<%end if%>
		      <%IF Session("PROADMIN")=True Then%>
			  <a href="config.asp">参数设置</a>|
        &nbsp;<a href=Logout.asp title="管理员退出管理">退出</a> |  
        <%End IF%>
        <a href=<%=website%> title="返回到<%=websitename%>的主页"  target=_blank>返回</a> | </td>
          </tr>
          <tr>
            <td background=images/dotlineh.gif colspan=4 height=1></td>
          </tr>
        </table>
          <table width="550"  border="0" align="center" cellspacing="3" style="table-layout: fixed;word-wrap: break-word">
            <% 
if request("page")<>"" then
page=request("page")
else
page=1
end if			 
			  
 set rs=server.CreateObject("adodb.recordset")  
Sql = "Select * From guestbook Order BY id DESC"
Rs.Open Sql,conn,1,3 
real=rs.recordcount  
TOTAL=real
rs.movefirst

rs.pagesize=outnum
maxpage=rs.pagecount

real=real-(page-1)*outnum
if real>outnum then max=outnum else max=real end if

for count=1 to (page-1)*outnum
rs.movenext
next

for count=1 to max
if count<>1 then%>
            <tr>
              <td colspan=6 height=5></td>
            </tr>
            <tr>
              <td background=images/dotlineh.gif colspan=6 height=1></td>
            </tr>
            <tr>
              <td colspan=6 height=5></td>
            </tr>
            <%end if%>
            <tr class="style1">
              <td width="153" height="100%" class="style1">&nbsp;留言人:<%=rs("author")%></td>
              <td width="116" align="center" class="style1">
			  <%if rs("e-mail")<>"" and rs("e-mail")<>"@" then %>
                  <a href="mailto:<%=rs("e-mail")%>" title="<%=rs("e-mail")%>"><font color=#79a6d2>e-mail</font></a>
              <%end if%></td>
              <td width="104" height="10" align="center" class="style1">
                  <%if rs("address")<>"" and rs("address")<>"http://" then %>
                  <a href="<%=rs("address")%>" target="_blank" title="<%=rs("address")%>"><font color=#79a6d2>主页</font></a>
                  <%else%>
              无主页
              <%end if%></td>
              <td width="154" height="10" align="center" class="style1">&nbsp;留言日期:<%=rs("date")%></td>
            </tr>
            <tr bgcolor="#95DDFF" class="important">
              <td colspan="5" height="100%">
                <span class="important"><%=code(rs("content"))%></span></td>
            </tr>
            <%if rs("reply")<>"" then%>
            <tr align="left" bgcolor="#C4FFD7">
              <td height="23" colspan="5">&nbsp;站长回复：<%=code(rs("reply"))%></td>
            </tr>
            <%end if%>
			 <%IF Session("PROADMIN")=True Then%>
			 <tr align="left" bgcolor="#FF9DB6">
              <td height="23" colspan="2" align="center" class="style18"><a href="default.asp?del=<%=rs("id")%>">删除本条留言</a></td>
			  <td height="23" colspan="3" align="center" class="style18"><a href="edit_r_gBook.asp?id=<%=rs("id")%>">修改或回复本条留言</a></td>
            </tr>
			<%end if%>
            <% rs.movenext
		  next%>
        </table>
          <table width="550"  border="0" cellspacing="1">
            <tr>
              <td background=images/dotlineh.gif colspan=4 height=1></td>
            </tr>
            <tr bgcolor="#FFCEFF" class="style18">
              <td width="37%" align="center" bgcolor="#FFCEFF"><span class="style18">&nbsp;&nbsp;<a href="default.asp?page=1">首页</a> &nbsp;&nbsp;
                  <%if page-1>=1 then%>
                  <a href="default.asp?page=<%=page-1%>">上一页</a>
                  <%else%>
              无上页    
              <%end if%>
&nbsp;&nbsp;
              <%if page+1<=maxpage then%>
              <a href="default.asp?page=<%=page+1%>">下一页</a>
              <%else%>
              无下页            
              <%end if%>
&nbsp;&nbsp; <a href="default.asp?page=<%=maxpage%>">尾页</a></span></td>
              <td width="63%" align="right" class="style18"> 共有留言<%=TOTAL%>项，分为<%=maxpage%>页，这是第<%=page%>页。</td>
            </tr>
            <tr>
              <td background=images/dotlineh.gif colspan=4 height=1></td>
            </tr>
        </table>
      <%Rs.Close
Set Rs=Nothing
Call CloseDB
%>      </td>
      <td width="29" valign=top background="images/right_2.gif" class="style18">&nbsp;</td>
    </tr>
    <tr>
      <td height="200" valign=top background="images/left_2.gif" class="style18">&nbsp;</td>
      <td valign=top bgcolor="#FFFFFF" class="style18"><table width="550" height="211" border="0" align="center" cellpadding="2" cellspacing="1">
          <form name="form1" method="post" action="">
            <input type="hidden" name="POST" value="True">
            <tr align="left" valign="middle">
              <td height="22" colspan="2"><br>
&nbsp;<span class="NO1">&nbsp;欢迎您留言&nbsp;</span>&nbsp;<br>
&nbsp;</td>
            </tr>
            <tr>
              <td width="8%" height="22" align="right">昵称</td>
              <td width="92%" align="left"><input  name="author" type="text" size="25">
                *</td>
            </tr>
             <tr>
              <td height="22" align="right">e-mail</td>
              <td align="left"><input  name="e-mail" type="text" size="25" value="@"></td>
            </tr>
			<tr>
              <td height="22" align="right">主页</td>
              <td align="left"><input  name="address" type="text" size="25" value="http://"></td>
            </tr>
            <tr>
              <td height="67" align="right">内容</td>
              <td align="left" valign="middle"><textarea  rows="5" name="content" style="overflow:auto;width:200;"></textarea>
                *注:不支持HTML语法            </td>
            </tr>
            <tr align="center">
              <td></td>
              <td height="24" colspan="2" align="left"><input name="submit"  type="submit" class="INPUT"   value="提交留言">
&nbsp;&nbsp;
                <input name="重置" type="reset" class="INPUT" value="重写留言">
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
            </tr>
          </form>
      </table></td>
      <td valign=top background="images/right_2.gif" class="style18">&nbsp;</td>
    </tr>
    <tr>
      <td height="38" valign=top background="images/left_3.gif" class="style18">&nbsp;</td>
      <td align="right" valign=middle background="images/center_2.gif" bgcolor="#FFFFFF" class="style19">&nbsp;</td>
      <td valign=top background="images/right_3.gif" class="style18">&nbsp;</td>
    </tr>
</table>
<table width="554"  border="0" align="center" cellspacing="1">
  <tr>
    <td align="center"><span class="style3">Copyright&copy;2004 秦皇岛银色米兰裘皮有限公司 All Right Reserved <br>
设计/维护 商景网络公司版权所有　　Tel:0335-3645836 <br>
</span><span class="style20"><a href="http://www.qhd-sj.com/">中国商景 </a></span><span class="style3">技术支持 </span></td>
  </tr>
</table>
</body>
</html>
