stype = trim(request("stype"))
if stype = "" then stype = "ALL"
searchstr = trim(request("searchstr"))
sql = "SELECT count(*) as count FROM AdminBBS"
if stype = "title" then
sql = sql & " WHERE title like '%" & searchstr & "%'"
elseif stype = "author" then
sql = sql & " WHERE name like '%" & searchstr & "%'"
elseif stype = "text" then
sql = sql & " WHERE comment like '%" & searchstr & "%'"
end if
set cnt_rs = DbCon.Execute(sql)
totalNum = cnt_rs("count")
PageSize = 15
curPage = request("page")
if curPage = "" then curPage = 1
sql = "SELECT Top " & PageSize * curPage & " * FROM AdminBBS "
if stype = "title" then
sql = sql & " WHERE title like '%" & searchstr & "%'"
elseif stype = "author" then
sql = sql & " WHERE name like '%" & searchstr & "%'"
elseif stype = "text" then
sql = sql & " WHERE comment like '%" & searchstr & "%'"
end if
sql = sql & " ORDER BY idx desc"
set rs = DbCon.Execute (sql)
if not rs.EOF then
rs.Move ((curPage-1) * PageSize)
LastPage = Round((totalNum-1) / PageSize + 0.51)
if LastPage < 1 then LastPage = 1
%>
现有公告: 条, 第一页 / 最后一页
No.
Title
Name
Date
Hit
index = rs("idx")
title = rs("title")
if len(title) > 23 then
title = "" & left(title,23) & "..."
else
title = "" & left(title,23)
end if
name = rs("name")
writeday = left(rs("date"),10)
tmp_year = CStr(Year(Date()))
tmp_month = CStr(Month(Date()))
if len(tmp_month) = 1 then tmp_month = "0" & tmp_month
tmp_day = CStr(Day(Date()))
if len(tmp_day) = 1 then tmp_day = "0" & tmp_day
cur_day = tmp_year & "-" & tmp_month & "-" & tmp_day
if cur_day = writeday then title = title & " "
count = rs("readNum")
%>
wend%>
count = 0
start = curPage - 5
if start < 1 then start = 1
response.write ("" & "[上一页] ")
for i=start to LastPage
if (CLng(i) CLng(curPage)) then
response.write ("[" & i & "] ")
else
response.write ("[" & i & "] ")
end if
count = count + 1
if (count > 9) then exit for
next
response.write ("[下一页]")
%>
按标题
按作者
按内容
else
%>
alert("目前还没有公告");
location.href = "../../main.asp";
//-->
end if
%>