📄 list.asp
字号:
<%
'session.abandon
'Server.ScriptTimeOut=500
function opendb(DBPath,sessionname,dbsort)
dim conn
'if not isobject(session(sessionname)) then
Set conn=Server.CreateObject("ADODB.Connection")
'if dbsort="accessdsn" then conn.Open "DSN=" & DBPath
'if dbsort="access" then conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
'if dbsort="sqlserver" then conn.Open "DSN=" & DBPath & ";uid=wsw;pwd=wsw"
DBPath1=server.mappath("../db/lmtof.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath1
set session(sessionname)=conn
'end if
set opendb=session(sessionname)
end function
%>
<%
'-----------------------------------------
oabusyname=request.cookies("oabusyname")
oabusyusername=request.cookies("oabusyusername")
oabusyuserdept=request.cookies("oabusyuserdept")
oabusyuserlevel=request.cookies("oabusyuserlevel")
if oabusyusername="" then
response.write("<script language=""javascript"">")
response.write("window.top.location.href='../default.asp';")
response.write("</script>")
response.end
end if
%>
<!--#include file="newconn.asp"-->
<!-- #include file="inc/char.inc" -->
<!-- #include file="inc/tree.inc"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title><%=application("UnitName")%>办公论坛</title>
<link rel="stylesheet" type="text/css" href="forum.css">
</head>
<body bgcolor="#E6E8F0">
<div align="left"></div>
<table border="0" cellspacing="0" cellpadding="0" align="center" background="images/bak1.jpg">
<tr>
<td width="510" height="56" align="left"> <img src="images/bbsbanner.gif" width="510" height="56"> </td>
<td height="56" valign="bottom" align="right">
<div align="center"></div>
</td>
</tr>
</table>
<p>
<%
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='write.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='showwrite.asp?boardID="+request("boardID")+"&RootID="&cstr(rs("RootID"))&"&ID="&Cstr(rs("announceID"))&"' >"
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=#009966>"&rs("DateAndTime")&"</font> [ 点击:"&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' background='images/line1.jpg'><tr>"
response.write "<tr><td nowrap background='images/line1.jpg'><p align='center'>"&boardtype&"</td>"
response.write "<td nowrap background='images/line1.jpg'><p align='center'>"
response.write "管理员:"+mailstr1+boardmaster+mailstr2+"</td>"
response.write "<td nowrap background='images/line1.jpg'><p align='center'><a href=write.asp?boardID="&boardid&" >我要发言</a></td>"
response.write "<td nowrap background='images/line1.jpg'><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' background='images/line1.jpg'>"
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 background='images/line1.jpg'>"
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
%>
</p>
<hr size="2" width="70%" align="center">
<div align="center">
<p>|<a href="query.asp"> 帖子查询</a> |<a href="myinfo.asp?page=2"> </a> <a href="point.asp">积分排行</a>|
<a href="myinfo.asp?page=2">信息修改 </a>| <a href="elogin.asp" target=_blank>论坛管理</a>
| </p>
<p><font color="#003366">COPYRIGHT© BY 红孩儿Office © 2000--2001 All Rights
Reserved </font></p>
</div>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -