<%@language=vbscript codepage=936 %> <% option explicit response.buffer=true Const PurviewLevel=2 '操作权限 Const CheckChannelID=2 '所属频道,0为不检测所属频道 %> <% dim strFileName,ComeUrl strFileName="Admin_Comment.asp" ComeUrl=trim(request("ComeUrl")) if ComeUrl="" then ComeUrl=Request.ServerVariables("HTTP_REFERER") end if const MaxPerPage=20 dim totalPut,CurrentPage,TotalPages,i,j dim Title dim Action,FoundErr,Errmsg Action=Trim(request("Action")) Title=Trim(request("Title")) if request("page")<>"" then currentPage=cint(request("page")) else currentPage=1 end if dim sql,rs %> 文章评论管理
文 章 评 论 管 理
管理导航:
  请输入评论的标题。如果为空,则查找所有评论。
<% if Action="Modify" then call Modify() elseif Action="SaveModify" then call SaveModify() elseif Action="Del" then call DelComment() elseif Action="Del2" then call DelComment2() elseif Action="Reply" then call Reply() elseif Action="SaveReply" then call SaveReply() else call main() end if if FoundErr=True then call WriteErrMsg() end if call CloseConn() sub main() sql="select A.ArticleID, A.ClassID, A.Title as ArticleTitle, A.IncludePic, C.CommentID,C.UserName,C.IP,C.Title as CommentTitle, C.Content,C.WriteTime,C.ReplyName,C.ReplyContent,C.ReplyTime from Comment C Left Join Article A On C.ArticleID=A.ArticleID " if Title<>"" then sql=sql & " where C.Title like '%" & Title & "%' " end if sql=sql & " order by A.ArticleID desc" Set rs= Server.CreateObject("ADODB.Recordset") rs.open sql,conn,1,1 %>
您现在的位置:评论管理 >>  <% if request.querystring="" then response.write "所有评论" else if request("Query")<>"" then if Title<>"" then response.write "标题中含有“" & Title & "”的评论" else response.Write("所有评论") end if end if end if %> <% if rs.eof and rs.bof then response.write "共找到 0 篇评论
" else totalPut=rs.recordcount if currentpage<1 then currentpage=1 end if if (currentpage-1)*MaxPerPage>totalput then if (totalPut mod MaxPerPage)=0 then currentpage= totalPut \ MaxPerPage else currentpage= totalPut \ MaxPerPage + 1 end if end if response.Write "共找到 " & totalPut & " 篇评论" %>
<% if currentPage=1 then showContent showpage strFileName,totalput,MaxPerPage,true,false,"篇评论" else if (currentPage-1)*MaxPerPage <% rs.close set rs=nothing end sub sub showContent dim i i=0 dim PrevID PrevID=rs("ArticleID") do while not rs.eof if rs("ArticleID")<>PrevID then response.write "
" if i=0 or rs("ArticleID")<>PrevID then %>
| <% if rs("IncludePic")=true then response.write "[图文]" end if response.write "" & rs("ArticleTitle") & "" %> &Action=Del2">删除此文章下的所有评论
<%end if%> <%if rs("ReplyName")<>"" then%> <% end if i=i+1 if i>=MaxPerPage then exit do PrevID=rs("ArticleID") rs.movenext loop %>
"><%=rs("CommentTitle")%> <%=rs("UserName") %> <%=rs("IP")%> <%= rs("WriteTime") %> <% if rs("ReplyName")<>"" then response.write "    " else response.write "回复  " end if response.write "修改  " response.write "删除" %>
  <%response.write "管理员【" & rs("ReplyName") & "】于 " & rs("ReplyTime") & " 回复:
" & rs("ReplyContent") & "
"%>
">修改回复内容
选中本页显示的所有评论
<% end sub sub Modify() dim CommentID CommentID=trim(Request("CommentID")) if CommentID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub else CommentID=Clng(CommentID) end if sql="Select * from Comment where CommentID=" & CommentID Set rs=Server.CreateObject("Adodb.RecordSet") rs.Open sql,conn,1,1 if rs.Bof or rs.EOF then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的评论!
  • " else %>
    修 改 评 论
    评论人用户名: ">
    评论人IP: ">
    评论时间: ">
    评论标题: ">
    评论内容:
    ">
    <% end if rs.close set rs=nothing end sub sub Reply() dim CommentID CommentID=trim(Request("CommentID")) if CommentID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub else CommentID=Clng(CommentID) end if sql="select A.ArticleID, A.ClassID, A.Title as ArticleTitle, A.IncludePic, C.CommentID,C.UserName,C.IP,C.Title as CommentTitle, C.Content,C.WriteTime,C.ReplyContent from Comment C Left Join Article A On C.ArticleID=A.ArticleID where C.CommentID=" & CommentID Set rs=Server.CreateObject("Adodb.RecordSet") rs.Open sql,conn,1,1 if rs.Bof or rs.EOF then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的评论!
  • " else %>
    回 复 评 论
    评论文章标题: <%=rs("ArticleTitle")%>
    评论人用户名: <%=rs("UserName")%>
    评论标题: <%=rs("CommentTitle")%>
    评论内容: <%=rs("Content")%>
    回复内容:
    ">
    <% end if rs.close set rs=nothing end sub %> <% sub DelComment() dim CommentID,i CommentID=trim(Request("CommentID")) if CommentID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub end if if instr(CommentID,",")>0 then dim idarr idArr=split(CommentID) for i = 0 to ubound(idArr) conn.execute "delete from Comment where Commentid=" & Clng(idArr(i)) next else conn.execute "delete from Comment where Commentid=" & Clng(CommentID) end if call CloseConn() response.redirect ComeUrl End sub sub DelComment2() dim ArticleID ArticleID=trim(request("ArticleID")) if ArticleID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub else ArticleID=Clng(ArticleID) end if conn.execute "delete from Comment where ArticleID=" & ArticleID call CloseConn() response.redirect ComeUrl End sub sub SaveModify() dim CommentID,UserName,IP,Title,Content,WriteTime CommentID=trim(Request("CommentID")) UserName=trim(request.form("UserName")) IP=trim(request.form("IP")) Title=trim(Request.form("Title")) Content=trim(Request.form("Content")) WriteTime=trim(request.form("WriteTime")) if CommentID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub else CommentID=Clng(CommentID) end if if UserName="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请输入评论人用户名
  • " end if if IP="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请输入评论人IP
  • " end if if WriteTime="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请输入发表评论时间
  • " end if if Title="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请输入评论标题
  • " end if if Content="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请输入评论内容
  • " end if if FoundErr=True then exit sub end if sql="Select * from Comment where CommentID=" & CommentID Set rs=Server.CreateObject("Adodb.RecordSet") rs.Open sql,conn,1,3 if rs.Bof or rs.EOF then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的评论!
  • " else rs("UserName")=UserName rs("IP")=IP rs("WriteTime")=WriteTime rs("Title")=dvhtmlencode(Title) rs("Content")=dvhtmlencode(Content) rs.update end if rs.Close set rs=Nothing call CloseConn() response.redirect ComeUrl end sub sub SaveReply() dim CommentID,ReplyName,ReplyContent,ReplyTime CommentID=trim(Request("CommentID")) ReplyContent=trim(request("ReplyContent")) if CommentID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub else CommentID=Clng(CommentID) end if if ReplyContent="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请输入回复内容
  • " end if if FoundErr=True then exit sub end if sql="Select * from Comment where CommentID=" & CommentID Set rs=Server.CreateObject("Adodb.RecordSet") rs.Open sql,conn,1,3 if rs.Bof or rs.EOF then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的评论!
  • " else rs("ReplyName")=AdminName rs("ReplyTime")=now() rs("ReplyContent")=dvhtmlencode(ReplyContent) rs.update end if rs.Close set rs=Nothing call CloseConn() response.redirect ComeUrl end sub %>