<!--#include file="../conn.asp"-->
<!--#include file="../inc/class_page.asp" -->
<%
dim m_querystring,cid,id
m_querystring=split(Split(replace(Request.ServerVariables("QUERY_STRING"),".html","") & "_","_")(0) & "-" ,"-")
cid=m_querystring(0)
id=m_querystring(1)
cpage=Split(replace(Request.ServerVariables("QUERY_STRING"),".html","") & "_","_")(1)
%>
<%
Select Case request("action")
	Case "save"
	    if trim(Session("safecode")) <> trim(Request("Code")) then 
            ErrorMessage = "请输入正确的验证码" 
            response.write(" <script>alert('"&ErrorMessage&"');location.href='" & ay_directory & "/book' </script>") 
            response.end 
        end if 
		Dim ad_bAddUser,ad_bIpAddress,ad_bContent,ad_bReply
		ad_bAddUser=request("bAddUser")
		ad_bIpAddress=GetIPAddress()
		ad_bContent=request("bContent")
		ad_bReply=""		
		set rs=server.createobject("adodb.recordset")
		sql="select top 1 * from Ay_Book "	
		rs.open sql,conn,1,3	
		rs.addnew
		rs("bAddUser")=server.htmlencode(ad_bAddUser)
		rs("bTitle")=server.htmlencode(request("bTitle"))
		rs("bIpAddress")=ad_bIpAddress
		rs("bContent")=server.htmlencode(ad_bContent)
		rs("bIsPass")=1		
		rs("bReply")=ad_bReply
		rs("bAddTime")=now			
		rs.update
		if rs.state<>0 then rs.close
		set rs=nothing
		response.write "<script>alert('非常感谢！你的留言已经成功提交。');window.location.href='" & ay_directory & "/book';</script>"
		response.end	
End select
%>
<!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" />
<meta name="copyright" content="Copyright 2009-2011 - 天缘网络 www.tywork.net" />
<meta name="Author" content="天缘网络" />
<title>在线留言_<%=ay_sitename%></title>
<meta name="keywords" content="<%=ay_keywords%>" />
<meta name="description" content="<%=ay_description%>" />
<link href="<%=ay_directory%>/images/style.css" rel="stylesheet" type="text/css" />
<script src="<%=ay_directory%>/user.js" type="text/javascript"></script>
<script language="javascript">
function check()
{
if (document.chatform.bAddUser.value=="")
{
	alert("请留下您的大名！");
	document.chatform.bAddUser.focus();
	return false;
}
if (document.chatform.bTitle.value=="")
{
	alert("标题不能为空！");
	document.chatform.bTitle.focus();
	return false;
}
if (document.chatform.bContent.value=="")
{
	alert("请输入留言内容！");
	document.chatform.bContent.focus();
	return false;
}
if(document.chatform.Code.value=="")
{
    alert('验证码为空！');
    return false;
}  
}
    </script>

</head>
<body>

<%Call tycms_header()%>
<div id="menu" class="layout">
<%Call tycms_navigation()%>
</div>

<div id="time" class="layout">
<div id="time_l"></div>
<div id="time_c">
  <table width="972" height="37" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
      <td width="91">欢迎访问本站！</td>
      <td width="245"><iframe src="http://m.weather.com.cn/m/pn8/weather.htm " width="240" height="20" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe></td>
      <td width="333"><%Call tycms_login()%></td>
      <td width="68">站内搜索：</td>
      <td width="235"><%Call tycms_search_form()%></td>
      </tr>
  </table>
</div>
<div id="time_r"></div>
</div>

<div id="box" class="layout">

<div class="side">

<div class="side_title">推荐图文</div>
<DIV class="side_content">
		<ul class="pic_text">
				<%call tycms_best_pic_list(classid)%>
				</ul>
</div>

<div class="side_title">推荐内容</div>
<DIV class="side_content">
		<ul class="hot">
				<%call tycms_best_text_list("")%>
				</ul>
</div>

</div>

<div class="right">
<div class="right_title">
<span class="right_ico"></span>
<span class="right_address">当前位置：<a href="<%=ay_directory%>/"><%=ay_sitename%></a>&nbsp;&gt;&nbsp;留言列表</span></div>
<div class="right_content">
<%
			dim curpage
			
			sql="select a.* from Ay_Book a order by a.bId desc,bAddTime desc"
			Set rs=Server.CreateObject("Adodb.Recordset")
			Set mypage=new xdownpage
			mypage.getconn=conn
			mypage.getsql=sql
			mypage.pagesize=10
			set rs=mypage.getrs()	
			if cpage<>"" then
				curpage=clng(cpage+0)
			else
				curpage=1
			end if					
			for i=1 to mypage.pagesize
			if rs.eof  then exit for										
				%>
				<div class="pinlun_t">时间：<%=FormatDate(rs("bAddTime"),"1")%>来自：<%=Trim(rs("bIpAddress")&"")%>留言：<font color="#3b78af"><%=Trim(rs("bTitle")&"")%></font></div>
<div class="pinlun_co"><%=replace(Trim(rs("bContent")&""),vbcrlf,"<br>")%></div>
<div class="pinlun_co"><%=replace(Trim(rs("bReply")&""),vbcrlf,"<br>")%></div>
				<%	
			rs.MoveNext 
		next		
		if rs.State <>0 then rs.Close 
		set rs=nothing
				%>
			<ul class="pagelist">
				<%call mypage.showpage()%>
			</ul>	
<table width="95%" border="0" cellspacing="10" cellpadding="2">
				<form autocomplete="off" name="chatform" id="chatform" onsubmit="return check();" action="<%=ay_directory%>/book/default.asp"
					method="post">
					<tr>
						<td width="60" align="center">昵称：</td>
						<td>
							<input type="text" name="bAddUser" id="bAddUser" class="input_blur">&nbsp;&nbsp; 验证码：<input type="text" name="Code"
								id="Code" size="5" class="input_blur"><span style="background: #FFFFFF; padding: 3px;"><img id="CodeImage"
									src="<%=ay_directory%>/inc/code.asp" align="absmiddle"></span></td>
					</tr>
					<tr>
						<td align="center">标题：</td>
						<td><input type="text" name="bTitle" id="bTitle" size="50" class="input_blur"></td>
					</tr>
					<tr>
						<td align="center" valign="top">内容：</td>
						<td><textarea name="bContent" cols="60" rows="6"></textarea></td>
					</tr>
					<tr>
						<td>
						</td>
						<td>
							<input type="submit" value="提交留言" class="button_style">
							<input type="hidden" id="action" name="action" value="save">
							</td>
					</tr>
				</form>
			</table>
</div>
</div>

</div>
</div>

<div id="links" class="layout">
<%Call tycms_links()%>
</div>
<div class="bottom layout">
<%Call tycms_footer()%></div>

</body>
</html>
