簡單的浮點論壇

來源:互聯網
上載者:User


簡單的做了一個,掃描一次資料庫可得一棵樹
-----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="http://www.163design.net/a/q/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="http://www.163design.net/a/q/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 %>




相關文章

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。