<!--#include file="inc/inc_syssite.asp"-->
<!--#include file="inc/class_blog.asp"-->
<!--#include file="inc/inc_antispam.asp"-->
<!--#include file="inc/md5.asp"-->
<%
If Application(cache_name_user&"_systemenmod")<>"" Then
	Dim enStr
	enStr=Application(cache_name_user&"_systemenmod")
	enStr=Split(enStr,",")
	If enStr(0)="1" Then	response.write("系统临时禁止留言!"):response.End()
End If
if oblog.chkiplock() then response.write("你的ip已经被系统锁定!"):response.End()
if oblog.ChkPost()=false then response.write("不允许从外部提交"):response.End()
oblog.chk_commenttime
dim userid,rs,username,password,blog,isguest,message,mainuserid,messagetopic,homepage,ishide,sCheck
userid=clng(request("userid"))
username=trim(request.form("username"))
message=trim(request.form("oblog_edittext"))
messagetopic=trim(request.Form("commenttopic"))
ishide=trim(request.Form("ishide"))
homepage=oblog.InterceptStr(request.Form("homepage"),250)
if username="" or oblog.strLength(username)>20 then oblog.adderrstr("名字不能为空且不能大于20个字符！")
if oblog.chk_badword(username)>0 then oblog.adderrstr("名字中含有系统不允许的字符！")
if message="" or oblog.strLength(message)>Int(oblog.CacheConfig(35)) then oblog.adderrstr("留言内容不能为空且不能大于"&oblog.CacheConfig(35)&"英文字符)！")
if oblog.chk_badword(message)>0 then oblog.adderrstr("留言内容中含有系统不允许的字符！")
if messagetopic="" or oblog.strLength(messagetopic)>200 then oblog.adderrstr("留言标题不能为空且不能大于200英文字符)！")
if oblog.chk_badword(messagetopic)>0 then oblog.adderrstr("留言标题中含有系统不允许的字符！")
if oblog.chk_badword(homepage)>0 then oblog.adderrstr("主页连接中含有系统不允许的字符！")
'If C_SEditor_HTML=0 Then message=RemoveUBB(RemoveHtml(message))
sCheck=antiSpam("2")
If sCheck<>"" Then oblog.adderrstr(sCheck)
if oblog.errstr<>"" then oblog.showok replace(oblog.errstr,"_","\n"),"back":response.End()
message=EncodeJP(oblog.filtpath(oblog.filt_badword(message)))
isguest=1
password=trim(request.form("password"))
if ishide<>"" then ishide=cint(ishide) else ishide=0
if oblog.CacheConfig(27)=0 or password<>"" then
	if oblog.checkuserlogined()=false then
		password=md5(password)
		oblog.ob_chklogin username,password,0
	end if
	isguest=0
end if
if oblog.CacheConfig(27)=0 Then
	If oblog.checkuserlogined()=false then
		oblog.showok "需要登录后才能发表评论","back"
		Response.End
	Else
		If oblog.l_ulevel="6" Then
			oblog.showok "您没有通过管理员审核，不能发表评论","back"
			response.End()
		End If
	End If
End If

if oblog.CacheConfig(30)=1 Then
	If  request("CodeStr")="" then
		oblog.showok "验证码错误，请重新输入","back"
		response.End()
	Else
		if not oblog.codepass then oblog.showok "验证码错误，请重新输入","back":response.End()
	End If
end if
if oblog.checkuserlogined()=True Then username = oblog.l_uname
'Process...
set blog=new class_blog
if not IsObject(conn) then link_database
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 1 * from oblog_message",conn,2,2
rs.addnew
rs("userid")=userid
rs("message_user")=EncodeJP(oblog.filt_badword(username))
rs("messagetopic")=EncodeJP(oblog.InterceptStr(oblog.filt_badword(messagetopic),250))
rs("message")=message
rs("homepage")=homepage
rs("addtime")=ServerDate(now())
rs("addip")=oblog.userip
rs("isguest")=isguest
rs("ishide")=ishide
rs("istate")=oblog.CacheConfig(50)
rs.update
rs.close
set rs=Nothing
Dim scores
If oblog.CacheConfig(50) = 0 Then
	scores=0
Else 
	scores=oblog.CacheScores(5)
End if
oblog.execute("update oblog_user set message_count=message_count+1 ,lastmessage='" & Serverdate(Now()) &"' ,scores=scores+" & scores&" where userid="&userid)
oblog.execute("update oblog_setup set message_count=message_count+1")
Session("chk_commenttime")=ServerDate(now())
Response.Cookies(cookies_name)("LastComment") = ServerDate(now())
If oblog.CacheConfig(50)=0 Then 
	Set blog=Nothing
	oblog.showok "留言成功，审核后可见", ""
Else 
	blog.userid=userid
	blog.update_message 3
	blog.update_newmessage userid
	Dim GoUrl
	GoUrl=blog.gourl
	Set blog=Nothing
	response.Redirect GoUrl
End if
%>