www.gusucode.com > 艺术签名文章资讯网源代码 > 艺术签名文章资讯网源代码/624/adminhtry/admin_comment.asp
<!--#include file="setup.asp"--> <!--#include file="check.asp"--> <% Admin_header '===================================================================== ' 软件名称:新云网站管理系统 ' 当前版本:NewAsp Site Management System Version 3.0 ' 文件名称:admin_comment.asp ' 更新日期:2006-4-15 ' 官方网站:新云网络(www.newasp.net) QQ:94022511 '===================================================================== ' Copyright 2003-2007 newasp.net - All Rights Reserved. ' newasp is a trademark of newasp.net '===================================================================== Dim Action,ChannelPath If Not ChkAdmin("ErrorSoft" & ChannelID) Then Server.Transfer("showerr.asp") Response.End End If If Newasp.ChkNumeric(Newasp.BindDomain) = 0 Then ChannelPath = Trim(Newasp.InstallDir & Newasp.ChannelDir) Else ChannelPath = Trim(Newasp.DomainName) & "/" End If %> <table class="TableBorder" cellspacing="1" cellpadding="3" align="center" border="0"> <tr> <th><%=Newasp.modulename%>评论管理</th> </tr> <tr> <td class="TableRow2" colspan="2"><strong>操作选项:</strong> <a href="admin_comment.asp?ChannelID=<%=ChannelID%>">管理首页</a> | <a href="?ChannelID=<%=ChannelID%>&audit=0">已审核评论</a> | <a href="?ChannelID=<%=ChannelID%>&audit=1"><font color="red">未审核评论</font></a></td> </tr> </table> <br /> <% Action = LCase(Request("action")) Select Case Trim(Action) Case "edit" Call editComment Case "save" Call saveComment Case "audit" Call auditComment Case "noaudit" Call NoAuditComment Case "del" Call DeleteComment Case "delall" Call DelAllComment Case Else Call showmain End Select If FoundErr = True Then ReturnError(ErrMsg) End If Admin_footer SaveLogInfo(AdminName) CloseConn Sub showmain() Dim CurrentPage,page_count,totalnumber,Pcount,maxperpage Dim strTopic,strSQL maxperpage = 30 CurrentPage = Newasp.ChkNumeric(Request("page")) If CurrentPage = 0 Then CurrentPage = 1 Response.Write "<table cellspacing=""1"" align=""center"" cellpadding=""3"" border=""0"" class=""tableborder"">" Response.Write " <tr>" Response.Write " <th width='5%'>选择</th>" Response.Write " <th width='50%'>评论主题</th>" Response.Write " <th width='5%'>状态</th>" Response.Write " <th width='11%'>用户名称</th>" Response.Write " <th width='5%'>打分</th>" Response.Write " <th width='12%'>评论时间</th>" Response.Write " <th width='12%'>用户IP</th>" Response.Write " </tr>" Response.Write " <form name=""selform"" method=""post"" action=""admin_comment.asp"">" Response.Write " <input type=""hidden"" name=""action"" value=""del"">" Response.Write " <input type=""hidden"" name=""ChannelID"" value="""& ChannelID &""">" If Trim(Request("audit")) <> "" Then strSQL = " And C.Audit=" & Newasp.ChkNumeric(Request("audit")) totalnumber = Newasp.Execute("SELECT COUNT(commentid) FROM NC_Comment WHERE ChannelID=" & ChannelID & " And Audit=" & Newasp.ChkNumeric(Request("audit")))(0) Else strSQL = "" totalnumber = Newasp.Execute("SELECT COUNT(commentid) FROM NC_Comment WHERE ChannelID=" & ChannelID)(0) End If Pcount = CLng(totalnumber / maxperpage) '得到总页数 If Pcount < totalnumber / maxperpage Then Pcount = Pcount + 1 If CurrentPage < 1 Then CurrentPage = 1 If CurrentPage > Pcount Then CurrentPage = Pcount Select Case CInt(Newasp.modules) Case 1 SQL = "SELECT C.commentid,C.postid,C.content,C.Grade,C.username,C.postime,C.postip,C.apprize,C.Audit,A.ArticleID,A.title FROM [NC_Comment] C INNER JOIN [NC_Article] A ON C.Postid=A.ArticleID WHERE C.ChannelID=" & ChannelID & strSQL & " ORDER BY C.commentid DESC" Case 2 SQL = "SELECT C.commentid,C.postid,C.content,C.Grade,C.username,C.postime,C.postip,C.apprize,C.Audit,A.softid,A.SoftName,A.SoftVer FROM [NC_Comment] C INNER JOIN [NC_SoftList] A ON C.Postid=A.softid WHERE C.ChannelID=" & ChannelID & strSQL & " ORDER BY C.commentid DESC" Case 3 SQL = "SELECT C.commentid,C.postid,C.content,C.Grade,C.username,C.postime,C.postip,C.apprize,C.Audit,A.shopid,A.TradeName FROM [NC_Comment] C INNER JOIN [NC_ShopList] A ON C.Postid=A.shopid WHERE C.ChannelID=" & ChannelID & strSQL & " ORDER BY C.commentid DESC" Case 5 SQL = "SELECT C.commentid,C.postid,C.content,C.Grade,C.username,C.postime,C.postip,C.apprize,C.Audit,A.flashid,A.title FROM [NC_Comment] C INNER JOIN [NC_FlashList] A ON C.Postid=A.flashid WHERE C.ChannelID=" & ChannelID & strSQL & " ORDER BY C.commentid DESC" Case Else ErrMsg = "<li>错误的系统参数~!</li>" FoundErr = True Exit Sub End Select Set Rs = Server.CreateObject("ADODB.Recordset") If IsSqlDataBase=1 Then Set Rs = Newasp.Execute(SQL) Else Rs.Open SQL, Conn, 1, 1 End If If Rs.BOF And Rs.EOF Then Response.Write "<tr><td align=""center"" colspan=""7"" class=""TableRow1"">没有" & sModuleName & "评论!</td></tr>" Else Rs.MoveFirst If Pcount > 1 then Rs.Move (CurrentPage - 1) * maxperpage page_count = 0 Do While Not Rs.EOF And page_count < CInt(maxperpage) If Not Response.IsClientConnected Then ResponseEnd Select Case CInt(Newasp.modules) Case 1 strTopic = "<a href=""" & ChannelPath & "Comment.Asp?ArticleID="& Rs(9) &""" title='点击查看此" & sModuleName & "评论' target=_blank>"& Rs(10) &"</a>" Case 2 strTopic = "<a href=""" & ChannelPath & "Comment.Asp?softid="& Rs(9) &""" title='点击查看此" & sModuleName & "评论' target=_blank>"& Rs(10) &" "& Rs(11) &"</a>" Case 3 strTopic = "<a href=""" & ChannelPath & "Comment.Asp?shopid="& Rs(9) &""" title='点击查看此" & sModuleName & "评论' target=_blank>"& Rs(10) &"</a>" Case 5 strTopic = "<a href=""" & ChannelPath & "Comment.Asp?flashid="& Rs(9) &""" title='点击查看此" & sModuleName & "评论' target=_blank>"& Rs(10) &"</a>" End Select Admin_Comment_list Rs(0),strTopic,Rs(1),Rs(2),Rs(3),Rs(4),Rs(5),Rs(6),Rs("Audit") Rs.movenext page_count = page_count + 1 If page_count >= maxperpage Then Exit Do Loop End If Rs.Close:Set Rs = Nothing Response.Write " <tr>" Response.Write " <td class=""tablerow1"" colspan=""7"">" Response.Write "<span class=""HighLightR"" onClick=""CheckAll(document.selform)"">全选</span><span class=""HighLightR"" onClick=""ContraSel(document.selform)"">反选</span>" If Trim(Request("audit")) = "0" Then Response.Write "<span class=""HighLightR"" onClick=""document.selform.action.value='noaudit';{if(confirm('您确定要批量取消审核评论吗?')){document.selform.submit();}return false;}"">取消审核</span>" Else Response.Write "<span class=""HighLightR"" onClick=""document.selform.action.value='audit';{if(confirm('您确定要批量审核评论吗?')){document.selform.submit();}return false;}"">批量审核</span>" End If Response.Write "<span class=""HighLightR"" onClick=""document.selform.action.value='del';{if(confirm('您确定要删除此评论吗?')){document.selform.submit();}return false;}"">删除评论</span>" Response.Write "<span class=""HighLightR"" onClick=""document.selform.action.value='delall';{if(confirm('您确定要删除所有评论吗?')){document.selform.submit();}return false;}"">全部删除</span>" Response.Write "</td>" Response.Write " </tr>" Response.Write " </form>" Response.Write " <tr align=""center"">" Response.Write " <td class=""tablerow2"" colspan=""7"">" Response.Write showpages(CurrentPage,Pcount,totalnumber,maxperpage,"&ChannelID="& ChannelID & "&Audit="&Request("audit")) Response.Write "</td>" Response.Write " </tr>" Response.Write "</table>" End Sub Function Admin_Comment_list(commentid,topic,postid,content,Grade,username,postime,postip,mAudit) Response.Write " <tr>" Response.Write " <td class=""TableRow1"" align=""center""><input type=""checkbox"" name=""commentid"" value="""& commentid &"""></td>" Response.Write " <td class=""TableRow1"">" & topic & "</td>" Dim m_strAudit If mAudit = 0 Then m_strAudit = "<b style=""color:blue;"" title=""已审核"">√</b>" Else m_strAudit = "<b style=""color:red;"" title=""未审核"">×</b>" End If Response.Write " <td class=""TableRow1"" align=""center""><a href=""?action=edit&ChannelID=" & ChannelID & "&commentid=" & commentid & """>" & m_strAudit & "</a></td>" Response.Write " <td class=""TableRow1"" align=""center""><font color=blue>" & username & "</font></td>" Response.Write " <td class=""TableRow1"" align=""center""><font color=red>" & Grade & "</font></td>" Response.Write " <td class=""TableRow1"" align=""center"">" & Newasp.FormatDate(postime,2) & "</td>" Response.Write " <td class=""TableRow1"" align=""center"">" & postip & "</td>" Response.Write " </tr>" Response.Write " <tr>" Response.Write " <td class=""TableRow2"" colspan=""7"">"& Newasp.CutString(content,100) &"</td>" Response.Write " </tr>" End Function Sub DeleteComment() Dim postid,strPostID,ArrayPostID,i If Trim(Request("commentid")) <> "" Then If CInt(Newasp.IsCreateHtml) <> 0 Then Response.Write "<IE:Download ID=CreationID STYLE=""behavior:url(#default#download)"" />" & vbCrLf Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT DISTINCT(postid) FROM NC_Comment WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ") ORDER BY postid" Rs.Open SQL,Conn,1,1 strPostID = "" If Not (Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF strPostID = strPostID & "," & Rs("postid") Rs.movenext Loop End If Rs.Close:Set Rs = Nothing Newasp.Execute ("DELETE FROM NC_Comment WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ")") If strPostID <> "" Then ArrayPostID = Split(strPostID, ",") For i = 1 To UBound(ArrayPostID) postid = Newasp.ChkNumeric(ArrayPostID(i)) If postid > 0 Then Call makehtml(postid) End If Next End If Else Newasp.Execute ("DELETE FROM NC_Comment WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ")") End If Succeed("<li>恭喜您!删除评论成功。</li>") Else ErrMsg = "<li>错误的系统参数,请选择要删除的评论ID</li>" FoundErr = True Exit Sub End If End Sub Sub DelAllComment() Newasp.Execute ("DELETE FROM NC_Comment WHERE ChannelID = "& ChannelID) Succeed("<li>恭喜您!删除所有评论成功。</li>") End Sub Sub auditComment() Dim postid,strPostID,ArrayPostID,i If Trim(Request("commentid")) <> "" Then If CInt(Newasp.IsCreateHtml) <> 0 Then Response.Write "<IE:Download ID=CreationID STYLE=""behavior:url(#default#download)"" />" & vbCrLf Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT DISTINCT(postid) FROM NC_Comment WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ") ORDER BY postid" Rs.Open SQL,Conn,1,1 strPostID = "" If Not (Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF strPostID = strPostID & "," & Rs("postid") Rs.movenext Loop End If Rs.Close:Set Rs = Nothing Newasp.Execute ("UPDATE NC_Comment SET Audit=0 WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ")") If strPostID <> "" Then ArrayPostID = Split(strPostID, ",") For i = 1 To UBound(ArrayPostID) postid = Newasp.ChkNumeric(ArrayPostID(i)) If postid > 0 Then Call makehtml(postid) End If Next End If Else Newasp.Execute ("UPDATE NC_Comment SET Audit=0 WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ")") End If Succeed("<li>恭喜您!评论批量审核成功。</li>") Else ErrMsg = "<li>错误的系统参数,请选择要审核的评论ID</li>" FoundErr = True Exit Sub End If End Sub Sub NoAuditComment() Dim postid,strPostID,ArrayPostID,i If Trim(Request("commentid")) <> "" Then If CInt(Newasp.IsCreateHtml) <> 0 Then Response.Write "<IE:Download ID=CreationID STYLE=""behavior:url(#default#download)"" />" & vbCrLf Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT DISTINCT(postid) FROM NC_Comment WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ") ORDER BY postid" Rs.Open SQL,Conn,1,3 If Not (Rs.BOF And Rs.EOF) Then Do While Not Rs.EOF strPostID = strPostID & "," & Rs("postid") Rs.movenext Loop End If Rs.Close:Set Rs = Nothing Newasp.Execute ("UPDATE NC_Comment SET Audit=1 WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ")") If strPostID <> "" Then ArrayPostID = Split(strPostID, ",") For i = 1 To UBound(ArrayPostID) postid = Newasp.ChkNumeric(ArrayPostID(i)) If postid > 0 Then Call makehtml(postid) End If Next End If Else Newasp.Execute ("UPDATE NC_Comment SET Audit=1 WHERE ChannelID="& ChannelID &" And CommentID in (" & Request("CommentID") & ")") End If Succeed("<li>恭喜您!评论批量取消审核成功。</li>") Else ErrMsg = "<li>错误的系统参数,请选择要取消审核的评论ID</li>" FoundErr = True Exit Sub End If End Sub Sub editComment() Dim commentid commentid = Newasp.ChkNumeric(Request("commentid")) SQL = "SELECT commentid,postid,content,Grade,username,postime,postip,apprize,Audit FROM NC_Comment WHERE ChannelID="& ChannelID &" And commentid=" & commentid Set Rs = Newasp.Execute(SQL) If Rs.BOF And Rs.EOF Then FoundErr = True ErrMsg = ErrMsg + "<li>错误的系统参数!</li>" Exit Sub End If %> <table class="TableBorder" cellspacing="1" cellpadding="3" align="center" border="0"> <tr> <th colspan="2">编辑/审核<%=Newasp.modulename%>评论</th> </tr> <form action="?action=save" method="post" name="form2"> <input type="hidden" name="commentid" value="<%=Rs("commentid")%>" /> <input type="hidden" name="ChannelID" value="<%=ChannelID%>" /> <tr> <td class="TableRow2" width="20%">用户名称</td> <td class="TableRow2" width="80%"><input name="username" value="<%=Newasp.HTMLEncodes(Rs("username"))%>" type="text" size="30" /></td> </tr> <tr> <td class="TableRow1">评论时间/IP地址</td> <td class="TableRow1"><font color="red"><%=Newasp.HTMLEncodes(Rs("postime"))%></font> <font color="blue"><%=Newasp.HTMLEncodes(Rs("postip"))%></font></td> </tr> <tr> <td class="TableRow2">用户评分</td> <td class="TableRow2"><input name="Grade" value="<%=Rs("Grade")%>" type="text" size="5" maxlength="3" /></td> </tr> <tr> <td class="TableRow1">评论内容<br/>支持HTML代码</td> <td class="TableRow1"><textarea name="content1" rows="10" cols="80"><%=Newasp.HTMLEncodes(Rs("content"))%></textarea></td> </tr> <tr> <td class="TableRow2">评论审核</td> <td class="TableRow2"><input type="radio" name="Audit" value="0"<%If Rs("Audit") = 0 Then Response.Write " checked=""checked"""%> /> 确定审核 <input type="radio" name="Audit" value="1"<%If Rs("Audit") = 1 Then Response.Write " checked=""checked"""%> /> 取消审核</td> </tr> <tr> <td class="TableRow1"></td> <td class="TableRow1"><input class="Button" type="button" onclick="javascript:history.go(-1)" name="Submit2" value="返回上一页" /> <input class="Button" type="submit" name="Submit1" value="保存编辑" /></td> </tr> </form> </table> <% Set Rs = Nothing End Sub Sub saveComment() Dim commentid commentid = Newasp.ChkNumeric(Request("commentid")) If Trim(Request.Form("username")) = "" Then FoundErr = True ErrMsg = ErrMsg + "<li>用户名不能为空!</li>" End If If Trim(Request.Form("content1")) = "" Then FoundErr = True ErrMsg = ErrMsg + "<li>评论内容不能为空!</li>" End If If Founderr = True Then Exit Sub Set Rs = Server.CreateObject("ADODB.Recordset") SQL = "SELECT * FROM NC_Comment WHERE commentid= " & commentid Rs.Open SQL,Conn,1,3 If Not (Rs.BOF And Rs.EOF) Then Rs("username").Value = Trim(Request.Form("username")) Rs("content").Value = Trim(Request.Form("content1")) Rs("Grade").Value = Newasp.ChkNumeric(Request.Form("Grade")) Rs("Audit").Value = Newasp.ChkNumeric(Request.Form("Audit")) Rs.update If CInt(Newasp.IsCreateHtml) <> 0 Then Response.Write "<IE:Download ID=CreationID STYLE=""behavior:url(#default#download)"" />" & vbCrLf Call makehtml(Rs("postid")) End If End If Rs.Close:Set Rs = Nothing Succeed("<li>恭喜您!编辑/审核评论成功。</li>") End Sub Sub makehtml(sid) Dim strURL Select Case CInt(Newasp.modules) Case 1 strURL = "admin_makenews.asp?ChannelID=" & ChannelID & "&ArticleID=" & sid & "&showid=0" Case 2 strURL = "admin_makesoft.asp?ChannelID=" & ChannelID & "&softid=" & sid & "&showid=0" Case 3 strURL = "admin_makesohop.asp?ChannelID=" & ChannelID & "&shopid=" & sid & "&showid=0" Case 5 strURL = "admin_makeflash.asp?ChannelID=" & ChannelID & "&flashid=" & sid & "&showid=0" End Select Call ScriptCreation(strURL,sid) End Sub %>