<% action=RequestSafeStr("action") Select Case action Case "add" Call add() Case "save" Call save() Case "edit" Call edit() Case "editsave" Call editSave() Case "del" Call del() Case "delall" Call delall() Case "top" Call top() Case else Call show() End Select %> <% Sub save() title=RequestFormStr("title") categoryid=RequestFormNum("categoryid") content=RequestFormStr("content") password=RequestFormStr("password") If title="" Then Call MessageBox("请输入标题!","") Response.End End If If content="" Then Call MessageBox("请输入内容!","") Response.End End If set rs=Server.CreateObject("ADODB.Recordset") sql="select * from comment" rs.open sql,conn,1,3 rs.addnew rs("title")=title rs("categoryid")=categoryid rs("content")=content rs("password")=password rs.update rs.close Call MessageBox("添加评论成功!","comment.asp") End Sub Sub editSave() id=RequestFormNum("id") If id<>0 then title=RequestFormStr("title") content=RequestFormStr("content") set rs=Server.CreateObject("ADODB.Recordset") sql="select * from comment Where id="& id &"" rs.open sql,conn,2,3 If Not rs.eof then rs("title")=title rs("content")=content rs.update End If rs.close Call MessageBox("修改评论成功!","comment.asp") End If End Sub 'del Sub del() id=RequestQueryNum("id") If id<>0 Then conn.Execute("delete From comment Where id="& id &"") Call MessageBox("删除成功!","comment.asp") End If End Sub 'delall Sub delall() id=RequestFormStr("id") If id="" Then Call MessageBox("请选择一项!","") Response.end End If 'response.write id 'response.end conn.Execute("delete From comment Where id in ("& id &")") Call MessageBox("删除成功!","comment.asp") End Sub 'top Sub top() id=RequestQueryNum("id") intTop=RequestQueryNum("top") If id<>0 Then conn.Execute("Update comment set [top]="& intTop &",toptime=Now() Where id="& id &"") If intTop=1 Then strMsg="置顶成功!" Else strMsg="取消置顶成功!" End If Call MessageBox(strMsg,"comment.asp") End If End Sub Sub show() rid=RequestQueryNum("rid") If rid<>0 Then sql="Select * From comment Where reid="& rid &"by order id desc" Else sql="Select * From comment order by id desc" End If Set mypage=new xdownpage '创建对象 mypage.getconn=conn '得到数据库连接 mypage.getsql=sql mypage.pagesize=20 '设置每一页的记录条数据为5条 set rs=mypage.getrs() '返回Recordset %>   全选/取消 <% for i=1 to mypage.pagesize If rs.eof Then Exit for End If 'response.write "select title form notebook where id="& rs("reid") &"" 'response.End If rs("reid")<>0 And rs("reid")<>"" Then Set rs2=conn.Execute("select title from notebook where id="& rs("reid") &"") If rs2.bof And rs2.eof Then rtitle="" Else rtitle=rs2("title") End If Set rs2=Nothing End If %> <% rs.MoveNext Next %>
评论管理
编号 选择 昵称 内容 评论文章 评论时间 操作
<%=rs("id")%> "> "><%=rs("title")%> <%=HTMLEncode(rs("content"))%> " target="_blank"><%=rtitle%> <%=rs("posttime")%> ">修改 )">删除
<%mypage.showpage() %>
<% End Sub Sub add() %>
写评论
标题:    *
分类:  
内容:
加密:   (不写,表示不设置密码)
 
<% End Sub Sub edit() id=RequestQueryNum("id") Set rs=conn.Execute("Select * From comment Where id="& id &"") If Not rs.eof Then %>
修改评论
标题:   " size="25" style="width:300"> *
内容:
 
<% End If End Sub %>