?? thread.asp
字號:
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="inc/xbcode_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<%
dim ip, strip, killip
dim StrSql, toptext, rs, rs2, StrHtml, StrHtml2, error, err, userid, threadid, threadtitle, postid, posttitle
StrHtml = loadtemplate("htmltop")
StrHtml = Replace(StrHtml, "{pagetitle}", loadtemplate("hint_selectoperate"))
StrHtml = Replace(StrHtml, "{forumtitle}", boardtitle)
response.write StrHtml
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
' 檢測threadid是否合法
threadid = ChkSql(request("threadid"))
err = false
if not IsNumeric(threadid) then
err = true
else
StrSql = "select * from sf_thread where threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
err = true
else
threadtitle = rs2("title")
forumid = rs2("forumid")
pollid = rs2("pollid")
end if
end if
if err then error = error & "<br><li>" & loadtemplate("err_threadnotexist")
' 如果有錯誤則提示
if error <> "" then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", error)
response.write StrHtml
response.end
end if
' 如果未注冊或未登錄...
if request.cookies("sf")("username") = "" or request.cookies("sf")("password") = "" then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", loadtemplate("err_unregistered"))
response.write StrHtml
response.end
end if
' 檢測密碼...
error = ""
userinfo = 0
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 = loadtemplate("err_chkpassword")
else
if request.cookies("sf")("password") <> rs2("password") then
error = loadtemplate("err_chkpassword")
else
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 rs2.bof or rs2.eof then
error = loadtemplate("err_purview")
else
userinfo = 2
if rs2("isadmin") = 1 then userinfo = 3
end if
end if
end if
' 檢測forumid是否合法
err = false
StrSql = "select sf_forum.forumid, sf_forum.title, sf_forum.onlyuser, sf_forum.canopenclose, sf_forum.onlymember, sf_forum.memberlist, sf_forum.cateid, sf_cate.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")
canopenclose = rs2("canopenclose")
onlymember = rs2("onlymember")
memberlist = rs2("memberlist")
' 如果只允許內部成員訪問...
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
if err then error = error & "<br><li>" & loadtemplate("err_forumnotexist")
if error <> "" or userinfo < 2 then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", error)
response.write StrHtml
response.end
end if
StrHtml = loadtemplate("pagepath")
StrHtml = Replace(StrHtml, "{path_text}", "<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
step = ChkSql(request("action"))
select case step
case "stick"
' 置頂主題
StrSql = "select displayorder from sf_thread where threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
stick = 1
if rs2("displayorder") = 1 then stick = 0
StrSql = "update sf_thread set displayorder = " & stick & " where threadid = " & threadid
Conn.Execute(StrSql)
StrHtml = loadtemplate("hint")
StrHtml = Replace(StrHtml, "{hint_text}", loadtemplate("hint_threadstick"))
StrHtml = Replace(StrHtml, "{pro_name}", "showthread.asp?threadid=" & threadid)
response.write StrHtml
case "close"
' 關閉主題
if (canopenclose <> 0) or (userinfo = 3) then
StrSql = "select [open] from sf_thread where threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
open = 1
if rs2("open") = 1 then open = 0
StrSql = "update sf_thread set [open] = " & open & " where threadid = " & threadid
Conn.Execute(StrSql)
StrHtml = loadtemplate("hint")
StrHtml = Replace(StrHtml, "{hint_text}", loadtemplate("hint_threadclose"))
StrHtml = Replace(StrHtml, "{pro_name}", "showthread.asp?threadid=" & threadid)
response.write StrHtml
end if
case "best"
' 置為精華
StrSql = "select best, postuserid from sf_thread where threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
if rs2("best") = 0 then
StrSql = "update sf_thread set best = 1 where threadid = " & threadid
Conn.Execute(StrSql)
StrSql = "update sf_user set rating = rating + " & ratingbest & " where userid = " & rs2("postuserid")
Conn.Execute(StrSql)
else
StrSql = "update sf_thread set best = 0 where threadid = " & threadid
Conn.Execute(StrSql)
StrSql = "update sf_user set rating = rating - " & ratingbest & " where userid = " & rs2("postuserid")
Conn.Execute(StrSql)
end if
StrHtml = loadtemplate("hint")
StrHtml = Replace(StrHtml, "{hint_text}", loadtemplate("hint_threadbest"))
StrHtml = Replace(StrHtml, "{pro_name}", "showthread.asp?threadid=" & threadid)
response.write StrHtml
case "recount"
' 刷新數據
StrSql = "select count(postid) as postcount from sf_post where parentid > 0 and threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
if not (rs2.bof or rs2.eof) then
StrSql = "update sf_thread set replycount = " & rs2("postcount") & " where threadid = " & threadid
Conn.Execute(StrSql)
end if
StrHtml = loadtemplate("hint")
StrHtml = Replace(StrHtml, "{hint_text}", loadtemplate("hint_threadrecount"))
StrHtml = Replace(StrHtml, "{pro_name}", "showthread.asp?threadid=" & threadid)
response.write StrHtml
case else
StrHtml = loadtemplate("delpost")
StrHtml = Replace(StrHtml, "{title}", threadtitle)
if postid = -1 then
StrHtml = Replace(StrHtml, "{hidden_field}", "<input type=""hidden"" name=""threadid"" value=""" & threadid & """>")
else
StrHtml = Replace(StrHtml, "{hidden_field}", "<input type=""hidden"" name=""postid"" value=""" & postid & """>")
end if
response.write StrHtml
end select
response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs = nothing
Set rs2 = nothing
set ip = nothing
set strip = nothing
set killip = nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -