📄 newthread.asp
字号:
error = ""
err = false
if GetFormVal("subject") = "" then
error = error & "<br><li>" & loadtemplate("err_postsubject")
else
if strLength(GetFormVal("subject")) > 100 then error = error & "<br><li>" & loadtemplate("err_postsubject")
end if
StrHtml = loadtemplate("err_posttext")
StrHtml = Replace(StrHtml, "{textmaxlength}", postmaxlength)
if GetFormVal("text") = "" then
error = error & "<br><li>" & StrHtml
else
if strLength(GetFormVal("text")) > postmaxlength then error = error & "<br><li>" & StrHtml
end if
path = Server.MapPath("upload\")
if allowuploadfile = 1 then
filename = SaveFile("attachment",path,uploadfilesizemax)
if filename = "" then error = error & "<br><li>" & loadtemplate("err_uploadfile")
end if
if error <> "" then
StrHtml = loadtemplate("error")
StrHtml = Replace(StrHtml, "{error_text}", error)
response.write StrHtml
response.end
end if
' 保存
rating = ChkSql(GetFormVal("rating"))
if not IsNumeric(rating) then
rating = 0
else
rating = cint(rating)
end if
icon = ChkSql(GetFormVal("icon"))
if not IsNumeric(icon) then
icon = 0
else
icon = cint(icon)
if icon < 0 or icon > 14 then icon = 0
end if
nowtime = now()
StrSql = "insert into sf_thread(title, lastpost, forumid, pollid, [open], replycount, postusername, postuserid, lastposter, lastposterid, dateline, views, iconid, best, displayorder, rating) values("
StrSql = StrSql & "'" & server.htmlencode(ChkSql(killbadword(GetFormVal("subject")))) & "', "
StrSql = StrSql & "'" & nowtime & "', "
StrSql = StrSql & forumid & ", -1, 1, 0, '" & ChkSql(request.cookies("sf")("username")) & "', " & userid & ", "
StrSql = StrSql & "'" & ChkSql(request.cookies("sf")("username")) & "', " & userid & ", '" & nowtime & "', 0, " & icon & ", 0, 0, " & rating & ")"
' lock database
Application.Lock
Conn.Execute(StrSql)
StrSql = "select top 1 threadid from sf_thread order by threadid DESC"
Set rs2 = Conn.Execute(StrSql)
threadid = rs2("threadid")
attachmentid = 0
if allowuploadfile = 1 and filesize > 0 then
StrSql = "insert into sf_attachment (userid, forumid, threadid, filename, filesize) values("
StrSql = StrSql & userid & ", " & forumid & ", " & threadid & ", '" & filename & "', " & filesize & ")"
Conn.Execute(StrSql)
StrSql = "select top 1 attachmentid from sf_attachment where threadid = " & threadid & " order by attachmentid DESC"
Set rs2 = Conn.Execute(StrSql)
attachmentid = rs2("attachmentid")
end if
sign = 0
emot = 0
xbcode = 0
autourl = 0
if GetFormVal("sign") = "1" then sign = 1
if GetFormVal("usexbcode") = "1" then xbcode = 1
if GetFormVal("useemot") = "1" then emot = 1
if GetFormVal("url") = "1" then autourl = 1
StrSql = "insert into sf_post(threadid, forumid, parentid, username, userid, title, dateline, pagetext, attachmentid, allowsmilie, allowautourl, allowxbcode, showsignature, ipaddress, iconid, layer, notes) values("
StrSql = StrSql & threadid & ", " & forumid & ", -1, '" & ChkSql(request.cookies("sf")("username")) & "', " & userid & ", '" & ChkSql(server.htmlencode(killbadword(GetFormVal("subject")))) & "', '" & nowtime & "', '" & ChkSql(server.htmlencode(killbadword(GetFormVal("text")))) & "', " & attachmentid & ", " & emot & ", " & autourl & ", " & xbcode & ", " & sign & ", '" & cstr(request.ServerVariables("REMOTE_ADDR")) & "', " & icon & ", 1, '')"
Conn.Execute(StrSql)
StrSql = "update sf_forum set threadcount = threadcount + 1, postcount = postcount + 1, lastpost = '" & nowtime & "', lastposter = '" & ChkSql(request.cookies("sf")("username")) & "', lastposterid = " & userid & ", lastposttitle = '" & ChkSql(GetFormVal("subject")) & "', lastpostid = " & threadid & " where forumid = " & forumid
Conn.Execute(StrSql)
StrSql = "update sf_user set posts = posts + 1, rating = rating + " & ratingthread & ", lastposttime = '" & nowtime & "', lastpostid = " & threadid & ", lastposttitle = '" & ChkSql(server.htmlencode(killbadword(GetFormVal("subject")))) & "' where userid = " & userid
Conn.Execute(StrSql)
StrSql = "update sf_counter set threadnum = threadnum + 1"
Conn.Execute(StrSql)
StrSql = "update sf_counter set postnum = postnum + 1"
Conn.Execute(StrSql)
' unlock database
Application.UnLock
Session("LastPostTime") = now()
StrHtml = loadtemplate("hint")
StrHtml = Replace(StrHtml, "{hint_text}", loadtemplate("hint_newthread"))
StrHtml = Replace(StrHtml, "{pro_name}", "showthread.asp?threadid=" & threadid)
response.write StrHtml
case else
StrHtml = loadtemplate("newthread")
StrHtml2 = ""
for i = 1 to 14
if i = 8 then StrHtml2 = StrHtml2 + "<br>"
StrHtml2 = StrHtml2 & "<input type=""radio"" value=""" & i & """ name=""icon"">" & "<img src=""image/posticon/icon" & i & ".gif""> " & chr(10)
next
StrHtml = Replace(StrHtml, "{post_icon}", StrHtml2)
StrHtml2 = ""
StrHtml2 = StrHtml2 & "<img onClick=btn_b() src=""image/postbtn/b.gif"" alt=""Bold"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_u() src=""image/postbtn/u.gif"" alt=""Underline"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_i() src=""image/postbtn/i.gif"" alt=""Italic"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_url() src=""image/postbtn/url.gif"" alt=""Url"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_code() src=""image/postbtn/code.gif"" alt=""Code"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_img() src=""image/postbtn/img.gif"" alt=""Image"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_swf() src=""image/postbtn/swf.gif"" alt=""Flash"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_mp() src=""image/postbtn/mp.gif"" alt=""WindowsMediaPlayer"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_rm() src=""image/postbtn/rm.gif"" alt=""RealPlayer"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<img onClick=btn_q() src=""image/postbtn/quote.gif"" alt=""Quote"" align=""absbottom"">" & chr(10)
StrHtml2 = StrHtml2 & "<select onchange=""if(this.options[this.selectedIndex].value!=''){showcolor(this.options[this.selectedIndex].value);this.options[0].selected=true;}else {this.selectedIndex=0;}"" name=color>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#000000;color:#000000"" value=""#000000"">#000000</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#FF0000;color:#FF0000"" value=""#FF0000"">#FF0000</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#0000FF;color:#0000FF"" value=""#0000FF"">#0000FF</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#336699;color:#336699"" value=""#336699"">#336699</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#339900;color:#339900"" value=""#339900"">#339900</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#CC6600;color:#CC6600"" value=""#CC6600"">#339900</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#663399;color:#663399"" value=""#663399"">#663399</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#3399CC;color:#3399CC"" value=""#3399CC"">#3399CC</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#66CC00;color:#66CC00"" value=""#66CC00"">#66CC00</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#FF6699;color:#FF6699"" value=""#FF6699"">#FF6699</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#CC66CC;color:#CC66CC"" value=""#CC66CC"">#CC66CC</option>" & chr(10)
StrHtml2 = StrHtml2 & "<option style=""background-color:#FF9900;color:#FF9900"" value=""#FF9900"">#FF9900</option>" & chr(10)
StrHtml2 = StrHtml2 & "</select>" & chr(10)
StrHtml2 = StrHtml2 & "<select onchange=""if(this.options[this.selectedIndex].value!=''){showsize(this.options[this.selectedIndex].value);this.options[0].selected=true;}else {this.selectedIndex=0;}"" name=size>" & chr(10)
StrHtml2 = StrHtml2 & "<option value=1> 1 </option>" & chr(10)
StrHtml2 = StrHtml2 & "<option value=2 selected> 2 </option>" & chr(10)
StrHtml2 = StrHtml2 & "<option value=3> 3 </option>" & chr(10)
StrHtml2 = StrHtml2 & "<option value=4> 4 </option>" & chr(10)
StrHtml2 = StrHtml2 & "<option value=5> 5 </option>" & chr(10)
StrHtml2 = StrHtml2 & "<option value=6> 6 </option>" & chr(10)
StrHtml2 = StrHtml2 & "</select>" & chr(10)
StrHtml = Replace(StrHtml, "{post_btn}", StrHtml2)
StrHtml2 = ""
for i = 1 to 36
if i =19 then StrHtml2 = StrHtml2 & "<br>"
StrHtml2 = StrHtml2 & " <img src=""image/emot/" & i & ".gif"" alt = ""[em"& i& "]"" style=""CURSOR: hand"" onClick=""insertstr('[em" & i &"]')""> "
next
StrHtml = Replace(StrHtml, "{emot_icon}", StrHtml2)
StrHtml = Replace(StrHtml, "{forumid}", forumid)
StrHtml = Replace(StrHtml, "{uploadmax}", uploadfilesizemax)
StrHtml2 = ""
StrSql = "select * from sf_allowuploadfile"
Set rs2 = Conn.execute(StrSql)
if not (rs2.bof or rs2.eof) then
do until rs2.eof
StrHtml2 = StrHtml2 & "*." & rs2("expfilename") & " "
rs2.MoveNext
loop
end if
StrHtml = Replace(StrHtml, "{expname}", StrHtml2)
response.write StrHtml
response.write sfcopyright
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 + -