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

📄 showcate.asp

📁 很好的一个论坛原代码
💻 ASP
字号:
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<%
dim ip, strip, killip
dim StrSql, rs, rs2, toptext, StrHtml, StrHtml2, StrHtml3, t1
dim StrForum, StrCate

if request("cateid") <> "" then
	cateid = ChkSql(request("cateid"))
	err = false
	if not IsNumeric(cateid) then
		err = true
	else
		StrSql = "select * from sf_cate where cateid = " & cateid
		Set rs2 = Conn.Execute(StrSql)
		if rs2.bof or rs2.eof then
			err = true
		else
			forumtitle = rs2("catetitle")
		end if
	end if
else
	err = true
end if

StrHtml = loadtemplate("htmltop")
StrHtml = Replace(StrHtml, "{pagetitle}", forumtitle)
StrHtml = Replace(StrHtml, "{forumtitle}", boardtitle)
response.write StrHtml
' 短消息提示
response.write newmsg
StrHtml = loadtemplate("pagetitle")
if request.cookies("sf")("username") = "" then
	toptext = loadtemplate("toptextguest")
else
	toptext = loadtemplate("toptextuser")
end if
toptext = toptext & loadtemplate("toptext")
StrHtml = Replace(StrHtml, "{top_text}", toptext)
StrHtml = Replace(StrHtml, "{username}", request.cookies("sf")("username"))
response.write StrHtml

' 论坛关闭
StrSql = "select * from sf_setup"
Set rs2 = Conn.Execute(StrSql)
if rs2("forumclose") = 1 then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", rs2("forumclosehint"))
response.write StrHtml
response.end
end if	

' 禁止IP访问
if rs2("killip") = 1 then
	userip = cstr(request.ServerVariables("REMOTE_ADDR"))
	killiplist = rs2("killiplist")
	if killiplist <> "" and userip <> "" then
		killip = split(killiplist, "|")
		struserip = split(userip, ".")
		i = 0
		do until i > ubound(killip)
			strkillip = split(killip(i), ".")
			bolkill = true
			if (struserip(0) <> strkillip(0)) and (strkillip(0) <> "*") then bolkill = false
			if (struserip(1) <> strkillip(1)) and (strkillip(1) <> "*") then bolkill = false
			if (struserip(2) <> strkillip(2)) and (strkillip(2) <> "*") then bolkill = false
			if (struserip(3) <> strkillip(3)) and (strkillip(3) <> "*") then bolkill = false
			if bolkill then
				StrHtml = loadtemplate("error")
				StrHtml = Replace(StrHtml, "{error_text}", rs2("killiphint"))
				response.write StrHtml
				Response.End
			end if
			i = i + 1
		loop
	end if
end if

' 显示当前页面路径
StrHtml = loadtemplate("pagepath")
StrHtml = Replace(StrHtml, "{path_text}", "<a href=""index.asp"">" & boardtitle & "</a> &raquo; " & forumtitle)
response.write StrHtml

if err then
	StrHtml = loadtemplate("error")
	StrHtml = Replace(StrHtml, "{error_text}", loadtemplate("err_url"))
	response.write StrHtml
	response.end
end if

' 短消息提示
if newmsgnum > 0 then
StrHtml = loadtemplate("newmsg")
StrHtml2 = StrHtml
StrHtml2 = Replace(StrHtml2, "{newmsg_num}", newmsgnum)
i = cint(request.cookies("sf")("userid"))
Set rs = Conn.Execute("select top 1 sf_privatemessage.*, sf_user.username from (sf_privatemessage left join sf_user on sf_privatemessage.fromuserid = sf_user.userid) where sf_privatemessage.folderid = 0 and sf_privatemessage.messageread = 0 and sf_privatemessage.userid = " & i)
if not (rs.bof or rs.eof) then
		StrHtml2 = Replace(StrHtml2, "{subject}", "<a href=""showmessage.asp?action=showinbox&msgid=" & rs("privatemessageid") & """ title=""" & rs("message") & """>" & rs("title") & "</a>")
		StrHtml2 = Replace(StrHtml2, "{username}", "<a href=""showuser.asp?userid=" & rs("fromuserid") & """>" & rs("username") & "</a>")
		StrHtml2 = Replace(StrHtml2, "{time}", rs("dateline"))
end if
rs.close
response.write StrHtml2
end if

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.postcount, 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 and sf_forum.cateid = " & cateid & " 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, "{cate_id}", rs2("cateid"))
			StrHtml2 = Replace(StrHtml2, "{forum_id}", rs2("cateid"))
			StrHtml2 = Replace(StrHtml2, "{forum_name}", rs2("catetitle"))
			response.write StrHtml2
			nowcateid = rs2("cateid")
		end if
		StrHtml2 = StrForum
		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("d", now(), rs2("lastpost")) = 0 then
			forumicon = "new"
		else
			forumicon = "old"
		end if
		'if rs2("onlymember") = 1 or rs2("allowposting") = 0 then forumicon = "lock"
		StrHtml2 = Replace(StrHtml2, "{forum_icon}", "<img src=""image/forumicon/" & forumicon & ".gif"">")
		StrHtml2 = Replace(StrHtml2, "{forum_description}", description)
		StrHtml2 = Replace(StrHtml2, "{forum_thread_num}", rs2("threadcount"))
		StrHtml2 = Replace(StrHtml2, "{forum_post_num}", rs2("postcount"))
		if rs2("onlymember") <> 1 then
			if lastposter = "" then
				StrHtml2 = Replace(StrHtml2, "{forum_lastpost}", "")
			else
				StrHtml2 = Replace(StrHtml2, "{forum_lastpost}", "<table cellpadding=""0"" cellspacing=""0"" border=""0"" width=""100%""><tr><td align=""right"" class=""smalltxt"" title=""" & lastposttitle & """ nowrap>"& rs2("lastpost") &"<br>by <a href=""showuser.asp?userid=" & rs2("lastposterid") & """>" & lastposter & "</a></td><td nowrap>&nbsp;<a href=""showthread.asp?page=end&threadid=" & rs2("lastpostid") & """><img src=""image/default/lastpost.gif"" border=""0""></a></td></tr></table>")
			end if
		else
			StrHtml2 = Replace(StrHtml2, "{forum_lastpost}", "")
		end if
		StrHtml2 = Replace(StrHtml2, "{forum_post_num}", rs2("postcount"))
		StrHtml2 = Replace(StrHtml2, "{forum_name}", "<a href=""showforum.asp?forumid=" & rs2("forumid") & """>" & rs2("title") & "</a>")
		' 取得版主信息
		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") & """>" & 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
response.write loadtemplate("indexforumbottom")
StrHtml = loadtemplate("indexforumtype")
StrHtml = Replace(StrHtml, "{forumicon_old}", "<img src=""image/forumicon/old.gif"">")
StrHtml = Replace(StrHtml, "{forumicon_new}", "<img src=""image/forumicon/new.gif"">")
StrHtml = Replace(StrHtml, "{forumicon_lock}", "<img src=""image/forumicon/lock.gif"">")
response.write StrHtml
response.write sfcopyright
response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs2 = nothing
Set StrForum = nothing
Set StrCate = nothing
Set StrHtml = nothing
Set StrHtml2 = nothing
Set StrHtml3 = nothing
Set t1 = nothing
set ip = nothing
set strip = nothing
set killip = nothing
%>

⌨️ 快捷键说明

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