news.asp

来自「应用于高等院校党团思想教育」· ASP 代码 · 共 42 行

ASP
42
字号
<!--#include file="conn.asp"-->
<%
dim board,max,nem,news
news=0

set rs=Server.CreateObject("adodb.recordset")

if request.querystring("shu")="" or request.querystring("shu")=0 then
  nem=10
else
  nem=CINT(request.querystring("shu"))
end if
if request.querystring("forum")="" then
   board="all"
end if
if request.querystring("maxleg")="" or request.querystring("maxleg")=0 then
   max=20
else
   max=CINT(request.querystring("maxleg"))
end if

if board="all" then
sql="SELECT * FROM bbs1 where ParentID=0 order by DateAndTime desc"
rs.open sql,conn,1,1
else
sql="SELECT * FROM bbs1 where ParentID=0 and BoardID="&request.querystring("forum")&" order by DateAndTime desc"
rs.open sql,conn,1,1
end if

if rs.bof and rs.eof then
response.write "document.write('<p align=center><font size=2 color=red>论坛没有新帖子,正等你发呢~!</font></p>')"
else
do while not rs.eof and news<nem
%>
document.write('<font size=2>·<a href="dispbbs.asp?boardID=<%=rs("BoardID")%>&rootID=<%=rs("RootID")%>&ID=<%=rs("AnnounceID")%>" title="<%=rs("Topic")%>" target=blank><%=Left(rs("Topic"),max)%>...</a>(<a href="dispuser.asp?name=<%=rs("UserName")%>" target=blank><%=rs("UserName")%></a>)</font><br>')
<%
news=news+1
rs.movenext
loop
end if
rs.close
%>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?