📄 showforum.asp
字号:
end if
defdate = dateadd("d", -cint(showdays), date)
i = 1
pagecount = 1
StrHtml = loadtemplate("forumlist")
StrSql = "select * from sf_thread where visible > 0 and forumid = " & forumid
if showdays <> 0 then StrSql = StrSql & " and lastpost > '" & defdate & "'"
select case request("threadtype")
case "best"
StrSql = StrSql & " and best = 1"
strurl = "&threadtype=best"
case "hot"
StrSql = StrSql & " and (views > " & hothit & " or replycount > " & hotreply & ")"
strurl = "&threadtype=hot"
case "vote"
StrSql = StrSql & " and pollid <> -1"
strurl = "&threadtype=vote"
end select
StrSql = StrSql & " order by displayorder DESC, "
if showorder <> defshoworder then
select case showorder
case "1"
' thread's create time
StrSql = StrSql & "dateline DESC"
case "2"
' thread's reply count
StrSql = StrSql & "replycount DESC"
case "3"
' thread's hit count
StrSql = StrSql & "views DESC"
case else
StrSql = StrSql & "lastpost DESC"
end select
else
StrSql = StrSql & "lastpost DESC"
end if
Set rs2 = server.CreateObject("ADODB.RecordSet")
rs2.Open StrSql, Conn, 1, 1
if not (rs2.bof or rs2.eof) then
threadmovetext = loadtemplate("hint_threadmovetext")
threadvotetext = loadtemplate("hint_threadvotetext")
rs2.PageSize = forumrow
if page > rs2.PageCount then page = rs2.PageCount
rs2.AbsolutePage = page
pagecount = rs2.PageCount
do until rs2.eof or i > rs2.PageSize
StrHtml2 = StrHtml
''''''''''''''''''''''''
'emot icon
''''''''''
if rs2("iconid") <> 0 then
StrHtml2 = Replace(StrHtml2, "{thread_icon}", "<img src=""image/posticon/icon" & rs2("iconid") & ".gif"">")
else
StrHtml2 = Replace(StrHtml2, "{thread_icon}", "")
end if
'''''''''''''''''''''''''
' thread icon
'''''''''''''
threadtypeicon = "old"
if datediff("h", now(), rs2("lastpost")) = 0 then threadtypeicon = "new"
if rs2("views") > hothit or rs2("replycount") > hotreply then threadtypeicon = "hot"
if rs2("best") = 1 then threadtypeicon = "best"
if rs2("open") = 0 then threadtypeicon = "close"
if rs2("displayorder") > 0 then threadtypeicon = "top"
StrHtml2 = Replace(StrHtml2, "{thread_typeicon}", "<img src=""style/" & loadtemplate("path") & "/threadicon/" & threadtypeicon & ".gif"">")
strhref = "showthread.asp?threadid=" & rs2("threadid")
threadtitle = rs2("title")
if rs2("pollid") <> -1 then
threadtitle = threadvotetext & rs2("title")
end if
if rs2("moved") > 0 then
strhref = "showthread.asp?threadid=" & rs2("moved")
threadtitle = threadmovetext & rs2("title")
end if
strthreadhref = "<a href=""" & strhref & """>" & threadtitle & "</a> "
postnum = rs2("replycount")
pagenum = postnum \ postrow
if (postnum - pagenum * postrow) > 0 then pagenum = pagenum + 1
if pagenum <= 1 then
pagenum = 1
else
strthreadhref = strthreadhref & "("
for pagei = 1 to pagenum
if (pagei < 6) or (pagei = pagenum) then
strthreadhref = strthreadhref & " <a href=""" & strhref & "&page=" & pagei & """>" & pagei & "</a>"
else
strthreadhref = strthreadhref & " ."
end if
next
strthreadhref = strthreadhref & " )"
end if
if rs2("rating") > 0 then strthreadhref = strthreadhref & " (" & Replace(loadtemplate("hint_threadrating"), "{rating}", rs2("rating")) & ")"
StrHtml2 = Replace(StrHtml2, "{thread_id}", rs2("threadid"))
StrHtml2 = Replace(StrHtml2, "{thread_title}", strthreadhref)
StrHtml2 = Replace(StrHtml2, "{newwin}", "<a href=" & strhref & " target=_blank><img src=""style/" & loadtemplate("path") & "/image/newwin.gif"" border=""0""></a>")
StrHtml2 = Replace(StrHtml2, "{thread_user}", "<a href=""showuser.asp?userid=" & rs2("postuserid") & """>" & rs2("postusername") & "</a>")
StrHtml2 = Replace(StrHtml2, "{hits_num}", rs2("views"))
StrHtml2 = Replace(StrHtml2, "{post_num}", postnum)
StrHtml2 = Replace(StrHtml2, "{last_user}", rs2("lastpost") & "<br><a href=""showuser.asp?userid=" & rs2("lastposterid") & """>" & rs2("lastposter") & "</a>")
response.write StrHtml2
rs2.MoveNext
i = i + 1
loop
end if
StrHtml = loadtemplate("forumpage")
StrHtml2 = "<img src=""style/" & loadtemplate("path") & "/image/page.gif""> " & pagecount & ": "
beginpage = 1
endpage = pagecount
if pagecount >= 9 then
if page >= 5 then
beginpage = page - 4
if page <= (pagecount - 4) then
endpage = page + 4
else
endpage = pagecount
beginpage = pagecount - 4
end if
else
beginpage = 1
endpage = 9
end if
end if
if beginpage>1 then StrHtml2 = StrHtml2 & " <a href=""showforum.asp?forumid=" & forumid & strurl &""">«</a>"
for i=beginpage to endpage
if i = page then
StrHtml2 = StrHtml2 & " <b>" & i & "</b> "
else
StrHtml2 = StrHtml2 & "<a href=""showforum.asp?forumid=" & forumid & "&page=" & i & strurl & """> " & i & " </a>"
end if
next
if endpage < pagecount then StrHtml2 = StrHtml2 & " <a href=""showforum.asp?forumid=" & forumid & "&page=" & pagecount & strurl & """>»</a>"
StrHtml = Replace(StrHtml, "{page_text}", StrHtml2)
response.write StrHtml
''''''''''''''''''''
' forum jump
''''''''''''
response.write "<script language=JavaScript>" & chr(10)
response.write "function goforum(strgoforum) {" & chr(10)
response.write "location.replace(strgoforum)" & chr(10)
response.write "}"
response.write "</script>"
StrHtml = loadtemplate("forumbottom")
if showdays = 0 then
StrHtml = Replace(StrHtml, "{showdays}", "All")
else
StrHtml = Replace(StrHtml, "{showdays}", showdays)
end if
StrHtml = Replace(StrHtml, "{img_gotop}", "<a href=""#top""><img src=""style/" & loadtemplate("path") & "/image/gotop.gif"" align=""absbottom"" border=0></a>")
StrHtml2 = "<select onChange=goforum(this.options[this.selectedIndex].value)>" & chr(10)
StrHtml2 = StrHtml2 & "<option value=#>" & loadtemplate("hint_selectforum") & "</option>" & chr(10)
StrSql = "select sf_forum.forumid, sf_forum.cateid, sf_forum.title, sf_cate.catetitle from sf_forum left join sf_cate on (sf_forum.cateid = sf_cate.cateid) where sf_cate.displayorder>0 and sf_forum.displayorder>0 order by sf_cate.displayorder DESC, sf_cate.cateid ASC, sf_forum.displayorder DESC, sf_forum.forumid ASC"
Set rs2 = Conn.Execute(StrSql)
if not (rs2.bof or rs2.eof) then
do until rs2.eof
if nowcateid <> rs2("cateid") then
nowcateid = rs2("cateid")
StrHtml2 = StrHtml2 & "<option value=""showcate.asp?cateid=" & nowcateid & """>--- " & rs2("catetitle") & " ---</option>" & chr(10)
end if
StrHtml2 = StrHtml2 & "<option value=""showforum.asp?forumid=" & rs2("forumid") & """> " & rs2("title") & "</option>" & chr(10)
rs2.MoveNext
loop
end if
StrHtml2 = StrHtml2 & "</select>" & chr(10)
StrHtml = Replace(StrHtml, "{forum_select}", StrHtml2)
StrHtml2 = "<form action=""" & request.ServerVariables("SCRIPT_NAME") & "?" & request.QueryString & """ method=""post"">"
StrHtml = Replace(StrHtml, "{form_viewselect_top}", StrHtml2)
StrHtml2 = "<input type=""hidden"" name=""updateviewselect"" value=""true""><input type=""submit"" value=""Go""></form>"
StrHtml = Replace(StrHtml, "{form_viewselect_bottom}", StrHtml2)
StrHtml = Replace(StrHtml, "{img_ann}", "<img src=""style/" & loadtemplate("path") & "/threadicon/ann.gif"">")
StrHtml = Replace(StrHtml, "{img_top}", "<img src=""style/" & loadtemplate("path") & "/threadicon/top.gif"">")
StrHtml = Replace(StrHtml, "{img_new}", "<img src=""style/" & loadtemplate("path") & "/threadicon/new.gif"">")
StrHtml = Replace(StrHtml, "{img_old}", "<img src=""style/" & loadtemplate("path") & "/threadicon/old.gif"">")
StrHtml = Replace(StrHtml, "{img_hot}", "<img src=""style/" & loadtemplate("path") & "/threadicon/hot.gif"">")
StrHtml = Replace(StrHtml, "{img_close}", "<img src=""style/" & loadtemplate("path") & "/threadicon/close.gif"">")
StrHtml = Replace(StrHtml, "{img_best}", "<img src=""style/" & loadtemplate("path") & "/threadicon/best.gif"">")
response.write StrHtml
response.write Strforuminfo
''''''''''''''''''''''''
'show online.....
'''''''''''''''''''''
StrHtml = loadtemplate("forumonlinetop")
rs2.close
StrSql = "select userid, username, usergroup, invisible from sf_user where lastforum = " & forumid & " and lastactivity > #" & dateadd("n", onlinetime * -1, now()) & "# order by lastactivity DESC"
rs2.Open StrSql, Conn, 1, 1
if rs2.bof or rs2.eof then
StrHtml = Replace(StrHtml, "{online_usernum}", 0)
StrHtml2 = " "
else
StrHtml = Replace(StrHtml, "{online_usernum}", rs2.RecordCount)
StrHtml2 = "<table width=""100%"" border=""0"" cellspacing=""8"" cellpadding=""0""><tr>"
i = 1
do until rs2.eof
if rs2("invisible") <> 1 then StrHtml2 = StrHtml2 & "<td width=""16%""><img src=""style/" & loadtemplate("path") & "/onlineicon/" & rs2("usergroup") & ".gif""><a href=""showuser.asp?userid=" & rs2("userid") & """ target=_blank>" & rs2("username") & "</a></td>"
if (i mod 6) = 0 then StrHtml2 = StrHtml2 & "</tr><tr>"
i = i + 1
rs2.MoveNext
loop
StrHtml2 = StrHtml2 & "</tr></table>"
end if
response.write StrHtml
if rs2.RecordCount < 100 or request("showonline") = "yes" then response.write StrHtml2
StrHtml = loadtemplate("forumonlinebottom")
response.write StrHtml
response.write sfcopyright
response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs = nothing
Set rs2 = nothing
Set page = nothing
Set showdays = nothing
Set showorder = nothing
Set StrHtml = nothing
Set SetHtml2 = nothing
Set Strforuminfo = nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -