asp论坛制作教程 BBS ASP源码.docx

上传人:b****0 文档编号:17599442 上传时间:2023-07-27 格式:DOCX 页数:23 大小:24.73KB
下载 相关 举报
asp论坛制作教程 BBS ASP源码.docx_第1页
第1页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第2页
第2页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第3页
第3页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第4页
第4页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第5页
第5页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第6页
第6页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第7页
第7页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第8页
第8页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第9页
第9页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第10页
第10页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第11页
第11页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第12页
第12页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第13页
第13页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第14页
第14页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第15页
第15页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第16页
第16页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第17页
第17页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第18页
第18页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第19页
第19页 / 共23页
asp论坛制作教程 BBS ASP源码.docx_第20页
第20页 / 共23页
亲,该文档总共23页,到这儿已超出免费预览范围,如果喜欢就下载吧!
下载资源
资源描述

asp论坛制作教程 BBS ASP源码.docx

《asp论坛制作教程 BBS ASP源码.docx》由会员分享,可在线阅读,更多相关《asp论坛制作教程 BBS ASP源码.docx(23页珍藏版)》请在冰点文库上搜索。

asp论坛制作教程 BBS ASP源码.docx

asp论坛制作教程BBSASP源码

一、建立文件 

1、数据库,用来储存发表的帖子!

-------命名为:

bbs.mdb 

2、有数据库就必须连接数据库,该文件用来连接数据库:

----命名为:

conn.asp 

3、发表帖子的文件----命名为:

say.asp 

4、保存发表帖子内容的文件-----命名为:

save.asp 

5、显示帖子标题的文件------命名为:

index.asp 

6、显示帖子内容的文件,即点击标题后所进入的页面-----命名为:

show.asp 

7、删除帖子内容的文件-----命名为:

del.asp 

8、修改帖子内容的文件-----命名为:

modify.asp 

9、修改后保存帖子内容的文件-----命名为:

modifysave.asp 

10、保存回复内容------wback.asp

11、CSS样式表文件------main.css

12、页面上部----header.htm

13、页面下部------footer.htm

二、各文件的主要内容

1、bbs.mdb

打开这个数据库,就是Access建立三个表

bbs:

id(自动给帖子编号),他的数据类型设为“自动编号”

name(用来储存发表的作者),数据类型为“文本”

title(用来储存帖子的主题),数据类型为“文本”

body(用来储存帖子的内容),数据类型为“备注”

wtime(撰写时间)时间

countwb(回复计数)整数

bbbs:

回复数据保存

hostid(楼主ID)文本

btime(回复时间)时间

bname(回复人名字)文本

bid(回复文章ID)数字

bcontent(回复内容)备注

btitle(回复主题)文本

author:

name(名字)文本

code(密码)文本

sex(性别)文本

birth(出生)文本

com(联系方式)文本

2、conn.asp 

源代码为:

 

<%Server.scriptTimeout="10" 

connstr="DBQ="+server.mappath("bbs.mdb")+";DefaultDir=;DRIVER={MicrosoftAccessDriver(*.mdb)};" 

setconn=Server.CreateObject("ADODB.connection") 

conn.openconnstr%> 

建立连接,"bbs.mdb"是刚建立的数据库文件。

3、say.asp 

--#includefile="header.htm"-->

<%subsaysth()

name=request.QueryString("name")%>


     

      style="border-collapse:

collapse;"bordercolor="#000000" 

      width=600height="20"align=centerID="Table1">

发表文章:


大名:

>

密码:

12px">

点此注册

标题:


内容:



     

<%endsub

'用过程和函数调用的方式,能容易理解。

'这里只是一个表单提交(到save.asp)

%>

发表

     

        

       <%headtext()%>

        

     

     

        

       <%saysth()%>

        

     

  

     

        

        

        

     

--#includefile="footer.htm"-->

4、save.asp

--#includefile="conn.asp"-->

--#includefile="header.htm"-->

<%subsave()

name=Replace(Request.Form("name"),"'","''") 

title=Replace(Request.Form("title"),"'","''") 

body=Replace(Request.Form("body"),"'","''") 

code=Replace(Request.Form("code"),"'","''")

setsavebbs=conn.execute("select*fromauthorwherename='"&name&"'"&"andcode='"&code&"'")

ifname=""ortitle=""orbody=""orcode=""orsavebbs.eofthen%> 


后退填写完整资料/填写正确用户名和密码,你才能发表帖子!



点此注册

<%else

sql="insertintobbs(name,title,body,wtime,countwb)values('"&name&"','"&title&"','"&body&"','"&now()&"',0)"

setsavebbs=conn.execute(sql)

setsavebbs=nothing

setsavebbs=conn.execute("select*frombbswherename='"&name&"'orderbywtimedesc")

'打开数据表,插入数据。

%> 


发表成功!

id=<%=savebbs("id")%>">查看帖子|返回论坛

<%endif

setsavebbs=nothing

endsub

%>

保存

     

        

       <%headtext()%>

        

     

     

        

       <%save()%>

        

     

  

     

        

        

        

     

--#includefile="footer.htm"-->

5、index.asp 

源代码:

<%@LANGUAGE="VBSCRIPT"CODEPAGE="936"%>

--#includefile="conn.asp"-->

--#includefile="header.htm"-->

<%submaintalk()%>

<%

setshowbbs=server.CreateObject("ADODB.recordset")

showbbsStr="select*frombbsorderbywtimedesc"

showbbs.openshowbbsStr,conn,3,2

ifshowbbs.EOFandshowbbs.BOFthen%>


暂时还没有文章,现在发表

<%else

showbbs.PageSize=10'分页

PageN=10'显示10个页数.

PageCount=showbbs.PageCount

Page=int(request("Page"))

CurrentPageN=int(request("CurrentPageN"))

ifPage<=0orrequest("Page")=""orrequest("Page")="0"thenPage=1

ifCurrentPageN<=0orrequest("CurrentPageN")=""thenCurrentPageN=1

showbbs.AbsolutePage=Page

%>


<%fori=1toshowbbs.PageSize%>

     

id=<%=showbbs("id")%>"><%=showbbs("title")%>

     作者:

auname=<%=showbbs("name")%>"><%=showbbs("name")%> 

     <%ifshowbbs("countwb")=0then%>

      回复<<%=showbbs("countwb")%>>

--回复条数-->

     <%else%>

      

id=<%=showbbs("id")%>">

      回复<<%=showbbs("countwb")%>>

      

--回复条数-->

     <%endif%> 

  

     <%wt=showbbs("wtime")'如果为撰写当天的时间,红色显示。

     ifyear(now())=year(wt)andmonth(now())=month(wt)andday(now())=day(wt)then%>

      撰写/修改时间:

<%=wt%> 

     <%else%>

      撰写/修改时间:

<%=wt%> 

     <%endif%>

  

     

id=<%=showbbs("id")%>">修改

     

id=<%=showbbs("id")%>">删除

dashed#999999">

<%showbbs.movenext

ifshowbbs.EOFthenexitfor

Next%>


<%'以下为页码显示。

ifPage<>1then%>

Page=1&CurrentPageN=1">(首页)

<%else%>

(当前为首页)

<%endif%>

<%ifPageCount>PageNandCurrentPageN>=2then%>

Page=<%=(CurrentPageN-2)*PageN+1%>&CurrentPageN=<%=CurrentPageN-1%>">(上<%=PageN%>页)

<%endif%>

<%fori=(CurrentPageN-1)*PageN+1to(CurrentPageN-1)*PageN+PageN%>

<%ifi=Pagethen%>

     -<%=i%>-

<%elseifi

     

page=<%=i%>&CurrentPageN=<%=CurrentPageN%>"> <%=i%> 

<%endif%>

<%Next%>

<%ifPageCount>PageNandCurrentPageN

Page=<%=CurrentPageN*PageN+1%>&CurrentPageN=<%=CurrentPageN+1%>">(下<%=PageN%>页)

<%endif%>

<%ifPageCount>PageNandPage<>PageCountthen%>

Page=<%=PageCount%>&CurrentPageN=<%=int(PageCount/PageN)+1%>">(最后一页)

<%endif%>

<%ifPageCount=Pagethen%>(当前为最后页)<%endif%>

(共<%=PageCount%>页)

<%showbbs.Close

setshowbbs=nothing

endif

endsub%>

--------------------------------------------------->

<%subsaysth()

'下方的快捷发表表单

name=request.QueryString("name")%>

      style="border-collapse:

collapse;" 

      width=600align=center>

发表文章:


大名:

>

密码:

12px">

点此注册

标题:


内容:



<%endsub%>

------------------------------------------------------------->

讨论区首页

     

        

       <%headtext()%>

        

     

     

        

       <%maintalk()%><%saysth()%>

        

     

  

     

        

        

        

     

--#includefile="footer.htm"-->

6、show.asp 

源代码:

--#includefile="conn.asp"-->

--#includefile="header.htm"-->

<%id=request.querystring("id")

setshow=conn.execute("select*frombbswhereid="&id&"")'全局%>

<%submaintalk

'主文章%>


<%=show("title")%>

作者:

auname=<%=show("name")%>"><%=show("name")%> 

撰写/修改时间:

<%=show("wtime")%> 

id=<%=show("id")%>">修改

id=<%=show("id")%>">删除

内容:

<%=show("body")%>


<%endsub%>

<%subwbtalk()

'回复文章%>

<%sql="select*frombbbswherehostid='"&id&"'orderbybtimeasc"

setshowwback=conn.execute(sql)

floori=0

dowhilenotshowwback.eof'没有像主页那样分页,原理相同。

floori=floori+1%>

<%=floori%>楼:

<%=showwback("btitle")%>

回复人:

auname=<%=showwba

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 表格模板 > 合同协议

copyright@ 2008-2023 冰点文库 网站版权所有

经营许可证编号:鄂ICP备19020893号-2