📄 list.asp
字号:
<%@ LANGUAGE="VBSCRIPT" %>
<% option explicit%>
<!--#include file="newconn.asp"-->
<!-- #include file="inc/char.inc" -->
<!-- #include file="inc/tree.inc"-->
<html>
<head>
<meta NAME="GENERATOR" Content="Microsoft FrontPage 3.0" CHARSET="GB2312">
<title>ASP动网论坛</title>
<link rel="stylesheet" type="text/css" href="forum.css">
</head>
<body>
<%
dim sql,rs,rsBoard,BoardName,boardsql
dim selStr
dim mailStr1
dim mailStr2
dim boardmaster
'on error resume next
selStr="()"
if not isEmpty(request("lstRefreshBoard")) then
boardID=request("lstRefreshBoard")
elseif not isEmpty(request("BoardID")) then
boardID=request("BoardID")
end if
selStr=""
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
set rsBoard=server.createobject("adodb.recordset")
boardsql="select * from board where boardID="&request("boardid")
rsboard.open boardsql,conn,1,1
if not rsboard.eof then
boardname=rsboard("boardname")
session("boardtype")=rsboard("boardtype")
boardmaster=rsboard("boardmaster")
if trim(rsboard("masteremail"))<>"" then
mailStr1="<a href='mailto:"+trim(rsboard("masteremail"))+"'>"
mailStr2="</a>"
else
mailStr1=""
mailStr2=""
end if
if boardID>0 then
set rs=server.createobject("adodb.recordset")
sql="select AnnounceID,boardID from bbs1 where boardID="+cstr(boardID)+" and parentID=0 ORDER BY announceID desc "
rs.open sql,conn,1,1
if not rs.eof then
totalAnnounce=rs.recordcount
dim i
i=0
if currentPage=1 then
do while not rs.EOF
if selstr="" then
selStr=selStr+cstr(rs("announceid"))
else
selStr=selStr+","+cstr(rs("announceid"))
end if
i=i+1
if i>=maxannounce then exit do
rs.MoveNext
loop
else
if (currentPage-1)*maxannounce<totalAnnounce then
rs.move (currentPage-1)*maxannounce
dim bookmark
bookmark=rs.bookmark
do while not rs.EOF
if selstr="" then
selStr=selStr+cstr(rs("announceid"))
else
selStr=selStr+","+cstr(rs("announceid"))
end if
i=i+1
if i>=maxannounce then exit do
rs.MoveNext
loop
else
currentPage=1
do while not rs.EOF
if selstr="" then
selStr=selStr+cstr(rs("announceid"))
else
selStr=selStr+","+cstr(rs("announceid"))
end if
i=i+1
if i>=maxannounce then exit do
rs.MoveNext
loop
end if
end if
dim n
selstr="("+selstr+")"
if selStr<>"()" then
sql="select * from bbs1 where (rootID in "&selStr& " ) ORDER BY rootID desc,orders "
else
sql="select * from bbs1 ORDER BY rootID desc,orders "
end if
end if
rs.Close
rs.open sql,conn,1,1
showpage session("boardtype"),boardmaster,totalannounce,request("boardid"),mailstr1,mailstr2
showlist()
showpage session("boardtype"),boardmaster,totalannounce,request("boardid"),mailstr1,mailstr2
else
response.write "<p> 版面:"+session("boardtype")+"<br>版主:"+mailstr1+boardmaster+mailstr2+"<br>"
response.write " 本论坛无内容 "
response.write "<p><a href='Announce.asp?boardID="+request("boardid")+"' target="+chr(34)+"BoardAnnounce"+chr(34)+">我要发言</a> <a href='List.asp?boardID="+request("boardid")+"'>刷新浏览</a> "
end if
rs.close
sub showlist()
on error resume next
dim outtext
dim bytestr
response.write "<ul>"
dim layer
layer=1
do while not (rs.eof or err.number<>0)
do while layer<> rs("layer")
if rs("layer")> layer then
outtext=outtext & "<ul>"
layer=layer+1
else
outtext=outtext & "</ul>" & chr(13) & chr(10)
layer=layer-1
end if
loop
outtext=outtext & "<li>"
outtext=outtext & "<img src=images/"&rs("Expression")&">"
outtext=outtext & "<a href='ShowAnnounce.asp?boardID="+request("boardID")+"&RootID="&cstr(rs("RootID"))&"&ID="&Cstr(rs("announceID"))&"' target='BoardAnnounce'>"
dim t
if rs("Length")=0 then
t=" <无内容>"
else
t=" "
end if
if pwsonchsys then
outtext=outtext & htmlencode(rs("Topic")+t)
else
outtext=outtext & Server.HTMLEncode(rs("Topic")+t)
end if
outtext=outtext & "</a> - <strong>"
bytestr="("+cstr(rs("length"))
if not WINNT_CHINESE then
if rs("Length")-1=1 then
bytestr=bytestr+" Byte)"
else
bytestr=bytestr+" Bytes)"
end if
else
bytestr=bytestr+"字)"
end if
if pwsonchsys then
outtext=outtext & htmlencode(rs("UserName"))
else
outtext=outtext & Server.HTMLEncode(rs("UserName") )
end if
outtext=outtext & " </strong><font color=red><em>20"&rs("DateAndTime")&"</em></font> [ID:"+cstr(rs("announceID"))+" 点击:"&rs("Hits")&"] "+bytestr+" <font color='red'>(" + Cstr(rs("child"))+")</font>"+chr(13)+chr(10)
if trim(rs("DateAndTime"))<>"" and isdate(rs("DateAndTime")) then
if cbool(cdate(rs("DateAndTime"))>(date()-1))=true then
outtext=outtext & "<img src='images/new.gif'>"+chr(13)+chr(10)
end if
end if
rs.movenext
response.write outtext
outtext=""
loop
if layer<>0 then
dim i
for i=1 to layer
outtext=outtext & "</ul>"
next
end if
outtext=outtext & "</ul>"
response.write outtext
end sub
function showpage(boardtype,boardmaster,totalannounce,boardid,mailstr1,mailstr2)
response.write "<table border='1' width='98%' cellspacing='0' bordercolorlight='#000000' bordercolordark='#FFFFFF' cellpadding='0'><tr>"
response.write "<tr><td nowrap bgcolor='#FEEC85'><p align=left>版面:"&boardtype&"</td>"
response.write "<td nowrap bgcolor='#FEEC85'><p align='left'>"
response.write "版主:"+mailstr1+boardmaster+mailstr2+"</td>"
response.write "<td nowrap bgcolor='#FEEC85'><p align='center'><a href=Announce.asp?boardID="&boardid&" target=BoardAnnounce>我要发言</a></td>"
response.write "<td nowrap bgcolor='#FEEC85'><p align='center'><a href=list.asp?boardID="&boardid&"&page=1>刷新浏览</a></td>"
dim n
if totalAnnounce mod maxannounce=0 then
n= totalAnnounce \ maxannounce
else
n= totalAnnounce \ maxannounce+1
end if
response.write "<form method=Post action=list.asp?boardID="&boardid&">"
response.write "<td nowrap align='center' bgcolor='#FEEC85'>"
if CurrentPage<2 then
response.write "<font color='navy'>首页 前页</font> "
else
response.write "<a href=list.asp?boardID="&boardid&"&page=1>首页</a> "
response.write "<a href=list.asp?boardID="&boardid&"&page="&CurrentPage-1&">前页</a> "
end if
if n-currentpage<1 then
response.write "<font color='navy'>后页 尾页</font>"
else
response.write "<a href=list.asp?boardID="&boardid&"&page="&(CurrentPage+1)
response.write ">后页</a> <a href=list.asp?boardID="&boardid&"&page="&n&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页</td>"
response.write "<td valign=top align=center nowrap bgcolor='#FEEC85'>"
response.write "<p>转到:<input type='text' name='page' size=3 maxlength=10 class=smallInput value="¤tpage&">"
response.write "<input class=buttonface type='submit' value=' Go ' name='B1'></span></p></td></form>"
response.write "</table>"
end function
else
Response.Write "该论坛不存在!"
end if
rsBoard.Close
set rsboard=nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -