<!--#include file="Inc/Cls_DB.asp" -->
<!--#include file="Inc/Const.asp" -->
<!--#include file="Inc/Md5.asp" -->
<% 
'==============================================================================
'产品目录：风讯产品N系列
'软件名称：风讯网站信息管理系统
'当前版本：Foosun Content Manager System V2.0
'最新更新：2005.1
'==============================================================================
'Copyright (C) 2002-2004 Foosun.Net  All rights reserved.
'商业注册联系：028-85098980-601,技术支持：028-85098980-606、607,客户支持：608
'产品咨询QQ：159410,655071 
'技术支持QQ：66252421 
'程序开发：风讯开发组 & 风讯插件开发组
'Email:service@cooin.com
'论坛支持：风讯在线论坛(http://bbs.foosun.net,http://bbs.aspsun.cn,http://bbs.cooin.com)
'官方网站：www.Foosun.net  演示站点：www.cooin.com    开发者园地：www.aspsun.cn
'==============================================================================
'免费版本请在新闻首页保留版权信息，并做上本站LOGO友情连接
'风讯在线保留此程序的法律追究权利
'==============================================================================
Set DBC = New DataBaseClass
Set Conn = DBC.OpenConnection()
Set DBC = Nothing
%>
<!--#include file="Inc/Function.asp" -->
<%
if Request("Newsid")="" Then
		Response.Write("<script>alert(""错误：\n错误的参数,请检查"");location.href=""javascript:history.go(-1)"";</script>")
		Response.End
end if
Dim TempRsNewsObj,TempFlag
TempFlag = true
Set TempRsNewsObj = Conn.Execute("Select ReviewTF from News where Newsid='" & Replace(trim(request("Newsid")),"'","''") & "'")
if Not TempRsNewsObj.Eof then
	if cint(TempRsNewsObj("ReviewTF")) = 0 then
		TempFlag = False
	end if
else
	TempFlag = False
end if
if TempFlag = False then
		Response.Write("<script>alert(""错误：\n此新闻不允许评论"");location.href=""javascript:history.go(-1)"";</script>")
		Response.End
end if
if request.Form("action")="add" then
	if  request.Form("NoName")="" then
		if request.Form("MemName")="" then
			Response.Write("<script>alert(""错误：\n请填写您的用户名，匿名用户请选择！"");location.href=""javascript:history.go(-1)"";</script>")
			Response.End
		end if 
		if request.Form("Password")="" then
			Response.Write("<script>alert(""错误：\n请填写您的密码！"");location.href=""javascript:history.go(-1)"";</script>")
			Response.End
		end if
		set Rs = server.CreateObject ("ADODB.RecordSet")
		Sql = "select * from Members where MemName='" &Replace(trim(request("MemName")),"'","''")&"' and Password='"&MD5(Replace(trim(request("Password")),"'","''"),16)&"'"
		Rs.Open Sql,Conn,1,3
		if rs.eof then
			Response.Write("<script>alert(""错误：\n没有这个用户,或者密码错误，请重新填写！"");location.href=""javascript:history.go(-1)"";</script>")
			Response.End
	    Else
			Session("MemName") = Rs("MemName")
			Session("MemPassWord") = Rs("Password")
			Session("MemID") = Rs("ID")
			Session("GroupID") = Rs("GroupID")
			Session("Point") = Rs("Point")
			Response.Cookies("Foosun")("MemName") = Rs("MemName")
			Response.Cookies("Foosun")("MemPassword") = Rs("Password")
			Response.Cookies("Foosun")("MemID") = Rs("ID")
			Response.Cookies("Foosun")("GroupID") = Rs("GroupID")
			Response.Cookies("Foosun")("Point") = Rs("Point")
			Dim Rscon
			set Rscon= conn.execute("select NumberContPoint,NumberLoginPoint from Config")
			conn.execute("update members set LoginNum=LoginNum+1,Point=Point+"&clng(Rscon("NumberLoginPoint"))&",LastLoginIP='"&trim(Request.ServerVariables("Remote_ADDR"))&"',LastLoginTime=date() where MemName='"&Rs("MemName")&"'")'用户登陆一次，积分+1分
			Rscon.close
			set Rscon=nothing
		end if 
	end if
		if request.Form("RevContent")="" then
			Response.Write("<script>alert(""错误：\n请输入评论内容！"");location.href=""javascript:history.go(-1)"";</script>")
			Response.End
		end if
		if Len(request.Form("RevContent"))>300 then
			Response.Write("<script>alert(""错误：\n评论不能大于300个字符！"");location.href=""javascript:history.go(-1)"";</script>")
			Response.End
		end if
		set Rs1 = server.CreateObject ("ADODB.RecordSet")
		Sql1 = "select * from Review"
		Rs1.Open Sql1,Conn,1,3
		Rs1.addnew
		if Request.Form("NoName")="" then
			Rs1("UserID")=Replace(request("MemName"),"'","''")
		else
			Rs1("UserID")="匿名"
		end if
		Rs1("NewsID")=Replace(Request.form("NewsID"),"'","''")
		Rs1("Content")=Request.form("RevContent")
		Rs1("IP")=Request.ServerVariables("Remote_Addr")
		Rs1("AddTime")=now()
		Rs1("Isv")=1
		Rs1.update
		Response.Redirect("NewsReview.asp?Newsid="& Request.Form("Newsid")&"") 
		response.end 
end if
strpage=request.querystring("page")
		if len(strpage)=0 then
		strpage="1"
		end if
set Rs = server.CreateObject ("ADODB.RecordSet")
Sql = "select * from Review where Newsid='" &Replace(request("Newsid"),"'","''")&"' and isv=1 order by ID desc"
Rs.Open Sql,Conn,1,3
%>
<title>用户评论</title>
<link href="CSS/css.css" rel="stylesheet">
<body bgcolor="#FFFFFF">

  
<table width="74%" border="0" align="center" cellpadding="8" cellspacing="1" class="tabbgcolor">
  <tr class="tabbgcolorliWhite">
    <td colspan="2"><font color="#999999">&lt;!----评论模板请自行修改--&gt;</font></td>
  </tr>
  <tr class="tabbgcolorliWhite"> 
    <td width="78%" colspan="2"><form name="form1" method="post" action="">
        <table width="100%" border="0" cellpadding="5" cellspacing="1" class="tabbgcolor">
          <tr bgcolor="#F7F7F7"> 
            <td width="21%"> <div align="right">会员名称：</div></td>
            <td width="79%"> <input name="MemName" type="text" id="MemName" value="<%=session("MemName")%>"> 
              <input name="NoName" type="checkbox" id="NoName" value="1">
              匿名 <font color="#FF0000">·</font><a href="User/Reg.asp"><font color="#FF0000">注册用户</font></a> 
              <a href="User/UserForGet.asp">·忘记密码？</a></td>
          </tr>
          <tr bgcolor="#F7F7F7"> 
            <td> <div align="right">密码：</div></td>
            <td> <input name="Password" type="password" id="Password"> <input name="Newsid" type="hidden" id="Newsid" value="<%=trim(Request("Newsid"))%>"> 
              <input name="action" type="hidden" id="action" value="add"></td>
          </tr>
          <tr bgcolor="#F7F7F7"> 
            <td> <div align="right">评论内容：<br>
                (最多300个字符) </div></td>
            <td> <textarea name="RevContent" cols="60" rows="6" id="RevContent"></textarea></td>
          </tr>
          <tr bgcolor="#F7F7F7"> 
            <td>&nbsp;</td>
            <td> <input type="submit" name="Submit" value="发表"></td>
          </tr>
        </table>
      </form>
      <%
if Rs.eof and Rs.bof then
	Response.write "<p align='center'> 未找到评论</p>"
	Else
	rs.pagesize=20
	rs.absolutepage=cint(strpage)
	select_count=rs.recordcount
	select_pagecount=rs.pagecount
	%> <table width="100%" border="0" cellspacing="0" cellpadding="6">
        <%
		'style="TABLE-LAYOUT:fixed;word-break:break-all"
		 for i=1 to rs.pagesize
		if rs.eof then
		exit for
		end if
		%>
        <tr> 
          <td height="20" colspan="2" bgcolor="#F5F5F5">·来自：<font color="#0000FF"><%=rs("IP")%></font>的<font color="#FF0000"> 
            <%
		  set Rs2 = server.CreateObject ("ADODB.RecordSet")
		 Sql2 = "select * from Members where MemName='" &Replace(rs("Userid"),"'","''")&"'"
		 Rs2.Open Sql2,Conn,1,3
		  if rs("Userid")="匿名" or rs("Userid")="" then
		     Members="匿名用户"
		  else
		     Members="<a href=User/ShowUser.asp?Id="&rs("ID")&" target=_blank>"&rs("Userid")&"</a>"
		  end if		  
		  %>
            </font><strong> 
            <% = Members%>
            </strong>于<%=rs("AddTime")%>对 
            <%
			set Rs1 = server.CreateObject ("ADODB.RecordSet")
			Sql1 = "select * from News where NewsId='" &Replace(request("NewsId"),"'","''")&"'"
			Rs1.Open Sql1,Conn,1,1
		    %> <font color="#FF0000"><%=rs1("Title")%></font> <%
			rs1.close
			set rs1=nothing
			%>
            发表的的评论：</td>
        </tr>
        <tr> 
          <td height="40" colspan="2">
		  <div style="word-break: break-all ;"><%=replace(rs("Content"),chr(13),"<br>")%></div>
		  </td>
        </tr>
        <%
	  rs.movenext
	 next

	%>
      </table>
      <%
	   response.write"&nbsp;&nbsp;共<b>"& select_pagecount &"</b>页<b>" & select_count &"</b>条记录，本页是第<b>"& strpage &"</b>页。"
		if int(strpage)>1 then
		    response.Write"&nbsp;&nbsp;&nbsp;<a href=?page=1&Newsid="&Request("Newsid")&">第一页</a>&nbsp;"
		    response.Write"&nbsp;&nbsp;&nbsp;<a href=?page="&cstr(cint(strpage)-1)&"&Newsid="&Request("Newsid")&">上一页</a>&nbsp;"
			end if
			if int(strpage)<select_pagecount then
			response.Write"&nbsp;&nbsp;&nbsp;<a href=?page="&cstr(cint(strpage)+1)&"&Newsid="&Request("Newsid")&">下一页</a>"
			response.Write"&nbsp;&nbsp;&nbsp;<a href=?page="& select_pagecount &"&Newsid="&Request("Newsid")&">最后一页</a>&nbsp;"
			end if
			response.Write"<br>"
       end if%> <table width="100%" border="0" cellspacing="0" cellpadding="0">
        <tr> 
          <td> </td>
        </tr>
      </table></td>
  </tr>
</table>
