?? index.asp
字號:
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<!--#INCLUDE FILE="user.asp"-->
<%
dim ip, strip, killip
dim StrSql, rs2, toptext, StrHtml, StrHtml2, StrHtml3
dim StrForum, StrCate
forumtitle = loadtemplate("indextitle")
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
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
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=""image/onlineicon/4.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_supermoder}", "<img src=""image/onlineicon/3.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_moder}", "<img src=""image/onlineicon/2.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_superuser}", "<img src=""image/onlineicon/1.gif"">")
StrHtml3 = Replace(StrHtml3, "{olimg_user}", "<img src=""image/onlineicon/0.gif"">")
StrHtml = loadtemplate("indexhint")
if request.cookies("sf")("username") = "" then
StrHtml = Replace(StrHtml, "{user_rating}", 0)
StrHtml = Replace(StrHtml, "{user_title}", GetTitle(0))
StrHtml = Replace(StrHtml, "{user_lastvisit}", now())
else
StrSql = "select posts, rating, usertitle, lastvisit from sf_user where username = '" & request.cookies("sf")("username") & "'"
Set rs = server.CreateObject("ADODB.RecordSet")
rs.Open StrSql, Conn, 1, 1
StrHtml = Replace(StrHtml, "{user_rating}", rs("rating"))
if rs("usertitle") = "" then
StrHtml = Replace(StrHtml, "{user_title}", GetTitle(rs("posts")))
else
StrHtml = Replace(StrHtml, "{user_title}", rs("usertitle"))
end if
StrHtml = Replace(StrHtml, "{user_lastvisit}", rs("lastvisit"))
end if
StrHtml = Replace(StrHtml, "{nowtime}", time())
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") & """>" & rs2("lastuser") & "</a>")
response.write StrHtml
' 論壇公告
StrHtml = loadtemplate("indexannouncement")
StrHtml = Replace(StrHtml, "{forumtitle}", boardtitle)
StrSql = "select * from sf_announcement where startdate < #" & now() & "# and enddate > #" & now() & "# order by announcementid DESC"
Set rs2 = Conn.Execute(StrSql)
if not (rs2.bof or rs2.eof) then
StrHtml2 = ""
do until rs2.eof
StrHtml2 = StrHtml2 & "<a href=""showannouncement.asp#" & rs2("announcementid") & """>" & "<b>" & rs2("title") & "</b>" & " (" & rs2("startdate") & ")" & "</a> "
rs2.MoveNext
loop
StrHtml = Replace(StrHtml, "{ann_title}", StrHtml2)
else
StrHtml = Replace(StrHtml, "{ann_title}", "")
end if
response.write StrHtml
' 短消息提示
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 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
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("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> <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}", 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") & """>" & 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")
if request.cookies("sf")("username") <> "" then
StrSql = "select userid from sf_user where username = '" & request.cookies("sf")("username") & "'"
Set rs2 = Conn.Execute(StrSql)
userid = rs2("userid")
StrSql = "select lastactivity from sf_guestonline where userid = " & userid & ""
Set rs2 = Conn.Execute(StrSql)
if (rs2.bof or rs2.eof) then
StrSql = "insert into sf_guestonline(ipaddress, lastactivity, userid) values('" & request.ServerVariables("REMOTE_ADDR") & "', '" & now() & "', "& userid &")"
Conn.Execute(StrSql)
StrSql = "delete from sf_guestonline where ipaddress = '" & request.ServerVariables("REMOTE_ADDR") & "' and userid = 0"
Conn.Execute(StrSql)
end if
else
StrSql = "select lastactivity from sf_guestonline where ipaddress = '" & request.ServerVariables("REMOTE_ADDR") & "' and userid = 0"
Set rs2 = Conn.Execute(StrSql)
if (rs2.bof or rs2.eof) then
StrSql = "insert into sf_guestonline(ipaddress, lastactivity, userid) values('" & request.ServerVariables("REMOTE_ADDR") & "', '" & now() & "', 0)"
Conn.Execute(StrSql)
end if
end if
Conn.Execute("delete from sf_guestonline where lastactivity < #" & dateadd("n", onlinetime * -1, now()) & "#")
rs2.close
guestonlinenum = 0
StrSql = "select * from sf_guestonline order by userid desc,lastactivity DESC"
Set rs = server.CreateObject("ADODB.RecordSet")
rs.Open StrSql, Conn, 1, 1
if not(rs.bof or rs.eof) then
guestonlinenum = rs.RecordCount
i = 1
onlineuser = 0
StrHtml2 = "<table width=""100%"" border=""0"" cellspacing=""8"" cellpadding=""0""><tr>"
do until rs.eof
if rs("userid") > 0 then
StrSql = "select userid, username, usergroup, invisible from sf_user where userid = "& rs("userid") &""
rs2.Open StrSql, Conn, 1, 1
if rs2("invisible") <> 1 then
StrHtml2 = StrHtml2 & "<td width=""15%"" nowrap><img src=""image/onlineicon/" & rs2("usergroup") & ".gif""><a href=""showuser.asp?userid=" & rs2("userid") & """>" & rs2("username") & "</a></td>"
end if
rs2.close
onlineuser = onlineuser + 1
end if
if (i mod 7) = 0 then StrHtml2 = StrHtml2 & "</tr><tr>"
i = i + 1
rs.MoveNext
loop
rs.close
StrHtml2 = StrHtml2 & "</tr></table>"
onlinenum = guestonlinenum
StrHtml3 = Replace(StrHtml3, "{online_usernum}", onlineuser)
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
response.write StrHtml2
response.write loadtemplate("indexonlinebottom")
' 更新最高在線數
if onlinenum > maxolnum then
StrSql = "update sf_counter set maxolnum = " & onlinenum & ", maxoltime = '" & now() & "'"
Conn.execute(StrSql)
end if
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 rs = nothing
Set rs2 = nothing
Set StrForum = nothing
Set StrCate = nothing
Set StrHtml = nothing
Set StrHtml2 = nothing
Set StrHtml3 = nothing
set ip = nothing
set strip = nothing
set killip = nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -