%
dim CommentPurviewGrade,CommentUserGrade
UserLogined=CheckUserLogined()
if UserLevel="" then
UserLevel=9999
else
UserLevel=Cint(UserLevel)
end if
select case UserLevel
case 9999
CommentUserGrade="游客"
case 999
CommentUserGrade="注册用户"
case 99
CommentUserGrade="收费用户"
case 9
CommentUserGrade="VIP用户"
case 5
CommentUserGrade="管理员"
end select
select case CommentPurview
case 9999
CommentPurviewGrade="游客"
case 999
CommentPurviewGrade="注册用户"
case 99
CommentPurviewGrade="收费用户"
case 9
CommentPurviewGrade="VIP用户"
case 5
CommentPurviewGrade="管理员"
end select
if CommentPurview
"
end if
dim ArticleID,Action,ErrMsg,FoundErr
dim Commented,CommentedID,arrCommentedID,i
Action=trim(request("Action"))
ArticleID=trim(request("ArticleID"))
Commented=False
CommentedID=""'session("CommentedID")
if ArticleId="" then
founderr=true
errmsg=errmsg+"
请指定要评论的文章ID
"
else
ArticleID=Clng(ArticleID)
end if
if CommentedID<>"" then
if instr(CommentedID,"|")>0 then
arrCommentedID=split(CommentedID,"|")
for i=0 to ubound(arrCommentedID)
if Clng(arrCommentedID(i))=ArticleID then
Commented=True
exit for
end if
next
else
if Clng(CommentedID)=ArticleID then
Commented=True
end if
end if
end if
if Commented=True then
FoundErr=True
ErrMsg=ErrMsg & "
你已经对该篇文章发表过评论了!请勿连续对同一篇文章发表评论。
"
end if
if FoundErr<>True then
if Action="Save" then
call SaveComment()
else
call main()
end if
end if
if FoundErr=True then
call WriteErrMsg()
end if
call CloseConn()
sub main()
%>
发表评论
<%
end sub
sub SaveComment()
dim rsComment,ClassID,tClass
dim CommentUserType,CommentUserName,CommentUserSex,CommentUserEmail,CommentUserOicq
dim CommentUserIcq,CommentUserMsn,CommentUserHomepage,CommentUserScore,CommentUserContent
if UserLogined=false then
CommentUserType=0
CommentUserName=trim(request("Name"))
if CommentUserName="" then
founderr=true
errmsg=errmsg & "
请输入姓名
"
end if
else
CommentUserType=1
CommentUserName=UserName
end if
CommentUserScore=Clng(request.Form("Score"))
CommentUserContent=trim(request.Form("Content"))
if CommentUserContent="" then
founderr=true
errmsg=errmsg & "
请输入评论内容
"
end if
CommentUserContent=DvHtmlEncode(CommentUserContent)
set tClass=conn.execute("select ClassID from Article where ArticleID=" & ArticleID)
if tClass.bof and tClass.eof then
FoundErr=True
ErrMsg=ErrMsg & "
找不到要评论的文章,可能已经被删除!
"
else
ClassID=tClass(0)
end if
set tClass=nothing
if founderr=true then
exit sub
end if
set rsComment=server.createobject("adodb.recordset")
sql="select * from ArticleComment"
rsComment.open sql,conn,1,3
rsComment.addnew
rsComment("ClassID")=ClassID
rsComment("ArticleID")=ArticleID
rsComment("UserType")=CommentUserType
rsComment("UserName")=CommentUserName
rsComment("IP")=Request.ServerVariables("REMOTE_ADDR")
rsComment("Score")=CommentUserScore
rsComment("Content")=CommentUserContent
rsComment("WriteTime")=now()
rsComment.update
rsComment.close
set rsComment=nothing
if CommentedID="" then
session("CommentedID")=ArticleID
else
session("CommentedID")=CommentedID & "|" & ArticleID
end if
'生成文件
dim UseCreateHTML
dim rsGlobal
Set rsGlobal = Server.CreateObject("ADODB.Recordset")
rsGlobal.open "SELECT Channel.UseCreateHTML FROM (Article INNER JOIN ArticleClass ON Article.ClassID = ArticleClass.ClassID) INNER JOIN Channel ON ArticleClass.ChannelID = Channel.ChannelID WHERE Article.ArticleID=" & ArticleID,conn,1,1
if not rsGlobal.eof then
UseCreateHTML = rsGlobal(0)
end if
rsGlobal.close
set rsGlobal = nothing
if UseCreateHTML>=4 and UseCreateHTML<=7 then
call CreateArticle(ArticleID)
end if
call WriteSuccessMsg2("发表评论成功!3秒后自动跳转",ArticleFilePath(ArticleID))
response.Write("")
end sub
%>