<% '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' ' 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}", "") 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}", "") StrHtml3 = Replace(StrHtml3, "{olimg_supermoder}", "") StrHtml3 = Replace(StrHtml3, "{olimg_moder}", "") StrHtml3 = Replace(StrHtml3, "{olimg_superuser}", "") StrHtml3 = Replace(StrHtml3, "{olimg_user}", "") 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}", "" & rs2("lastuser") & "") 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", rs2("lastpost"),NOW) < 9 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}", "") 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}", "" & " by " & left(lastposter,11) & "
" & rs2("lastpost") ) end if else '& left(lastposttitle,10) 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 & "" & "" & rs3("username") & " " 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}", "") StrHtml = Replace(StrHtml, "{forumicon_old}", "") StrHtml = Replace(StrHtml, "{forumicon_hidden}", "") StrHtml = Replace(StrHtml, "{forumicon_readonly}", "") 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()) & "#") 'else ' StrSql = "update lastforum from sf_ set maxolnum = " & onlinenum end if rs2.close StrHtml = loadtemplate("indexuserinfo") StrHtml = Replace(StrHtml, "{newmsg_num}", newmsgnum) if newmsgnum > 0 then StrHtml = Replace(StrHtml, "{img_newmsg}", "") 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,lastforum,lastactivity 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 = "" do until rs2.eof if rs2("lastforum") <> "" and rs2("lastforum") <> 0 then StrSql = "select title from sf_forum where forumid = "& rs2("lastforum") &"" Set rs = Conn.Execute(StrSql) if not rs.bof and not rs.eof then lastforum = rs("title") else lastforum = "论坛首页" end if else lastforum = "论坛首页" end if if rs2("invisible") <> 1 then StrHtml2 = StrHtml2 & "" 'end if if (i mod 6) = 0 then StrHtml2 = StrHtml2 & "" 'end if i = i + 1 rs2.MoveNext loop StrHtml2 = StrHtml2 & "
" & rs2("username") & "
" onlinenum = rs2.RecordCount + guestonlinenum StrHtml3 = Replace(StrHtml3, "{online_usernum}", rs2.RecordCount) StrHtml3 = Replace(StrHtml3, "{online_num}", onlinenum) else StrHtml2 = " " 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 %>