📄 rate.asp
字号:
<!--#INCLUDE FILE="inc/db_inc.asp"-->
<!--#INCLUDE FILE="inc/char_inc.asp"-->
<!--#INCLUDE FILE="header.asp"-->
<%
dim StrSql, rs, rs2, toptext, StrHtml, err
dim threadtitle, threadid, forumid, forumtitle
error = ""
threadtitle = ""
postrating = ChkSql(request("rating"))
if IsNumeric(postrating) then
postrating = clng(postrating)
if (postrating > 5) or (postrating < -5) then postrating = 0
else
postrating = 0
end if
' 检测postid是否合法
postid = ChkSql(request("postid"))
err = false
if not IsNumeric(postid) 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")
forumid = rs2("forumid")
threadid = rs2("threadid")
userid = rs2("userid")
rating = rs2("rating")
end if
end if
if err then error = error & "<br><li>" & loadtemplate("err_postnotexist")
if not err then
' 检测threadid是否合法
StrSql = "select * from sf_thread where visible = 1 and threadid = " & threadid
Set rs2 = Conn.Execute(StrSql)
if rs2.bof or rs2.eof then
err = true
else
'
end if
if err then error = error & "<br><li>" & loadtemplate("err_threadnotexist")
end if
StrHtml = loadtemplate("htmltop")
' 在窗口标题中显示主题名称
StrHtml = Replace(StrHtml, "{pagetitle}", left(posttitle, 20))
StrHtml = Replace(StrHtml, "{style_path}", loadtemplate("path"))
StrHtml = Replace(StrHtml, "{forumtitle}", boardtitle)
response.write StrHtml
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 error <> "" then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", error)
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
' 如果是帖子原作者userinfo=1
if userid = rs2("userid") then
userinfo = 1
end if
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
' 禁止版主为自己打分
if rs2("isadmin") = 1 then
userinfo = 3
else
if userinfo <> 1 then userinfo = 2
end if
end if
end if
if userinfo = 1 then error = error & loadtemplate("err_rateself")
if rating <> 0 then error = error & loadtemplate("err_raterepeat")
StrSql = "select rating from sf_user where userid = " & userid
set rs2 = Conn.execute(StrSql)
if rs2.bof or rs2.eof then
error = error & loadtemplate("err_usernotexist")
end if
' 如果有错误则提示
if error <> "" then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", error)
response.write StrHtml
response.end
end if
StrSql = "update sf_post set rating = " & postrating & " where postid = " & postid
Conn.Execute(StrSql)
userrating = userrating + postrating
StrSql = "update sf_user set rating = rating + " & postrating & " where userid = " & userid
Conn.Execute(StrSql)
StrHtml = loadtemplate("hint_rated")
StrHtml = Replace(StrHtml, "{rating}", postrating)
response.write StrHtml
response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs2 = nothing
Set StrHtml = nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -