简单的浮点论坛
发布时间:2006-10-14 2:58:30   收集提供:gaoqian
简单的做了一个,扫描一次数据库可得一棵树
-----index.asp------

<html>

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

<body marginwidth="0" marginheight="0">
<div align="center">
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="24" >
<tr>
<td width="80"> </td>
<td><a href="#form">发新贴</A></td>
</tr>
</table>

<br>
<table border="0" width="90%" 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 width="100%" valign="top" align="left" colspan="2">
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="25%" >姓名:<%=rtrim(dbr("name")) %></td>
<td width="25%" ><% if rtrim(dbr("email"))<>"" then %><%rtrim(dbr("email"))%><% end if %></td>
<td width="25%" >时间:<%= datevalue(dbr("thedate")) %></td>
<% a= cdbl(dbr("id")) %>
<% next %>
<td width="25%"><a href="reply.asp?id=<%=a%>">回复</a></td>
</tr>
</table>
</td>
</tr>
<tr>
<td width="100%" valign="top" align="left" colspan="2"><%=rtrim(dbr("title")) %></td>
</tr>
<tr>
<td width="100%" valign="top" align="left" colspan="2"><%=replace(server.htmlencode(rtrim(dbr("comm"))),chr(13),"<br>") %></td>
</tr>
<% dbr.movenext %>
<% if dbr.EOF Then Exit For %>
<% next %>
<tr>
<td align="right" height="30" width="500"><a href="index.asp?pagelist=<%=CINT(pagelist)+1%> "><span class="link">>>更多</span></td>
<td align="right" height="30"> </td>
</tr>
</table>
<form method="POST" action="add.asp">
<table border="0" width="90%" cellspacing="0" cellpadding="0">
<tr>
<td width="12%" class="title"><b>姓  名:</b></td>
<td width="88%">
<input type="text" name="name" size="30" class="name">
</td>
</tr>
<tr>
<td width="12%" class="title"><b>E-mail:</b></td>
<td width="88%">
<input type="text" name="email" size="30" class="box">
</td>
</tr>
<tr>
<td width="12%" class="title"><b>标  题:</b></td>
<td width="88%">
<input type="text" name="title" size="30" class="box">
</td>
</tr>
<tr>
<td width="12%" valign="top" class="title"><b>内  容:</b></td>
<td width="88%">
<textarea rows="5" name="comm" cols="30" class="box"></textarea>
</td>
</tr>
<tr>
<td width="12%"></td>
<td width="88%">
<input type="image" border="0" name="imageField" src="pic/send.gif" width="51" height="19">
</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 align="center">

<form method="POST" action="add.asp">
<table border="0" width="90%" cellspacing="0" cellpadding="0">
<tr>
<td width="12%" class="title"><b>姓  名:</b></td>
<td width="88%">
<input type="text" name="name" size="50" class="name">
</td>
</tr>
<tr>
<td width="12%" class="title"><b>E-mail:</b></td>
<td width="88%">
<input type="text" name="email" size="50" class="box">
</td>
</tr>
<tr>
<td width="12%" class="title"><b>标  题:</b></td>
<td width="88%">
<input type="text" name="title" size="50" class="box" value="RE:<%=server.htmlencode(rtrim(dbr("title")))%>">
<input type="hidden" name="id" value="<%=request("id")%>">
</td>
</tr>
<tr>
<td width="12%" valign="top" class="title"><b>内  容:</b></td>
<td width="88%">
<textarea rows="5" name="comm" cols="48" class="box"></textarea>
</td>
</tr>
<tr>
<td width="12%"></td>
<td width="88%">
<input type="image" border="0" name="imageField" src="pic/send.gif" width="51" height="19">
</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 align="center">
<table width="450" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60" class="title">姓名、标题不能为空</td>
</tr>
<tr>
<td align="center" height="30"><a href="index.asp" class="link">返回</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 %>


 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50