<%@language=vbscript codepage=936 %> <% option explicit response.buffer=true Const PurviewLevel=2 Const CheckChannelID=4 Const PurviewLevel_Photo=1 %> <% dim strFileName strFileName="Admin_PhotoComment.asp" const MaxPerPage=20 dim totalPut,CurrentPage,TotalPages,i,j dim SearchContent,ShowPhotoID dim Action,FoundErr,Errmsg ShowPhotoID=Trim(request("ShowPhotoID")) Action=Trim(request("Action")) SearchContent=Trim(request("SearchContent")) 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 P.PhotoID,P.ClassID,P.PhotoName,C.CommentID,C.UserName,C.IP, C.Content,C.WriteTime,C.ReplyName,C.ReplyContent,C.ReplyTime,C.Email,C.Oicq,C.Homepage,C.Icq,C.Msn,C.UserType,C.Score from PhotoComment C Left Join Photo P On C.PhotoID=P.PhotoID where 1 " if SearchContent<>"" then sql=sql & " and C.Content like '%" & SearchContent & "%' " end if if ShowPhotoID<>"" then sql=sql & " and C.PhotoID=" & ShowPhotoID & " " end if sql=sql & " order by P.PhotoID desc" Set rs= Server.CreateObject("ADODB.Recordset") rs.open sql,conn,1,1 %>
您现在的位置:评论管理 >>  <% if request.querystring="" then response.write "所有评论" else if SearchContent<>"" then response.write "评论内容中含有“" & SearchContent & "”的评论" else response.Write("所有评论") 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,rsCommentUser i=0 dim PrevID PrevID=rs("PhotoID") do while not rs.eof if rs("PhotoID")<>PrevID then response.write "
" if i=0 or rs("PhotoID")<>PrevID then %>
| <% response.write "" & rs("PhotoName") & "" %> &Action=Del2">删除此软件下的所有评论
<%end if%> <%if rs("ReplyName")<>"" then%> <% end if i=i+1 if i>=MaxPerPage then exit do PrevID=rs("PhotoID") rs.movenext loop %>
"><%=left(rs("Content"),25)%> 评分:<%=rs("Score")%> <%if rs("UserType")=1 then response.write "会员" else response.write "游客" end if%> <% if rs("UserType")=1 then set rsCommentUser=Conn_User.execute("select " & db_User_ID & "," & db_User_Name & "," & db_User_Email & "," & db_User_QQ & "," & db_User_ICQ & "," & db_User_Msn & "," & db_User_Homepage & " from " & db_User_Table & " where " & db_User_Name & "='" & rs("UserName") & "'") if rsCommentUser.bof and rsCommentUser.eof then response.write rs("UserName") else response.write "" & rs("UserName") & "" end if else response.write "" & rs("UserName") & "" end if %> <%= 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 PhotoComment 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 %>
    <% if rs("UserType")=0 then%> <%else%> <% end if %>
    修 改 评 论    <%if rs("UserType")=1 then response.write "(会员模式)" else response.write "(游客模式)" end if%>
    评论人姓名: "> 评论人Oicq: ">
    评论人性别: 男      评论人 Icq: ">
    评论人Email: "> 评论人 Msn: ">
    评论时间: "> 评论人IP: ">
    评论人主页: " size="66">
    评论人姓名: " disabled> ">
    评论时间: "> 评论人IP: ">
    评 分: > 1分       > 2分       > 3分       > 4分       > 5分
    评论内容:
    "> ">
    <% 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 P.PhotoID, P.ClassID, P.PhotoName,C.CommentID,C.UserName,C.IP, C.Content,C.WriteTime,C.ReplyContent from PhotoComment C Left Join Photo P On C.PhotoID=P.PhotoID 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("PhotoName")%>
    评论人用户名: <%=rs("UserName")%>
    评论内容: <%=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 PhotoComment where Commentid=" & Clng(idArr(i)) next else conn.execute "delete from PhotoComment where Commentid=" & Clng(CommentID) end if call CloseConn() response.redirect ComeUrl End sub sub DelComment2() dim PhotoID PhotoID=trim(request("PhotoID")) if PhotoID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub else PhotoID=Clng(PhotoID) end if conn.execute "delete from PhotoComment where PhotoID=" & PhotoID call CloseConn() response.redirect ComeUrl End sub sub SaveModify() dim rsComment,ClassID,tClass,CommentID dim CommentUserType,CommentUserName,CommentUserSex,CommentUserEmail,CommentUserOicq dim CommentUserIcq,CommentUserMsn,CommentUserHomepage,CommentUserScore,CommentUserContent dim CommentUserIP,CommentWritetime CommentID=trim(Request("CommentID")) if CommentID="" then FoundErr=True ErrMsg=ErrMsg & "
  • 请指定评论ID
  • " Exit sub end if CommentUserName=trim(request("UserName")) if CommentUserName="" then founderr=true errmsg=errmsg & "
  • 请输入姓名
  • " Exit sub end if CommentUserType=Clng(request("UserType")) if CommentUserType=0 then CommentUserSex=trim(request("Sex")) CommentUserOicq=trim(request("Oicq")) CommentUserIcq=trim(request("Icq")) CommentUserMsn=trim(request("Msn")) CommentUserEmail=trim(request("Email")) CommentUserHomepage=trim(request("Homepage")) if CommentUserHomepage="http://" or isnull(CommentUserHomepage) then CommentUserHomepage="" end if CommentUserIP=trim(request.form("IP")) CommentWriteTime=trim(request.form("WriteTime")) CommentUserScore=Clng(request.Form("Score")) CommentUserContent=trim(request.Form("Content")) if CommentUserContent="" or CommentUserIP="" or CommentUserScore="" then founderr=true errmsg=errmsg & "
  • 请完整输入评论内容、评论时间、评论人IP等信息
  • " end if CommentUserContent=DvHtmlEncode(CommentUserContent) if CommentWriteTime="" then CommentWriteTime=now() else CommentWriteTime=Cdate(CommentWriteTime) end if if FoundErr=True then exit sub end if sql="Select * from PhotoComment where CommentID=" & CommentID Set rsComment=Server.CreateObject("Adodb.RecordSet") rsComment.Open sql,conn,1,3 if rsComment.Bof or rsComment.EOF then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的评论!
  • " else rsComment("UserType")=CommentUserType rsComment("UserName")=CommentUserName rsComment("Sex")=CommentUserSex rsComment("Oicq")=CommentUserOicq rsComment("Icq")=CommentUserIcq rsComment("Msn")=CommentUserMsn rsComment("Email")=CommentUserEmail rsComment("Homepage")=CommentUserHomepage rsComment("IP")=CommentUserIP rsComment("WriteTime")=CommentWriteTime rsComment("Score")=CommentUserScore rsComment("Content")=CommentUserContent rsComment.update end if rsComment.Close set rsComment=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 PhotoComment 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 %>