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

📄 index.asp

📁 苹果风格的论坛 asp编写
💻 ASP
字号:
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'	Snowman Forum v2.0
'
'	Copyright(C) Snowman, All rights reserved.
'
'	http://www.xinboard.net
'
'	Access版本免费, 欲使用SQL Server商业版本请购买使用权
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

dim StrSql, rs, rs2, toptext, StrHtml, StrHtml2, StrHtml3
dim StrForum, StrCate

forumtitle = loadtemplate("indextitle")

StrHtml = loadtemplate("htmltop")
StrHtml = Replace(StrHtml, "{pagetitle}", forumtitle)
StrHtml = Replace(StrHtml, "{style_path}", loadtemplate("path"))
StrHtml = Replace(StrHtml, "{forumtitle}", boardtitle)
response.write StrHtml

' Display pm window
response.write pmpopwin
StrHtml = loadtemplate("pagetitle")
StrHtml = Replace(StrHtml, "{title_img}", "<img src=""style/" & loadtemplate("path") & "/image/title.gif"">")

StrSql = "select usernum, threadnum, postnum, lastuser, lastuserid, maxolnum, maxoltime from sf_counter"
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
	response.write "sf cannot be initialized. (010)"
	response.end
end if


if request.cookies("sf")("username") = "" then
	toptext = loadtemplate("toptextguest")
	indexhint = loadtemplate("indexhintguest")
else
	toptext = loadtemplate("toptextuser")
	indexhint = loadtemplate("indexhintuser")
end if
toptext = toptext & loadtemplate("toptext")
StrHtml = Replace(StrHtml, "{top_text}", toptext)
StrHtml = Replace(StrHtml, "{username}", request.cookies("sf")("username"))
response.write StrHtml

StrHtml3 = loadtemplate("indexonlinetop")
maxolnum = rs2("maxolnum")
StrHtml3 = Replace(StrHtml3, "{onlinemax_num}", maxolnum)
StrHtml3 = Replace(StrHtml3, "{onlinemax_time}", rs2("maxoltime"))
StrHtml3 = Replace(StrHtml3, "{olimg_admin}", "<img src=""style/" & loadtemplate("path") & "/onlineicon/4.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_supermoder}", "<img src=""style/" & loadtemplate("path") & "/onlineicon/3.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_moder}", "<img src=""style/" & loadtemplate("path") & "/onlineicon/2.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_superuser}", "<img src=""style/" & loadtemplate("path") & "/onlineicon/1.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_user}", "<img src=""style/" & loadtemplate("path") & "/onlineicon/0.gif"">")
StrHtml = loadtemplate("indexhint")
StrHtml = Replace(StrHtml, "{welcome_hint}", welcomehint)
StrHtml = Replace(StrHtml, "{index_hint}", indexhint)
StrHtml = Replace(StrHtml, "{thread_num}", rs2("threadnum"))
StrHtml = Replace(StrHtml, "{post_num}", rs2("postnum"))
StrHtml = Replace(StrHtml, "{user_num}", rs2("usernum"))
StrHtml = Replace(StrHtml, "{last_user}", "<a href=""showuser.asp?userid=" & rs2("lastuserid") & """ target=_blank>" & rs2("lastuser") & "</a>")
response.write StrHtml

response.write loadtemplate("indexforumtop")
StrCate = loadtemplate("indexcate")
StrForum = loadtemplate("indexforum")

Set rs3 = server.CreateObject("ADODB.RecordSet")
StrSql = "select forumid, userid, username from sf_moderator"
rs3.Open StrSql, Conn, 1, 1

if not (rs3.bof or rs3.eof) then
	modercount = rs3.RecordCount
else
	modercount = 0
end if
rs2.close
StrSql = "select sf_forum.forumid, sf_forum.cateid, sf_forum.title, sf_forum.description, sf_forum.onlymember, sf_forum.allowposting, sf_forum.replycount, sf_forum.lastpost, sf_forum.lastposter, sf_forum.lastposterid, sf_forum.lastpostid, sf_forum.lastposttitle, sf_forum.threadcount, 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"
'on Error resume next
rs2.Open StrSql, Conn, 1, 1
if not(rs2.bof or rs2.eof) then
	do until rs2.eof
		if nowcateid <> rs2("cateid") then
			StrHtml2 = StrCate
			StrHtml2 = Replace(StrHtml2, "{forum_id}", rs2("cateid"))
			StrHtml2 = Replace(StrHtml2, "{forum_name}", rs2("catetitle"))
			response.write StrHtml2
			nowcateid = rs2("cateid")
		end if
		StrHtml2 = StrForum
		StrHtml2 = Replace(StrHtml2, "{forum_id}", rs2("forumid"))
		description = ""
		if not isnull(rs2("description")) then description = rs2("description")
		lastposter = ""
		if not isnull(rs2("lastposter")) then lastposter = rs2("lastposter")
		lastposttitle = ""
		if not isnull(rs2("lastposttitle")) then lastposttitle = server.htmlencode(rs2("lastposttitle"))
		if datediff("h", now(), rs2("lastpost")) = 0 then
			forumicon = "new"
		else
			forumicon = "old"
		end if
		if rs2("onlymember") = 1 then forumicon = "hidden"
		if rs2("allowposting") = 0 then forumicon = "readonly"
		StrHtml2 = Replace(StrHtml2, "{forum_icon}", "<img src=""style/" & loadtemplate("path") & "/forumicon/" & forumicon & ".gif"">")
		StrHtml2 = Replace(StrHtml2, "{forum_description}", description)
		StrHtml2 = Replace(StrHtml2, "{forum_thread_num}", rs2("threadcount"))
		StrHtml2 = Replace(StrHtml2, "{forum_post_num}", rs2("replycount"))
		if rs2("onlymember") <> 1 then
			if lastposter = "" then
				StrHtml2 = Replace(StrHtml2, "{forum_lastpost}", "")
			else
				StrHtml2 = Replace(StrHtml2, "{forum_lastpost}", "<a href=""showthread.asp?page=end&threadid=" & rs2("lastpostid") & """ title=""" & lastposttitle & chr(10) & rs2("lastpost") & """><img src=""style/" & loadtemplate("path") & "/image/lasticon.gif"" border=""0"">" & left(lastposttitle, 10) & "</a><br> - <a href=""showuser.asp?userid=" & rs2("lastposterid") & """ target=_blank>" & lastposter & "</a>")
			end if
		else
			StrHtml2 = Replace(StrHtml2, "{forum_lastpost}", "")
		end if
		StrHtml2 = Replace(StrHtml2, "{forum_post_num}", rs2("replycount"))
		StrHtml2 = Replace(StrHtml2, "{forum_name}", rs2("title"))
		' 取得版主信息
		StrHtml = ""
		if modercount > 0 then
			rs3.MoveFirst
			for j = 1 to modercount
				if rs3("forumid") = rs2("forumid") then StrHtml = StrHtml & "<a href=""showuser.asp?userid=" & rs3("userid") & """ target=_blank>" & rs3("username") & "</a> "
				rs3.MoveNext
			next
		end if
		StrHtml2 = Replace(StrHtml2, "{forum_moder}", StrHtml)
		response.write StrHtml2
		forumid = rs2("forumid")
		rs2.MoveNext
	loop
end if

StrHtml = loadtemplate("indexforumbottom") 
StrHtml = Replace(StrHtml, "{forumicon_new}", "<img src=""style/" & loadtemplate("path") & "/forumicon/new.gif"">")
StrHtml = Replace(StrHtml, "{forumicon_old}", "<img src=""style/" & loadtemplate("path") & "/forumicon/old.gif"">")
StrHtml = Replace(StrHtml, "{forumicon_hidden}", "<img src=""style/" & loadtemplate("path") & "/forumicon/hidden.gif"">")
StrHtml = Replace(StrHtml, "{forumicon_readonly}", "<img src=""style/" & loadtemplate("path") & "/forumicon/readonly.gif"">")
response.write StrHtml

if request.cookies("sf")("username") = "" then
	StrSql = "select lastactivity from sf_guestonline where ipaddress = '" & request.ServerVariables("REMOTE_ADDR") & "'"
	Set rs2 = Conn.Execute(StrSql)
	if (rs2.bof or rs2.eof) then
		StrSql = "insert into sf_guestonline(ipaddress, lastactivity) values('" & request.ServerVariables("REMOTE_ADDR") & "', '" & now() & "')"
		Conn.Execute(StrSql)
	end if
	Conn.Execute("delete from sf_guestonline where lastactivity < #" & dateadd("n", onlinetime * -1, now()) & "#")
end if
rs2.close
StrHtml = loadtemplate("indexuserinfo")
StrHtml = Replace(StrHtml, "{newmsg_num}", newmsgnum)
if newmsgnum > 0 then
	StrHtml = Replace(StrHtml, "{img_newmsg}", "<a href=""showmessage.asp?action=showinbox"" target=_blank><img src=""style/" & loadtemplate("path") & "/image/msghint.gif"" border=0></a>")
else
	StrHtml = Replace(StrHtml, "{img_newmsg}", "")
end if
response.write StrHtml
guestonlinenum = 0
StrSql = "select * from sf_guestonline"
rs2.Open StrSql, Conn, 1, 1
if not(rs2.bof or rs2.eof) then
	guestonlinenum = rs2.RecordCount
end if
rs2.close
StrSql = "select userid, username, usergroup, invisible from sf_user where lastactivity > #" & dateadd("n", onlinetime * -1, now()) & "# order by lastactivity DESC"
rs2.Open StrSql, Conn, 1, 1
if not (rs2.bof or rs2.eof) then
	i = 1
	StrHtml2 = "<table width=""100%"" border=""0"" cellspacing=""8"" cellpadding=""0""><tr>"
	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>"
	onlinenum = rs2.RecordCount + guestonlinenum
	StrHtml3 = Replace(StrHtml3, "{online_usernum}", rs2.RecordCount)
	StrHtml3 = Replace(StrHtml3, "{online_num}", onlinenum)
else
	StrHtml2 = "&nbsp;"
	onlinenum = guestonlinenum
	StrHtml3 = Replace(StrHtml3, "{online_usernum}", "0")
	StrHtml3 = Replace(StrHtml3, "{online_num}", guestonlinenum)
end if
response.write StrHtml3
if (onlinenum - guestonlinenum) < 100 or request("showonline") = "yes" then response.write StrHtml2
'response.write StrHtml
response.write loadtemplate("indexonlinebottom")
' update max-online counter
if onlinenum > maxolnum then
	StrSql = "update sf_counter set maxolnum = " & onlinenum & ", maxoltime = '" & now() & "'"
	Conn.execute(StrSql)
end if

response.write sfcopyright
response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs = nothing
Set rs2 = nothing
Set StrForum = nothing
Set StrCate = nothing
Set StrHtml = nothing
Set StrHtml2 = nothing
Set StrHtml3 = nothing
%>

⌨️ 快捷键说明

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