📄 showthread.asp
字号:
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="inc/xbcode_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<!--#INCLUDE FILE="user.asp"-->
<%
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Snowman Forum v2.0 for MS SQL Server
'
' Copyright(C) Snowman, All rights reserved.
'
' http://www.xinboard.net
'
' Access版本免费, 欲使用SQL Server商业版本请购买使用权
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
dim StrSql, rs2, toptext, StrHtml, StrHtml2, StrHtml3, err, pagecount
dim threadtitle, threadid, forumid, forumtitle, userid
error = ""
threadtitle = ""
threadvisible = 1
if request("postid") = "" and request("threadid") = "" then
err = true
error = error & "<br><li>" & loadtemplate("err_url")
else
if request("threadid") <> "" then
' check 'threadid'
err = false
threadid = ChkSql(request("threadid"))
if not IsNumeric(threadid) then
err = true
else
postid = -1
end if
if err then error = error & "<br><li>" & loadtemplate("err_threadnotexist")
else
' check 'postid'
err = false
postid = ChkSql(request("postid"))
if not IsNumeric(postidid) then
err = true
else
StrSql = "select * from sf_post where postid = " & postid
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
err = true
else
posttitle = rs2("title")
threadid = rs2("threadid")
end if
end if
if err then error = error & "<br><li>" & loadtemplate("err_postnotexist")
end if
end if
if not err then
StrSql = "select top 1 * from sf_thread where threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
err = true
else
forumid = rs2("forumid")
if rs2("moved") > 0 then
threadid = rs2("moved")
StrSql = "select top 1 * from sf_thread where threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
err = true
else
forumid = rs2("forumid")
end if
end if
if request("goto") <> "" then
if request("goto") = "prev" then
StrSql = "select top 1 * from sf_thread where forumid = " & forumid & " and threadid < " & threadid & " order by threadid DESC"
else
StrSql = "select top 1 * from sf_thread where forumid = " & forumid & " and threadid > " & threadid & " order by threadid ASC"
end if
Set rs2 = Conn.Execute(StrSql)
end if
if not (rs2.bof or rs2.eof) then
threadid = rs2("threadid")
forumid = rs2("forumid")
threadrating = rs2("rating")
threadtitle = rs2("title")
if threadrating > 0 then
threadtitle = threadtitle & "(" & Replace(loadtemplate("hint_threadrating"), "{rating}", threadrating) & ")"
end if
threadvisible = rs2("visible")
if threadvisible = 0 then threadtitle = threadtitle & "(" & loadtemplate("trashboxtitle") & ")"
pollid = rs2("pollid")
open = rs2("open")
threadvisible = rs2("visible")
' StrHtml3为帖子列表顶部
StrHtml3 = "<a name=""top""></a>" & loadtemplate("threadtop")
StrHtml3 = Replace(StrHtml3, "{post_num}", rs2("replycount"))
StrHtml3 = Replace(StrHtml3, "{hits_num}", rs2("views") + 1)
StrHtml3 = Replace(StrHtml3, "{thread_title}", threadtitle)
if open =1 and threadvisible = 1 then
StrHtml3 = Replace(StrHtml3, "{btn_text}", "<a href=""showthread.asp?threadid=" & threadid & "&goto=prev""><img src=""style/" & loadtemplate("path") & "/image/prev.gif"" border=0 alt=""" & loadtemplate("threadprevtitle") & """></a> <a href=""showthread.asp?threadid=" & threadid & "&goto=next""><img src=""style/" & loadtemplate("path") & "/image/next.gif"" border=0 alt=""" & loadtemplate("threadnexttitle") & """></a> <a href=""newthread.asp?forumid=" & forumid & """><img src=""style/" & loadtemplate("path") & "/image/newthread.gif"" border=""0"" alt=""" & loadtemplate("newthreadtitle") & """></a>" & " " & "<a href=""newvote.asp?forumid=" & forumid & """><img src=""style/" & loadtemplate("path") & "/image/newvote.gif"" border=0 alt=""" & loadtemplate("newvotetitle") & """></a> <a href=""newreply.asp?threadid=" & threadid & """><img src=""style/" & loadtemplate("path") & "/image/newreply.gif"" border=0 alt=""" & loadtemplate("newreplytitle") & """></a>")
else
StrHtml3 = Replace(StrHtml3, "{btn_text}", "<a href=""showthread.asp?threadid=" & threadid & "&goto=prev""><img src=""style/" & loadtemplate("path") & "/image/prev.gif"" border=0 alt=""" & loadtemplate("threadprevtitle") & """></a> <a href=""showthread.asp?threadid=" & threadid & "&goto=next""><img src=""style/" & loadtemplate("path") & "/image/next.gif"" border=0 alt=""" & loadtemplate("threadnexttitle") & """></a> <a href=""newthread.asp?forumid=" & forumid & """><img src=""style/" & loadtemplate("path") & "/image/newthread.gif"" border=""0"" alt=""" & loadtemplate("newthreadtitle") & """></a>" & " " & "<a href=""newvote.asp?forumid=" & forumid & """><img src=""style/" & loadtemplate("path") & "/image/newvote.gif"" border=0 alt=""" & loadtemplate("newvotetitle") & """></a> <img src=""style/" & loadtemplate("path") & "/image/threadclose.gif"" border=0 alt=""" & loadtemplate("err_threadclose") & """>")
end if
StrSql = "update sf_thread set views = views + 1 where threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
else
err = true
end if
end if
if err then error = error & "<br><li>" & loadtemplate("err_threadnotexist")
end if
if not err then
'''''''''''''''''''''
'check 'forumid'
'''''''''''''''
err = false
if not IsNumeric(forumid) then
err = true
else
StrSql = "select sf_forum.forumid, sf_forum.title, sf_forum.allowposting, sf_forum.allowimages, sf_forum.allowbbcode, sf_forum.onlyuser, sf_forum.onlymember, sf_forum.memberlist, sf_forum.cateid, sf_cate.catetitle from sf_forum left join sf_cate on sf_forum.cateid = sf_cate.cateid where forumid = " & forumid
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
err = true
else
forumtitle = rs2("title")
cateid = rs2("cateid")
catetitle = rs2("catetitle")
allowpost = rs2("allowposting")
if rs2("allowbbcode") = 1 then
allowbbcode = true
else
allowbbcode = false
end if
if rs2("allowimages") = 1 then
allowimages = true
else
allowimages = false
end if
onlyuser = rs2("onlyuser")
onlymember = rs2("onlymember")
memberlist = rs2("memberlist")
if request.cookies("sf")("username") = "" or request.cookies("sf")("password") = "" then
if onlyuser = 1 then error = error & "<br><li>" & loadtemplate("err_unregistered")
else
' check password...
StrSql = "select password, userid, rating from sf_user where username = '" & ChkSql(request.cookies("sf")("username")) & "'"
Set rs2 = Conn.Execute(StrSql)
err = false
if rs2.bof or rs2.eof then
err = true
else
if request.cookies("sf")("password") <> rs2("password") then
err = true
else
userrating = rs2("rating")
userid = rs2("userid")
StrSql = "update sf_user set lastforum = " & forumid & ", lastactivity = '" & now() & "' where userid = " & userid
Conn.Execute(StrSql)
StrSql = "select * from sf_moderator where userid = " & rs2("userid") & "and (forumid = " & forumid & " or super = 1 or isadmin = 1)"
Set rs2 = Conn.Execute(StrSql)
'如果是斑竹userinfo=2
if not(rs2.bof or rs2.eof) then
userinfo = 2
end if
end if
end if
if err then error = error & "<br><li>" & loadtemplate("err_chkpassword")
end if
if onlymember = 1 then
if not IsMember(forumid, memberlist) then error = error & "<br><li>" & loadtemplate("err_member")
StrSql = "select password, userid from sf_user where username = '" & ChkSql(request.cookies("sf")("username")) & "'"
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
error = error & "<br><li>" & loadtemplate("err_chkpassword")
else
if request.cookies("sf")("password") <> rs2("password") then error = error & loadtemplate("err_chkpassword")
end if
end if
end if
end if
if err then error = error & "<br><li>" & loadtemplate("err_forumnotexist")
end if
StrHtml = loadtemplate("htmltop")
StrHtml = Replace(StrHtml, "{pagetitle}", left(threadtitle, 20))
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"">")
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
if threadrating > 0 and userinfo < 2 then
if userrating < threadrating then error = error & "<br><li>" & Replace(loadtemplate("err_threadrating"), "{rating}", threadrating)
end if
' display error message
if error <> "" then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", error)
response.write StrHtml
response.end
end if
' forum jump
response.write "<script language=JavaScript>" & chr(10)
response.write "function goforum(strgoforum) {" & chr(10)
response.write "location.replace(strgoforum)" & chr(10)
response.write "}"
response.write "</script>"
''''''''''''''''''''''''
'display path
'''''''''''''
StrHtml = loadtemplate("pagepath")
StrHtml = Replace(StrHtml, "{path_text}", "<img src=""style/" & loadtemplate("path") & "/image/home.gif""><a href=index.asp>" & boardtitle & "</a> » <a href=""showcate.asp?cateid=" & cateid & """>" & catetitle & "</a> » <a href=""showforum.asp?forumid=" & forumid & """>" & forumtitle & "</a> » "& threadtitle)
response.write StrHtml
' 显示帖子列表头
response.write StrHtml3
page = request("page")
' get page
if page = "" then
page = 1
else
if not IsNumeric(page) then
page = 1
else
page = clng(page)
end if
end if
' display thread list
rs2.Close
pagecount = 1
StrHtml = loadtemplate("thread")
Strattachment = loadtemplate("hint_attachment")
StrSql = "select sf_post.*, sf_user.* from sf_post left join sf_user on (sf_post.userid = sf_user.userid) where"
if postid <> -1 then
StrSql = StrSql & " sf_post.postid = " & postid
else
StrSql = StrSql & " sf_post.threadid = " & threadid
end if
Strsql = StrSql & " order by sf_post.postid ASC"
Set rs2 = server.CreateObject("ADODB.RecordSet")
rs2.Open StrSql, Conn, 1, 1
if rs2.bof or rs2.eof then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", loadtemplate("err_url"))
response.write StrHtml
response.end
else
''''''''''''''''''''
'if poll
''''''''
if pollid <> -1 then
StrSql = "select * from sf_poll where pollid = " & pollid
Set rs3 = Conn.Execute(StrSql)
if rs3.bof or rs3.eof then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", loadtemplate("err_votenotexist"))
response.write StrHtml
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -