当点击了相应文章的联结后,就进入此文章的处理页面managearticle.asp:
< %
articleid=request("articleid")
boardid=request("boardid")
if session("beenthere")< >boardidthen response.redirect "forums.asp"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft AccessDriver (*.mdb)};dbq=" & Server.MapPath("bbssystem.mdb")
Set cmd = Server.CreateObject("ADODB.Command")
Set cmd.ActiveConnection = conn
cmd.CommandText = "按id查询文章"
ReDim param(0)
param(0) = CLng(articleid)//注:Clng 不可忽略
Set rs = cmd.Execute( ,param )
author=rs("作者id")
title=rs("标题")
data=rs("日期")
rate=rs("推荐度")
boardid=rs("看板id")
topicid=rs("主题id")
boardname=rs("看板名")
topicname=rs("主题名")
content=rs("内容")
content=replace(content,vbCrlf,"</p>< p>")
content="< p>" & content& "< /p>"
set cmd=nothing
%>
< html>
< head>
< title>Untitled Document< /title>
< meta http-equiv="Content-Type"content="text/html; charset=GB2312">
< /head>
< body bgcolor="#E9E9E4">
< table width="89%" border="0"cellspacing="0" cellpadding="0"align="center">
< tr bgcolor="#CCCCCC">
< td>作者:< font color="#FF3366"><a href="qauthor.asp?author=< %=author%>">< %=author%> < /a>< /font>发表日期:< font color="#FF3333"><%=data%>< /font>
看板:< font color="#FF3333"><a href="qboard.asp?boardid=< %=boardid%>">< %=boardname%>< /a>< /font>板主推荐:< font color="#FF3333">#rate#</font>< /td>
< /tr>
< tr bgcolor="#CCCCCC">
< td>标题:< font color="#FF3333"><%=title%>
主题:< a href="qtopic.asp?topicid=<%=topicid%>"> < %=topicname%>< /a> < /font>< /td>
< /tr>
< tr valign="top">
< td>
< hr>
< font color="#FF3366">文章内容:< /font>< br>
< br>
< font color=blue>< %response.writecontent%>< /font>
< br>
< hr>
< /td>
< /tr>
< tr valign="top">
< form method="post" action="manageresult.asp">
< td height="18">
< table width="100%" border="1"cellspacing="1" cellpadding="1">
< tr>
< td width="29%">
< div align="right">
< input type="hidden" name="boardid"value="< %=boardid%>">
< input type="hidden" name="topicid"value="< %=topicid%>">
< input type="hidden" name="articleid"value="< %=articleid%>">
文章处理:< /div>
< /td>
< td width="12%" bordercolor="#006666">删除:
< input type="radio" name="manage"value=1>
< /td>
< td width="30%" bordercolor="#006666">发表:
< input type="radio" name="manage"value=2>
推荐等级
< select name="select">
< option value="1">1</option>
< option value="2">2</option>
< option value="3" selected>3</option>
< option value="4">4</option>
< option value="5">5</option>
< /select>
< /td>
< td width="20%" bordercolor="#006666">以后再处理:
< input type="radio" name="manage"value=3>
< /td>
< td width="9%">
< input type="submit" name="Submit"value="确定">
< /td>
< /tr>
< /table>
< /td>
< /form>
< /tr>
< /table>
< /body>
< /html>
< %
set rs=nothing
conn.close
set conn=nothing
%>
注:这一页和文章显示模块中的article.asp基本上是一样的,仅仅是多加入了版主处理的窗体,在这儿就不多讲了。
下面,要根据版主的处理过程,修该数据库相应部分
< %response.buffer=true%>
< html>
< head>
< title>文章处理< /title>
< meta http-equiv="Content-Type"content="text/html; charset=GB2312">
< /head>
< body bgcolor="#E9E9E4">
< %
articleid=request("articleid")
boardid=request("boardid")
topicid=request("topicid")
manage=request("manage")
'接受窗体内容
response.write manage '显示斑竹ID
if session("beenthere")< >boardidthen response.redirect "forums.asp"
Set conn = Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft AccessDriver (*.mdb)};dbq=" & Server.MapPath("bbssystem.mdb")
根据上页中版主的操作,下面进行相应的处理。
if CLng(request("manage"))=1 then
sql="delete from 内容表 where id="& articleid
conn.execute sql
response.write "< h1>文章已经被删除</h1>"
response.write "< a href=>back</a>"