设为首页
加入收藏
联系我们
您当前的位置:资源网365 -> 文章中心 -> 网络编程 -> ASP技术 -> ASP基础 -> 文章内容 退出登录 用户管理
栏目导航
· ASP基础 · ASP应用
· ASP技巧 · 组件开发
· 客户端 · FSO专题
· 性能优化 · 脚本编码
· 客户端 · 系统相关
· ASP实例 · XML相关
· 安全加密

热门文章
· 春节对联-有横批的对...
· qq空间最新导航代码...
· 猪年对联( 2007猪年...
· 2007春节搞笑祝福语...
· 政治学习心得体会
· 鼠年春联集锦
· 党员学习心得范文
· [推荐] 知名论坛列表
· 我国五十六个民族名...
· 2008年鼠年春节对联...

相关文章
· 利用ASP打造网站论坛...
· 利用ASP打造网站论坛...
利用ASP打造网站论坛DIY(三)完
作者:不详  来源:不详  发布时间:2007-3-3 16:38:04  发布人:资源网365

减小字体 增大字体




end if
%>

  注:下面就是在上面身份验证通过后复位向的目标:boardmanager.asp。它将列出了所有别有被处理的文章。


< %
boardid=request("boardid")
if session("beenthere")< >boardidthen response.redirect "forums.asp"

  注:这就是检验版主身份的地方,因为前面已经通过cookie在斑竹的浏览器中作了标记,现在我们就能够通过seesion来辨认版主的身份了。如果标示不符,就会通过response.redirect返回到最开始的登陆页面。如果版主浏览器的cookie没有打开,那么seesion("beenthere")的值会为空,同样也无法进入这个页面。


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
sql="select 名称 from 看板列表 whereid=" & boardid
set rs=conn.execute(sql)
boardname=rs("名称")
cmd.commandtext="未发表文章列表"
ReDim param(0)
param(0) = CLng(boardid)//注:Clng 不可忽略
Set rs = cmd.Execute( ,param )
set cmd=nothing
%>
< html>
< head>
< title>版务处理< /title>
< meta http-equiv="Content-Type"content="text/html; charset=GB2312">
< /head>
< body bgcolor="#FFFFFF">
< h1 align="center"><%=boardname%>版务管理< /h1>
< hr>
< %
if rs.eof or rs.bof then response.write "<H2>现在没有文章要处理< /h2>"
response.end
%>
注:如果没有新文章被网友发布,这给出相应的提示,并用response.end来结束此页的显示。
< table width="90%" border="0"cellspacing="0" cellpadding="0"align="center" >
< tr bgcolor="#FFFFCC">
< td width="40%" height="20">主题</td>
< td width="40%" height="20">文章标题</td>
< td width="8%" height="20">作者</td>
< td width="12%" height="20">日期</td>
< /tr>
< %
do
topicid=rs("主题id")
articleid=rs("文章id")
data=rs("日期")
datastr=cstr(year(data)) & "-"& cstr(month(data)) &"-"& cstr(day(data))
author=rs("作者")
articlename=rs("标题")
topicname=rs("主题")
response.write "< tr>< td><a href=qtopic.asp?topicid="& topicid& ">" & topicname &"< /A>< /td>"
response.write "< td>< a href=managearticle.asp?articleid="&articleid & "&boardid="& boardid &">" &articlename & "< /A>< /td>"
response.write "< td>< a href=qauthor.asp?author="&author & ">" & author& "< /a>< /td>"
response.write "< td>" &datastr & "< /td>< /tr>"
rs.movenext
loop until rs.eof
%>
< /table>
< /html>
< %
set rs=nothing
conn.close
set conn=nothing
%>
< /body>

  当点击了相应文章的联结后,就进入此文章的处理页面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>"
elseif CLng(request("manage"))=2then
sql="update 内容表 set 发表=true whereid=" & articleid
conn.execute sql
sql="update 主题表 set 文章数=文章数+1where id=" & topicid
conn.execute sql
response.write "< h1>文章已经发表</h1>"
response.write "< a href=>back</a>"
else
response.clear
response.redirect "boardmanager.asp?boardid="& boarded
end if
%>
< /body>
< /html>
< %
conn.close
set conn=nothing
%>

  经过上面几步,所有的部分就算是基本完成了,当然,这时还不能拿来用,摆不上台面的。如果想要能够拿得出来的话,还要在版面设计,客户端资料验证等方面多下一些功夫。不过那都是HTML的内容了,和ASP没多大的关系,这儿我就不多讲了。

[] [返回上一页] [打 印] [收 藏]
下一篇文章:建立Web站点
∷相关文章评论∷    (评论内容只代表网友观点,与本站立场无关!) [更多评论...]
关于本站 - 网站帮助 - 广告合作 - 下载声明 - 友情连接 - 网站地图 - 意见留言
Copyright © 2006-2008 zyw365.com. All Rights Reserved .
站长QQ:416044505 站长:王耀加
有事点这里可以联系我! 站长QQ群:42160413
请把本站网址介绍给你10个好友,谢谢!( 资源网365 http://www.zyw365.com/ ) 蜀ICP备06018926