⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 showforum.asp

📁 很好的一个论坛原代码
💻 ASP
📖 第 1 页 / 共 2 页
字号:
else
	if not IsNumeric(showdays) then
		showdays = defshowdays
		if daysprune <> 0 then showdays = daysprune
	end if
end if
if showorder = "" then
	showorder = 0
else
	if not IsNumeric(showorder) then
		showorder = 0
	else
		showorder = clng(showorder)
	end if
end if
defdate = dateadd("d", -cint(showdays), date)

i = 1
pagecount = 1
StrHtml = loadtemplate("forumlist")
StrSql = "select * from sf_thread where 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"
			' 发表时间
			StrSql = StrSql & "dateline DESC"
		case "2"
			' 回复数
			StrSql = StrSql & "replycount DESC"
		case "3"
			' 查看数
			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
	threadvotetext = loadtemplate("hint_threadvotetext")
	threadsticktext = loadtemplate("hint_threadsticktext")
	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
		' 帖子表情符号
		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
		' 帖子图示符号
		threadtypeicon = "old"
		if datediff("d", now(), rs2("lastpost")) = 0 then threadtypeicon = "new"
		if rs2("views") > hothit or rs2("replycount") > hotreply then threadtypeicon = "hot"
		if rs2("open") = 0 then threadtypeicon = "close"
		StrHtml2 = Replace(StrHtml2, "{thread_typeicon}", "<img src=""image/threadicon/" & threadtypeicon & ".gif"">")
		strhref = "showthread.asp?threadid=" & rs2("threadid")
		threadtitle = rs2("title")
		strthreadhref = "<a href=""" & strhref & """>" & threadtitle & "</a>&nbsp;"
		if rs2("displayorder") > 0 then strthreadhref = loadtemplate("hint_threadsticktext") & strthreadhref
		if rs2("pollid") <> -1 then strthreadhref = loadtemplate("hint_threadvotetext") & strthreadhref
		if rs2("best") = 1 then strthreadhref = strthreadhref & "<img src=""image/threadicon/best.gif"" align=""absmiddle"">"
		replynum = rs2("replycount")
		postnum = rs2("replycount") + 1
		pagenum = postnum \ postrow
		if (postnum - pagenum * postrow) > 0 then pagenum = pagenum + 1
		if pagenum <= 1 then
			pagenum = 1
		else
			strthreadhref = strthreadhref & "( <img src=""image/default/page.gif"" align=""absmiddle""> :"
			for pagei = 1 to pagenum
				if pagei < 10 then
					strthreadhref = strthreadhref & "&nbsp;<a href=""" & strhref & "&page=" & pagei & """>" & pagei & "</a>"
				elseif pagei = pagenum then
					strthreadhref = strthreadhref & "&nbsp;.&nbsp;.&nbsp;.&nbsp;<a href=""" & strhref & "&page=" & pagei & """>" & pagei & "</a>"
				end if
			next
			strthreadhref = strthreadhref & "&nbsp;)"
		end if
		if rs2("rating") > 0 then strthreadhref = strthreadhref & " &nbsp;(" & Replace(loadtemplate("hint_threadrating"), "{rating}", rs2("rating")) & ")"
		Set rs3 = Conn.execute("select * from sf_attachment where threadid = " & rs2("threadid"))
		if not(rs3.bof or rs3.eof) then
			StrHtml2 = Replace(StrHtml2, "{attachment_icon}", "<img src=""image/default/attachment.gif"" border=0>")
		else
			StrHtml2 = Replace(StrHtml2, "{attachment_icon}", "")
		end if
		rs3.close
		Set rs3 = nothing
		StrHtml2 = Replace(StrHtml2, "{thread_id}", rs2("threadid"))
		StrHtml2 = Replace(StrHtml2, "{thread_title}", strthreadhref)
		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, "{reply_num}", replynum)
		StrHtml2 = Replace(StrHtml2, "{last_user}", rs2("lastpost") & "<br>by <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 = ""
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
		StrHtml2 = StrHtml2 & "&nbsp;<a href=""showforum.asp?forumid=" & forumid & strurl &""">&lt;&lt;</a>"
for i=beginpage to endpage
	if i = page then
		StrHtml2 = StrHtml2 & "&nbsp;<b>[" & i & "]</b>&nbsp;"
	else
		StrHtml2 = StrHtml2 & "<a href=""showforum.asp?forumid=" & forumid & "&page=" & i & strurl & """>&nbsp;[" & i & "]&nbsp;</a>"
	end if
next
		StrHtml2 = StrHtml2 & "...&nbsp;<a href=""showforum.asp?forumid=" & forumid & "&page=" & pagecount & strurl & """> ["&pagecount&"] &gt;&gt;</a>"

StrHtml = Replace(StrHtml, "{page_text}", StrHtml2)
response.write StrHtml

' 论坛跳转
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
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 & """>&raquo;" & rs2("catetitle") & "</option>" & chr(10)
		end if
		StrHtml2 = StrHtml2 & "<option value=""showforum.asp?forumid=" & rs2("forumid") & """>&nbsp;" & 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=""image"" src=""image/default/go.gif"" border=""0"" align=""absbottom""></form>"
StrHtml = Replace(StrHtml, "{form_viewselect_bottom}", StrHtml2)
StrHtml = Replace(StrHtml, "{img_old}", "<img src=""image/threadicon/old.gif"" align=""absmiddle"">")
StrHtml = Replace(StrHtml, "{img_new}", "<img src=""image/threadicon/new.gif"" align=""absmiddle"">")
StrHtml = Replace(StrHtml, "{img_hot}", "<img src=""image/threadicon/hot.gif"" align=""absmiddle"">")
StrHtml = Replace(StrHtml, "{img_close}", "<img src=""image/threadicon/close.gif"" align=""absmiddle"">")
StrHtml = Replace(StrHtml, "{ratingthread}", ratingthread)
StrHtml = Replace(StrHtml, "{ratingreply}", ratingreply)
StrHtml = Replace(StrHtml, "{hothitnum}", hothit)
StrHtml = Replace(StrHtml, "{hotreplynum}", hotreply)
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 ip = nothing
set strip = nothing
set killip = nothing
%>

⌨️ 快捷键说明

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