<!--#include file="conn/conn_index.asp"-->
<!--#include file="inc/setup.asp"-->
<!--#include file="inc/char.asp"-->
<!--#include file="inc/sql.asp"-->
<%
	end if
	if Trim(Request.QueryString("action"))="save" then
		tname=ReplaceBadChar(Trim(Request.Form("tname")))
		nid=ReplaceBadChar(int(Trim(Request.Form("nid"))))
		type1=ReplaceBadChar(int(Trim(Request.Form("type"))))
		content=ReplaceBadChar(Trim(Request.Form("content")))
		isGuest=ReplaceBadChar(Trim(Request.Form("isGuest")))
		if isGuest="" then isGuest=1
		addip=request.servervariables("remote_host")
		if talknews=1 then
			zhuangtai=0
		else
			zhuangtai=1
		end if
		
		set rs=server.createobject("adodb.recordset")
		sql="select * from talknews"
		rs.open sql,conn,2,3
		rs.addnew
		rs("nid")=nid
		rs("tname")=tname
		rs("isGuest")=isGuest
		rs("content")=content
		rs("stime")=now()
		rs("zhuangtai")=zhuangtai
		rs("addip")=addip
		rs.update
		rs.close
		set rs=nothing
		
		if zhuangtai=0 then
			response.write "<script language=JavaScript>" & "alert('评论成功，感谢您的支持');" & "history.back()" & "</script>"
			response.end
		else
			response.write "<script language=JavaScript>" & "alert('评论成功，但您暂时无法浏览到您的评论信息，感谢您的支持');" & "history.back()" & "</script>"
			response.end
		end if
	end if
%>
<style type="text/css">
<!--
.STYLE1 {font-weight: bold}
.mt { padding-top:10px;}
-->
</style>
<link href="css/dgjob.css" rel="stylesheet" type="text/css">
<table cellspacing="0" cellpadding="3" align="center" rules="all" border="1" id="dg_personlist" style="background-color:White;border-color:#CCCCCC;border-width:0px;border-style:None;width:977px;border-collapse:collapse;">
  <tr bgcolor="#EAEAEA">
              <td height="29" colspan="5" align="left" bgcolor="#EAEAEA" class="bz">&nbsp;&nbsp;评论列表&nbsp;</td>
  </tr>
      <tr align="left" valign="middle" style="color:White;background-color:#00CCFF;">
        <td width="39" align="center" bgcolor="#CCCCCC">编号</td>
        <td width="73" align="center" bgcolor="#CCCCCC">呢称</td>
        <td width="407" align="center" bgcolor="#CCCCCC">内容</td>
        <td width="115" align="center" bgcolor="#CCCCCC">评论时间</td>
        <td width="112" align="center" bgcolor="#CCCCCC">评论者IP</td>
      </tr>
<%
	set rs_news=server.createobject("adodb.recordset")
	sql="select * from talknews where nid="&ReplaceBadChar(int(Trim(Request.QueryString("nid"))))&" and zhuangtai=1 order by id desc"
	rs_news.PageSize = 20 '这里设定每页显示的记录数
	rs_news.CursorLocation = 3
	rs_news.Open sql,conn,0,2,1 '这里执行你查询SQL并获得结果记录集
	pre = true
	last = true
	page = trim(Request.QueryString("page"))'变量是跳转页面时的值
	i=1
	j=1
	if rs_news.eof then
%>
      <tr align="left" valign="middle" style="color:#000066;">
        <td align="center" colspan="5">该新闻暂时还没有相关评论</td>
      </tr>
<%
	else
		if len(page) = 0 then
			intpage = 1
			pre = false
		else
			if cint(page) =< 1 then
				intpage = 1
				pre = false
			else
				if cint(page) >= rs_news.PageCount then
					intpage = rs_news.PageCount
					last = false
				else
					intpage = cint(page)
				end if
			end if
		end if
		if not rs_news.eof then
			rs_news.AbsolutePage = intpage
		end if
		for a=1 to rs_news.recordcount
		if j=1 then col="#FFFFFF"
		if j=-1 then col="#EFFBF8"
%>
      <tr align="left" valign="middle" style="color:#000066;background-color:<%= col %>;">
        <td align="center"><%= i %></td>
        <td align="center"><% if rs_news("isguest")=0 then Response.Write("匿名用户") else Response.Write(rs_news("tname"))%></td>
        <td><%= rs_news("content") %></td>
        <td align="center"><%= rs_news("stime") %></td>
        <td align="center"><%= rs_news("addip") %></td>
      </tr>
<%
		rs_news.movenext
		i=i+1
		j=j*-1
		if rs_news.eof then exit for
		next
	end if
%>
<tr>
<td colspan="5" style="background-color: #FFFFFF">
<table width="99%" border="0" cellpadding="2" cellspacing="2" borderColorLight=#808080 borderColorDark=#ffffff>
<tr>
<%if rs_news.pagecount > 0 then%>
<td width="13%" align="left">当前页<%=intpage%>/<%=rs_news.PageCount%></td>
<%else%>
<td width="41%" align="left">当前页0/0</td><%end if%>
<td width="46%" align="right"> <a href="?page=1&nid=<%= Trim(Request.QueryString("nid")) %>">首页</a>|
<%if pre then%>
<a href="?page=<%=intpage -1%>&nid=<%= Trim(Request.QueryString("nid")) %>">上页</a>| <%end if%>
<%if last then%>
<a href="?page=<%=intpage +1%>&nid=<%= Trim(Request.QueryString("nid")) %>">下页</a> |<%end if%>
<a href="?page=<%=rs_news.PageCount%>&nid=<%= Trim(Request.QueryString("nid")) %>">尾页</a>|转到第
<select name="sel_page" onchange=javascript:location.href=this.options[this.selectedIndex].value>
<%
	for i = 1 to rs_news.PageCount
	if i = intpage then
%>
<option value="?page=<%=i%>&nid=<%= Trim(Request.QueryString("nid")) %>" selected><%=i%></option>
<%else%> 
<option value="?page=<%=i%>&nid=<%= Trim(Request.QueryString("nid")) %>"><%=i%></option>
<%
	end if
	next
	rs_news.close
	set rs_news=nothing
	call closeconn()
%>
</select>页</font>
</td>
</tr>
</table>
</body>
</html>
