简单的浮点论坛

网络整理 - 09-16
简单的做了一个,扫描一次数据库可得一棵树
-----index.asp------

<html>

<head>
<title>浮点论坛</title></head>

<body marginwidth="0" marginheight="0">
<div>
<table cellspacing="0" cellpadding="0" >
<tr>
<td> </td>
<td><a href="#form">发新贴</A></td>
</tr>
</table>

<br>
<table cellspacing="0" cellpadding="0">
<% set dbr = server.createobject("adodb.recordset")%>
<% dbr.pagesize = 50 %>
<% dbr.CacheSize = dbr.pagesize %>
<% dbr.open "select * from forum where (isdel = 'n') order by id desc",application("oledb") ,1,1%>
<% msgcount=dbr.recordcount %>
<% msgpcount=dbr.pagecount %>
<% pagelist=request("pagelist") %>
<% if CINT(pagelist) > dbr.pagecount then pagelist = dbr.pagecount %>
<% if CINT(pagelist) < 1 then pagelist=1 %>
<% dbr.AbsolutePage=pagelist %>
<% for i= 1 to dbr.pagesize %>
<tr>
<td valign="top" colspan="2">
<table cellspacing="0" cellpadding="0">
<tr>
<td >姓名:<%=rtrim(dbr("name")) %></td>
<td ><% if rtrim(dbr("email"))<>"" then %><%rtrim(dbr("email"))%><% end if %></td>
<td >时间:<%= datevalue(dbr("thedate")) %></td>
<% a= cdbl(dbr("id")) %>
<% next %>
<td><a href="reply.asp?id=<%=a%>">回复</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td valign="top" colspan="2"><%=rtrim(dbr("title")) %></td>
</tr>
<tr>
<td valign="top" colspan="2"><%=replace(server.htmlencode(rtrim(dbr("comm"))),chr(13),"<br>") %></td>
</tr>
<% dbr.movenext %>
<% if dbr.EOF Then Exit For %>
<% next %>
<tr>
<td><a href="index.asp?pagelist=<%=CINT(pagelist)+1%> "><span>>>更多</span></td>
<td> </td>
</tr>
</table>
<form method="POST" action="add.asp">
<table cellspacing="0" cellpadding="0">
<tr>
<td><b>姓  名:</b></td>
<td>
<input type="text" size="30">
</td>
</tr>
<tr>
<td><b>E-mail:</b></td>
<td>
<input type="text" size="30">
</td>
</tr>
<tr>
<td><b>标  题:</b></td>
<td>
<input type="text" size="30">
</td>
</tr>
<tr>
<td valign="top"><b>内  容:</b></td>
<td>
<textarea rows="5" cols="30"></textarea>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="image" src="http://www.xbasp.net/pic/send.gif">
</td>
</tr>
</table>
</form></div>

</body>

</html>
-----replay.asp---------

<% id = request("id")%>
<% set dbr = server.createobject("adodb.recordset")%>
<% dbr.open "select * from forum where (id=" & id & ")",application("oledb") ,1,1%>
<html>

<head>
<title>浮点论坛</title></head>

<body bgcolor="#FFFCF0" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div>

<form method="POST" action="add.asp">
<table cellspacing="0" cellpadding="0">
<tr>
<td><b>姓  名:</b></td>
<td>
<input type="text" size="50">
</td>
</tr>
<tr>
<td><b>E-mail:</b></td>
<td>
<input type="text" size="50">
</td>
</tr>
<tr>
<td><b>标  题:</b></td>
<td>
<input type="text" size="50" value="RE:<%=server.htmlencode(rtrim(dbr("title")))%>">
<input type="hidden" value="<%=request("id")%>">
</td>
</tr>
<tr>
<td valign="top"><b>内  容:</b></td>
<td>
<textarea rows="5" cols="48"></textarea>
</td>
</tr>
<tr>
<td></td>
<td>
<input type="image" src="http://www.xbasp.net/pic/send.gif">
</td>
</tr>
</table>
</form></div>
<% dbr.close %>
<% set dbr = nothing %>
</body>

</html>
-------add.asp------
<% if request("name")="" or replace(request("title"),"RE:","")="" then %>
<html>
<head>
<title>浮点论坛</title></head>

<body background="pic/bg_bbs.gif" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div>
<table cellspacing="0" cellpadding="0">
<tr>
<td>姓名、标题不能为空</td>
</tr>
<tr>
<td><a href="index.asp">返回</a></td>
</tr>
</table>
</div>
</body>
</html>
<% response.end %>
<% end if %>
<% set dbr= server.createobject("adodb.recordset") %>
<% if request("id")="" then %>
<% dbr.open "select max(id)+1 as maxid from forum" ,application("oledb"),1,1%>

<% tid=cint(dbr("maxid")) %>
<% dbr.close%>
<% dbr.open "select top 0 * from forum",application("oledb"),1,3 %>
<%
dbr.addnew
dbr("id")=tid
dbr("title")=request("title")
dbr("comm")=request("comm")
dbr("name")=request("name")
dbr("email")=request("email")
dbr("ip")=Request.ServerVariables("REMOTE_ADDR")
dbr("isdel")="n"
dbr("thedate")=cdate(now)
dbr.update
dbr.close
%>
<% set dbr = nothing %>
<% response.redirect("index.asp")%>
<% dbr.close %>
<% else %>
<% d = request("id") %>
<% dbr.open "SELECT TOP 2 * FROM forum WHERE (id <= " & d & ") ORDER BY id DESC",application("oledb") ,1,1%>
<% if dbr.recordcount=1 then %>
<% inid=cdbl(dbr("id"))-(cdbl(dbr("id"))-0)/2%>
<% dbr.close %>

<% dbr.open "select top 0 * from forum",application("oledb"),1,3 %>
<%
dbr.addnew
dbr("id")=inid
dbr("title")=request("title")
dbr("comm")=request("comm")
dbr("name")=request("name")
dbr("email")=request("email")
dbr("ip")=Request.ServerVariables("REMOTE_ADDR")
dbr("isdel")="n"
dbr("thedate")=cdate(now)
dbr.update
dbr.close
%>
<% set dbr = nothing %>
<% response.redirect("index.asp")%>

<% elseif dbr.recordcount=2 then %>
<% maxid = cdbl(dbr("id")) %>
<% dbr.movenext %>
<% minid = cdbl(dbr("id")) %>
<% dbr.close %>
<% inid=maxid-(maxid-minid)/2 %>
<%= inid %>
<% dbr.open "select top 0 * from forum",application("oledb"),1,3 %>
<%
dbr.addnew
dbr("id")=inid
dbr("title")=request("title")
dbr("comm")=request("comm")
dbr("name")=request("name")
dbr("email")=request("email")
dbr("ip")=Request.ServerVariables("REMOTE_ADDR")
dbr("isdel")="n"
dbr("thedate")=cdate(now)
dbr.update
dbr.close
%>
<% set dbr = nothing %>
<% response.redirect("index.asp")%>
<% end if %>
<% end if %>