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

📄 showthread.asp

📁 很好的一个论坛原代码
💻 ASP
📖 第 1 页 / 共 2 页
字号:
			StrHtml = loadtemplate("error")
			StrHtml = Replace(StrHtml, "{error_text}", loadtemplate("err_votenotexist"))
			response.write StrHtml
			response.end
		end if
		vote = true
		user_array = split(rs3("users"), "||")
		j = ubound(user_array)
		for i = 0 to j
			if user_array(i)= request.cookies("sf")("username") then
				vote = false
				exit for
			end if
		next
		voteitem_array = split(rs3("options"), "||")
		StrHtml3 = "<br><br><table width=""80%"" border=""0"" cellspacing=""1"" cellpadding=""4"" align=""center""><tr><td colspan=3>" & formatdatetime(rs3("dateline"),1) & " - " & formatdatetime(dateadd("d", rs3("dateline"), rs3("timeout")), 1) & "</td></tr>"
		j = ubound(voteitem_array)
		' 投票列表
		' 如果已经投票
			votenum_array = split(rs3("votes"), "||")
			for i = 0 to j
				StrHtml3 = StrHtml3 & "<tr><td>" & voteitem_array(i) & "</td><td><b>" & votenum_array(i) & "</b></td><td width=""260"">"
				if rs3("active") >0 then
					StrHtml3 = StrHtml3 & "<img src=""image/vote/" & i & ".gif"" width=""" & int(cint(votenum_array(i)) / rs3("active") * 200) + 5 & """ height=""10"" border=""0"">&nbsp;" & FormatPercent(cint(votenum_array(i)) / rs3("active"))
				else
					StrHtml3 = StrHtml3 & "<img src=""image/vote/" & i & ".gif"" width=""5"" height=""10"" border=""0"">&nbsp; 0%"
				end if
				StrHtml3 = StrHtml3 & "</td></tr>" & chr(10)
			next
			
			StrHtml3 = StrHtml3 & "<tr><td colspan=3><br></td></tr>"
		' 未投票,显示投票列表
		if vote=true and ((dateadd("d", rs3("dateline"), rs3("timeout")) - now() > 0) or rs3("timeout") = 0)then
			StrHtml3 = StrHtml3 & "<form action=""vote.asp"" method=""post"" name=""postvote"">" & chr(10)
			if rs3("type") = 1 then
				strbox = "checkbox"
			else
				strbox = "radio"
			end if
			for i = 0 to j
				StrHtml3 = StrHtml3 & "<tr><td><input name=""voteid"" type=""" & strbox & """ value=""" & i & """>" & voteitem_array(i) & "</td></tr>" & chr(10)
			next
			StrHtml3 = StrHtml3 & "<tr><td><input name=""votebtn"" type=""submit"" value=""" & loadtemplate("hint_vote") & """></td></tr><input name=""threadid"" type=""hidden"" value=""" & threadid & """></form>"
		else
			if dateadd("d", rs3("dateline"), rs3("timeout")) - now() > 0 then StrHtml3 = StrHtml3 & "<tr><td colspan=3><br><br>" & loadtemplate("err_vote") & "</td></tr>"
		end if
		StrHtml3 = StrHtml3 & "</table>" & chr(10)
	end if
	
	pagei = 1
	rs2.PageSize = postrow
	if (page > rs2.PageCount) or (request("page") = "end") then page = rs2.PageCount
	rs2.AbsolutePage = page
	pagecount = rs2.PageCount
	do until rs2.eof or pagei > rs2.PageSize
		StrHtml2 = StrHtml
		if rs2("iconid") <> 0 then
			StrHtml2 = Replace(StrHtml2, "{post_icon}", "<img src=""image/posticon/icon" & rs2("iconid") & ".gif"">")
		else
			StrHtml2 = Replace(StrHtml2, "{post_icon}", "")
		end if
		StrHtml2 = Replace(StrHtml2, "{post_id}", rs2("postid"))
		StrHtml2 = Replace(StrHtml2, "{post_title}", rs2("title"))
		allowautourl = false
		if rs2("allowautourl") = 1 then allowautourl = true
		allowemot = false
		if rs2("allowsmilie") = 1 then allowemot = true
		if pollid <> -1 then
			posttext = formatstr(rs2("pagetext")) & StrHtml3
			' 只执行一次:)
			pollid = -1
		else
			if (rs2("allowxbcode") = 1) and allowbbcode then
				posttext = xbcodeContent(formatstr(rs2("pagetext")), allowemot, allowautourl, allowimages, allowimages)
			else
				posttext = formatstr(rs2("pagetext"))
			end if
		end if
		if rs2("notes") <> "" then posttext = posttext & "<p align=""right""><img src=""image/default/lastedit.gif"" border=0>" & rs2("notes") & "</p>"
		StrHtml3 = ""
		if rs2("attachmentid") > 0 then
			Set rs3 = Conn.execute("select top 1 filename, filesize from sf_attachment where attachmentid = " & rs2("attachmentid"))
			if not(rs3.bof or rs3.eof) then
				filename = rs3("filename")
				filesize = rs3("filesize")
				StrHtml3 = "<br><br><br><img src=""image/default/attachment.gif"" border=0>" & Strattachment
				Set rs3 = Conn.execute("select top 1 display, fileicon from sf_allowuploadfile where expfilename = '" & GetExpFilename(rs3("filename")) & "'")
				if rs3.bof or rs3.eof then
					StrHtml3 = Replace(StrHtml3, "{attachment}", "<img src=""image/fileicon/default.gif"" border=0><a href=""upload/" & filename & """ target=_blank>" & filename & "</a> (" & filesize & "bytes)")
				else
					StrHtml3 = Replace(StrHtml3, "{attachment}", "<img src=""image/fileicon/" & rs3("fileicon") & """ border=0><a href=""upload/" & filename & """ target=_blank>" & filename & "</a> (" & filesize & "bytes)")
					if rs3("display") = 1 then StrHtml3 = StrHtml3 & "<br><br><a href=""upload/" & filename & """ target=_blank><img src=""upload/" & filename & """ border=""0"" onload=""if(this.width>screen.width-333) {this.width=screen.width-333;this.title='open new window';}""></a>"
				end if
			end if
			rs3.close
			Set rs3 = nothing
		end if
		posttext = posttext & StrHtml3
		posttext = posttext & "<br>"
		usersign = ""
		if rs2("showsignature") = 1 and  rs2("signature") <> "" then
			usersign = usersign & "<br><img src=""image/default/sign.gif"" border=0><br>" & xbcodeContent(formatstr(rs2("signature")), allowemot, false, true, false) & "<br>"
			'签名中禁止使用XB图像代码
			'usersign = usersign & "<br><img src=""image/default/sign.gif"" border=0><br>" & xbcodeContent(formatstr(rs2("signature")), allowemot, false, false, false) & "<br>"
		end if
		StrHtml3 = ""
		StrHtml3 = StrHtml3 & " &nbsp; <a href=""showuser.asp?userid=" & rs2("userid") & """><img src=""image/default/profile.gif"" border=0 alt=""" & loadtemplate("showusertitle") & """></a>"
		StrHtml3 = StrHtml3 & " &nbsp; <a href=""showmessage.asp?action=sendmessage&username=" & server.htmlencode(rs2("username")) & """><img src=""image/default/message.gif"" border=0 alt=""" & loadtemplate("messagetitle") & """></a>"
		StrHtml3 = StrHtml3 & " &nbsp; <a href=""search.asp?author=" & server.htmlencode(rs2("username")) & "&step=2""><img src=""image/default/search.gif"" border=0 alt=""" & loadtemplate("searchtitle") & """></a>"
		if rs2("showemail") =1 then
			StrHtml3 = StrHtml3 & " &nbsp; <a href=""mailto:" & rs2("email") & """><img src=""image/default/email.gif"" border=0></a>"
		end if
		if rs2("homepage") <>"" and left(rs2("homepage"), 7) <> "http://" then
			StrHtml3 = StrHtml3 & " &nbsp; <a href=""http://" & rs2("homepage") & """ target=_blank><img src=""image/default/homepage.gif"" border=0></a>"
		elseif rs2("homepage") <>"" then
			StrHtml3 = StrHtml3 & " &nbsp; <a href=""" & rs2("homepage") & """ target=_blank><img src=""image/default/homepage.gif"" border=0></a>"
		end if
		if rs2("qq") <>"" then
		StrHtml3 = StrHtml3 & " &nbsp; <a href=""http://friend.qq.com/cgi-bin/friend/user_show_info?ln=" & rs2("qq") & """ target=_blank><img src=""image/default/qq.gif"" border=0></a>"
		end if
		StrHtml2 = Replace(StrHtml2, "{user_btn}", StrHtml3)
		StrHtml3 = ""						
		StrHtml3 = StrHtml3 & " &nbsp; <a href=""editpost.asp?postid=" & rs2("postid") & """><img src=""image/default/edit.gif"" border=0 alt=""" & loadtemplate("editposttitle") & """></a>"
		StrHtml3 = StrHtml3 & " &nbsp; <a href=""newreply.asp?quote=yes&postid=" & rs2("postid") & """><img src=""image/default/quote.gif"" border=0 alt=""" & loadtemplate("newquotereplytitle") & """></a>"
		StrHtml3 = StrHtml3 & " &nbsp; <a href=""delpost.asp?postid=" & rs2("postid") & """><img src=""image/default/del.gif"" border=0 alt=""" & loadtemplate("delposttitle") & """></a>"
		StrHtml2 = Replace(StrHtml2, "{post_btn}", StrHtml3)
		StrHtml2 = Replace(StrHtml2, "{post_time}", rs2("dateline"))
		StrHtml2 = Replace(StrHtml2, "{img_ip}", "<a href=""showposterip.asp?postid=" & rs2("postid") & """><img src=""image/default/posticon.gif"" align=""absmiddle"" border=0></a>")
		if postid = -1 then
			StrHtml2 = Replace(StrHtml2, "{no_num}", (page - 1) * rs2.PageSize + pagei)
		else
			StrHtml2 = Replace(StrHtml2, "{no_num}", "")
		end if
		StrHtml2 = Replace(StrHtml2, "{user_name}", rs2("username"))
		
		if rs2("avatar") = "" then
			StrHtml2 = Replace(StrHtml2, "{user_avatar}", "<img src=""" & rs2("defineavatar") & """ width=""" & rs2("avatarwidth") & """ height=""" & rs2("avatarheight") & """>")
		else
			StrHtml2 = Replace(StrHtml2, "{user_avatar}", "<img src=""image/avatar/" & rs2("avatar") & """>")
		end if
		if rs2("usertitle") = "" then
			        StrHtml2 = Replace(StrHtml2, "{user_title}", GetTitle(rs2("posts")))
		else
			        StrHtml2 = Replace(StrHtml2, "{user_title}", rs2("usertitle"))
		end if
		select case rs2("usergroup")
			case 4
				StrHtml2 = Replace(StrHtml2, "{user_titleimg}", "<img src=""image/title/10.gif"">")
			case 3
				StrHtml2 = Replace(StrHtml2, "{user_titleimg}", "<img src=""image/title/9.gif"">")
			case 2
				StrHtml2 = Replace(StrHtml2, "{user_titleimg}", "<img src=""image/title/8.gif"">")
			case 1
				StrHtml2 = Replace(StrHtml2, "{user_titleimg}", "<img src=""image/title/8.gif"">")
			case else
			        StrHtml2 = Replace(StrHtml2, "{user_titleimg}", "<img src=""image/title/" & GetTitleImg(rs2("posts")) & ".gif"">")
		end select
		if rs2("sex") = "" then
			StrHtml2 = Replace(StrHtml2, "{user_sex}", "")
		else
			StrHtml2 = Replace(StrHtml2, "{user_sex}", "<img src=""image/sexicon/" & rs2("sex") & ".gif"" border=0>")
		end if
		oldtime = dateadd("n", onlinetime * -1, now())
		if rs2("lastactivity") > oldtime then		   
			StrHtml2 = Replace(StrHtml2, "{user_online}", "Online")
		else
			StrHtml2 = Replace(StrHtml2, "{user_online}", "Offline")
		end if
		StrHtml2 = Replace(StrHtml2, "{user_posts}", rs2("posts"))
		StrHtml2 = Replace(StrHtml2, "{user_rating}", rs2("rating"))
		StrHtml2 = Replace(StrHtml2, "{user_joindate}", year(rs2("joindate")) & "-" & month(rs2("joindate")))
		StrHtml2 = Replace(StrHtml2, "{user_country}", rs2("country"))
		StrHtml2 = Replace(StrHtml2, "{user_sign}", usersign)
		StrHtml2 = Replace(StrHtml2, "{post_text}", posttext)
		response.write StrHtml2
		rs2.MoveNext
		pagei = pagei + 1
	loop
end if

StrHtml = loadtemplate("threadbottom")
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 = loadtemplate("hint_selectoperate") & ":"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""editthread.asp?threadid=" & threadid & """>" & loadtemplate("threadedit") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""delpost.asp?threadid=" & threadid & """>" & loadtemplate("delposttitle") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""copythread.asp?action=move&threadid=" & threadid & """>" & loadtemplate("threadmove") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""copythread.asp?action=copy&threadid=" & threadid & """>" & loadtemplate("threadcopy") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""thread.asp?action=close&threadid=" & threadid & """>" & loadtemplate("threadclose") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""thread.asp?action=stick&threadid=" & threadid & """>" & loadtemplate("threadstick") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""thread.asp?action=best&threadid=" & threadid & """>" & loadtemplate("threadbest") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""thread.asp?action=recount&threadid=" & threadid & """>" & loadtemplate("threadrecount") & "</a>"
StrHtml2 = StrHtml2 & "&nbsp; <a href=""newannouncement.asp"">" & loadtemplate("newannouncementtitle") & "</a>"
StrHtml2 = StrHtml2 & "</select>" & chr(10)
StrHtml = Replace(StrHtml, "{moder_select}", StrHtml2)
		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=""showthread.asp?threadid=" & threadid & 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=""showthread.asp?threadid=" & threadid & "&page=" & i & strurl & """>&nbsp;[" & i & "]&nbsp;</a>"
	end if
next
		StrHtml2 = StrHtml2 & "...&nbsp;<a href=""showthread.asp?threadid=" & threadid & "&page=" & pagecount & strurl & """> ["&pagecount&"] &gt;&gt;</a>"

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

if (postid <> -1) or request("mode") = "tree" then
	StrHtml = loadtemplate("threadtreetop")
        StrHtml = Replace(StrHtml, "{threadid}", threadid)
	StrHtml = Replace(StrHtml, "{thread_title}", threadtitle)
	response.write StrHtml
	rs2.Close
	StrHtml = loadtemplate("threadtree")
	StrSql = "select sf_post.postid, sf_post.userid, sf_post.username, sf_post.title, sf_post.layer, sf_post.iconid, sf_post.dateline from sf_post left join sf_user on (sf_post.userid = sf_user.userid) where sf_post.threadid = " & threadid & " order by sf_post.parentid, postid"
	Set rs2 = server.CreateObject("ADODB.RecordSet")
	rs2.Open StrSql, Conn, 1, 1
	if not (rs2.bof or rs2.eof) then
		' Display thread-tree
		pagecount = rs2.RecordCount
		do until rs2.eof
			StrHtml2 = StrHtml
			if rs2("layer") > 1 then
				leftspace = ""
				for i = 2 to rs2("layer")
				leftspace = leftspace & "&nbsp; &nbsp; "
				next
			end if
			StrHtml2 = Replace(StrHtml2, "{leftspace}", leftspace)
			if rs2("iconid") <> 0 then
				StrHtml2 = Replace(StrHtml2, "{post_icon}", "<img src=""image/posticon/icon" & rs2("iconid") & ".gif"">")
			else
				StrHtml2 = Replace(StrHtml2, "{post_icon}", "")
			end if
			if clng(postid) = rs2("postid") then
				StrHtml2 = Replace(StrHtml2, "{post_title}", "<b>" & rs2("title") & "</b>")
				
			else
				StrHtml2 = Replace(StrHtml2, "{post_title}", "<a href=""showthread.asp?postid=" & rs2("postid") & """>" & rs2("title") & "</a>")
			end if
			StrHtml2 = Replace(StrHtml2, "{user_name}", "<a href=""showuser.asp?userid=" & rs2("userid") & """>" & rs2("username") & "</a>")
			StrHtml2 = Replace(StrHtml2, "{post_time}", rs2("dateline"))
			response.write StrHtml2
			rs2.MoveNext
		loop
	response. write loadtemplate("threadtreebottom")
	end if
end if
StrHtml = loadtemplate("quickreply")
StrHtml2 = ""
for i = 1 to 36
	if i =19 then StrHtml2 = StrHtml2 & "<br>"
	StrHtml2 = StrHtml2 & "&nbsp;<img src=""image/emot/" & i & ".gif"" alt = ""[em"& i& "]"" style=""CURSOR: hand"" onClick=""insertstr('[em" & i &"]')"">&nbsp;"
next
StrHtml = Replace(StrHtml, "{emot_icon}", StrHtml2)
StrHtml = Replace(StrHtml, "{threadid}", threadid)
StrHtml = Replace(StrHtml, "{replytitle}", "Re:" & threadtitle)
response. write StrHtml
response.write sfcopyright
response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs = nothing
Set rs2 = nothing
set ip = nothing
set strip = nothing
set killip = nothing
%>

⌨️ 快捷键说明

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