savecomment.asp
来自「是个不错的文件代码,希望大家好好用,」· ASP 代码 · 共 120 行
ASP
120 行
<!--#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 logid,rs,username,password,blog,isguest,comment,mainuserid,commenttopic,sCheck
logid=clng(request("logid"))
username=oblog.filt_badstr(trim(request.form("username")))
comment=trim(request.form("oblog_edittext"))
commenttopic=trim(request.Form("commenttopic"))
if username="" or oblog.strLength(username)>20 then oblog.adderrstr("名字不能为空且不能大于20个字符!")
if oblog.chk_badword(username)>0 then oblog.adderrstr("名字中含有系统不允许的字符!")
if comment="" or oblog.strLength(comment)>Int(oblog.CacheConfig(35)) then oblog.adderrstr("回复内容不能为空且不能大于"&oblog.CacheConfig(35)&"英文字符!")
if oblog.chk_badword(comment)>0 then oblog.adderrstr("回复内容中含有系统不允许的字符!")
if commenttopic="" or oblog.strLength(commenttopic)>200 then oblog.adderrstr("回复标题不能为空且不能大于200英文字符!")
if oblog.chk_badword(commenttopic)>0 then oblog.adderrstr("回复标题中含有系统不允许的字符!")
if oblog.chk_badword(request.Form("homepage"))>0 then oblog.adderrstr("主页地址中含有系统不允许的字符!")
sCheck=antiSpam("1")
If sCheck<>"" Then oblog.adderrstr(sCheck)
if oblog.errstr<>"" then oblog.showok replace(oblog.errstr,"_","\n"),"back":response.End()
comment= EncodeJP(oblog.filtpath(oblog.filt_badword(comment)))
if oblog.errstr<>"" then oblog.showerr:response.End()
isguest=1
password=trim(request.form("password"))
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
'增加对加密日志的处理,防止通过URL连接或软件方式对日志进行回复
set rs=oblog.execute("select userid,ispassword,ishide,isencomment from oblog_log where logid="&logid)
if rs.eof then response.Write("参数错误"):set rs=nothing:response.End()
If rs("isencomment")<>"1" Then response.Write("该日志不允许回复"):set rs=nothing:response.End()
If request.Cookies(cookies_name)("logpw_"&logid)<>rs("ispassword") Then
response.Write("错误的操作!")
Set rs=nothing
Response.End()
End If
mainuserid=rs(0)
set rs=server.CreateObject("adodb.recordset")
rs.open "select top 1 * from oblog_comment",conn,2,2
rs.addnew
rs("mainid")=logid
rs("userid")=mainuserid
rs("comment_user")=EncodeJP(username)
rs("commenttopic")=EncodeJP(oblog.InterceptStr(oblog.filt_badword(commenttopic),250))
rs("comment")=comment
rs("homepage")=oblog.InterceptStr(request.Form("homepage"),250)
rs("addtime")=ServerDate(now())
rs("addip")=oblog.userip
rs("isguest")=isguest
rs("ubbedit")=1
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(6)
End if
oblog.execute("update oblog_log set commentnum=commentnum+1 where logid="&logid)
oblog.execute("update oblog_user set comment_count=comment_count+1,lastcomment='" & Serverdate(Now()) &"',scores=scores+" & scores&" where userid="&mainuserid)
oblog.execute("update oblog_setup set comment_count=comment_count+1")
Session("chk_commenttime")=ServerDate(now())
Response.Cookies(cookies_name)("LastComment") = ServerDate(now())
If oblog.CacheConfig(50)=0 Then
oblog.showok "评论成功,审核后可见", ""
response.End
Else
blog.userid=mainuserid
'blog.update_comment(mainuserid)
Server.ScriptTimeOut=99999
blog.update_log logid,3
blog.update_comment mainuserid
End If
'Call blog.CreateFunctionPage
if request("t")="1" then
response.Redirect("more.asp?id="&logid)
Else
response.Redirect(blog.gourl)
end if
set blog=nothing
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?