<!--#include file="inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/function.asp"-->
<!--#include file="inc/strutil.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>发表评论</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="refresh" content="1;URL=<%=request.ServerVariables("HTTP_REFERER")%>">
</head>
<body>
<%
dim author,content,userip,classid,id,ischeck,face

if(OpenCommen<>true) then
	response.Write("系统暂停了评论功能")
	response.End()
end if
if(CheckCommen=true) then
	ischeck=0
else
	ischeck=1
end if
if  Cstr(request.Form("vertcode")) <> Cstr(Session("GetCode"))  then 
	response.Write("<script>alert(""验证码错误！请返回刷新页面后再试。"");history.back();</script>")
	Response.End
end if
author=replace(trim(request.Form("author")),"'","")
if(checkForbidStr(author)=false) then
	response.Write("<script>alert(""您的评论中含有非法字符！"");history.back();</script>")
	response.End()
end if
author=tohtml(author)
content=replace(trim(request.Form("content")),"'","")
if(checkForbidStr(content)=false) then
	response.Write("<script>alert(""您的评论中含有非法字符！"");history.back();</script>")
	response.End()
end if
content=tohtml(content)
userip = Request.ServerVariables("HTTP_X_FORWARDED_FOR")
if userip = "" then 
userip = Request.ServerVariables("REMOTE_ADDR")
end if
classid=Clng(trim(request.Form("mode")))
id=Clng(trim(request.Form("id")))
face=Cint(request.Form("face"))
if(content="" or len(content)<1) then
	response.Write("内容不能为空!")
	response.End()
else
	set rs=server.CreateObject("adodb.recordset") 
	rs.open "select * from commen where 1=0 order by id desc",conn,3,3
	rs.addnew
	rs("username")=author
	rs("content")=content
	rs("moditime")=now
	rs("classid")=classid
	rs("articleid")=id
	rs("userip")=userip
	rs("ischeck")=ischeck
	rs("face")=face
	rs("isrem")=0
	rs.update
	rs.close
	set rs=nothing
	Session("GetCode")=""
end if
conn.execute("update news set commennum=commennum+1 where id="&id)
%>成功发表评论，正在转入，请稍候.................
</body>
</html>
<%
call connclose
%>
</body>
</html>
