⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 newreply.asp

📁 一个叫做雪人的论坛源码
💻 ASP
📖 第 1 页 / 共 2 页
字号:
		end if
		if error <> "" then
			StrHtml = loadtemplate("error")
			StrHtml = Replace(StrHtml, "{error_text}", error)
			response.write StrHtml
			response.end
		end if
		' save
		icon = ChkSql(GetFormVal("icon"))
		if not IsNumeric(icon) then
			icon = 0
		else
			icon = cint(icon)
			if icon < 0 or icon > 15 then icon = 0
		end if
		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

		nowtime = now()
		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, visible, notes, editdate, rating) values("
		StrSql = StrSql & threadid & ", " & forumid & ", " & postid & ", '" & 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 & ", " & layer+1 &", 1, '', '" & nowtime & "', 0)"
		' lock database
		Application.Lock
		Conn.Execute(StrSql)
		if postid = -1 then
			StrSql = "select top 1 postid from sf_post order by postid DESC"
			Set rs2 = Conn.Execute(StrSql)
			StrSql = "update sf_post set parentid = " & rs2("postid") & " where postid = " & rs2("postid")
			Conn.Execute(StrSql)
		end if
		StrSql = "update sf_forum set replycount = replycount + 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_thread set replycount = replycount + 1, lastpost = '" & nowtime & "', lastposter = '" & ChkSql(request.cookies("sf")("username")) & "', lastposterid = " & userid & " where threadid = " & threadid
		Conn.Execute(StrSql)
		StrSql = "update sf_user set posts = posts + 1, rating = rating + " & ratingreply & ", lastposttime = '" & nowtime & "', lastpostid = " & threadid & ", lastposttitle = '" & ChkSql(server.htmlencode(GetFormVal("subject"))) & "' where userid = " & userid
		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_newreply"))
		StrHtml = Replace(StrHtml, "{pro_name}", "showthread.asp?page=end&threadid=" & threadid)
		response.write StrHtml
	case else

		StrHtml = loadtemplate("newreply")
		StrHtml2 = "<input type=""radio"" value=""0"" name=""icon"" checked>No&nbsp;" & chr(10)
		for i = 1 to 15
			if i = 8 then StrHtml2 = StrHtml2 + "<br>"
			StrHtml2 = StrHtml2 & "<input type=""radio"" value=""" & i & """ name=""icon"">" &  "<img src=""image/posticon/icon" & i & ".gif"">&nbsp;" & 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_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:#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>&nbsp; 1 &nbsp;</option>" & chr(10)
		StrHtml2 = StrHtml2 & "<option value=2 selected>&nbsp; 2 &nbsp;</option>" & chr(10)
		StrHtml2 = StrHtml2 & "<option value=3>&nbsp; 3 &nbsp;</option>" & chr(10)
		StrHtml2 = StrHtml2 & "<option value=4>&nbsp; 4 &nbsp;</option>" & chr(10)
		StrHtml2 = StrHtml2 & "<option value=5>&nbsp; 5 &nbsp;</option>" & chr(10)
		StrHtml2 = StrHtml2 & "<option value=6>&nbsp; 6 &nbsp;</option>" & chr(10)
		StrHtml2 = StrHtml2 & "</select>" & chr(10)
		StrHtml = Replace(StrHtml, "{post_btn}", StrHtml2)
		StrHtml2 = ""
		for i = 1 to 24
			if i =15 then StrHtml2 = StrHtml2 & "<br>"
			StrHtml2 = StrHtml2 & "<img src=""image/emot/em" & i & ".gif"" alt = ""[em"& i& "]"" style=""CURSOR: hand"" onClick=""insertstr(' [em" & i &"]')"">&nbsp; &nbsp;"
		next
		StrHtml = Replace(StrHtml, "{emot_icon}", StrHtml2)
		StrHtml = Replace(StrHtml, "{subject}", "Re: " & CutStr(posttitle, 90))
		StrHtml2 = ""
		if postid <> -1 and (request("quote") = "yes") then
			StrSql = "select * from sf_post where postid = " & postid
			Set rs2 = Conn.Execute(StrSql)
			strtitle = rs2("title")
			strtext = rs2("pagetext")
			Str1Pos = Instr(1, strtext, "[quote]", 0)
			Str2Pos = Instr(Str1Pos + 1, strtext, "[/quote]", 0)
			if Str1Pos > 0 and Str2Pos > 0 then
				tmpPos = Str2Pos
				do until tmpPos <= 0
					Str2Pos = tmpPos
					tmpPos = Instr(tmpPos + 1, strtext, "[/quote]", 0)
				loop
				strtext = left(strtext, str1pos - 1) & mid(strtext, Str2pos + 8)
			end if
			if len(strtext) > 100 then strtext = CutStr(strtext, 100)
			StrHtml2 = "[quote]" & chr(10) & "[b]" & rs2("username") & ": " & strtitle & "[/b]" & chr(10) & chr(10) & strtext & chr(10) & "[/quote]" & chr(10)
		end if
		StrHtml = Replace(StrHtml, "{text}", StrHtml2)
		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") & "&nbsp; "
				rs2.MoveNext
			loop
		end if
		StrHtml = Replace(StrHtml, "{expname}", StrHtml2)

		if postid <> -1 then
			StrHtml = Replace(StrHtml, "{url}", "postid=" & postid)
		else
			StrHtml = Replace(StrHtml, "{url}", "threadid=" & threadid)
		end if
		StrHtml = Replace(StrHtml, "{thread_title}", threadtitle)
		StrHtml = Replace(StrHtml, "{defreplyshowpost}", defreplyshowpost)
		response.write StrHtml

		' 显示最后几帖
		rs2.Close
		pagei = 1
		StrHtml = loadtemplate("thread")
		StrSql = "select sf_post.*, sf_user.* from sf_post left join sf_user on (sf_post.userid = sf_user.userid) where sf_post.threadid = " & threadid & " order by sf_post.postid DESC"
		Set rs2 = server.CreateObject("ADODB.RecordSet")
		rs2.Open StrSql, Conn, 1, 1
		oldtime = dateadd("n", onlinetime * -1, now())
		if not (rs2.bof or rs2.eof) then
			do until rs2.eof or pagei > defreplyshowpost
				StrHtml2 = StrHtml
				if rs2("iconid") <> 0 then
					StrHtml2 = Replace(StrHtml2, "{post_icon}", "<img src=""image/posticon/icon" & rs2("iconid") & ".gif"">")
				else
					StrHtml2 = Replace(StrHtml2, "{post_icon}", "")
				end if
				StrHtml2 = Replace(StrHtml2, "{post_title}", rs2("title"))
				allowautourl = false
				if rs2("allowautourl") = 1 then allowautourl = true
				allowemot = false
				if rs2("allowsmilie") = 1 then allowemot = true
				StrHtml2 = Replace(StrHtml2, "{post_text}", "<br><br>" & xbcodeContent(formatstr(rs2("pagetext")), allowemot, allowautourl, false, false) & "<br><br>")
				StrHtml2 = Replace(StrHtml2, "{img_gotop}", "")
				StrHtml2 = Replace(StrHtml2, "{post_btn}", "")
				StrHtml2 = Replace(StrHtml2, "{user_btn}", "")
				StrHtml2 = Replace(StrHtml2, "{user_country}", rs2("country"))
				StrHtml2 = Replace(StrHtml2, "{post_time}", rs2("dateline"))
				StrHtml2 = Replace(StrHtml2, "{no_num}", rs2.RecordCount - pagei + 1)
				StrHtml2 = Replace(StrHtml2, "{user_name}", rs2("username"))
				StrHtml2 = Replace(StrHtml2, "{user_avatar}", "")
				StrHtml2 = Replace(StrHtml2, "{user_sign}", "")
				if rs2("usertitle") = "" then
					StrHtml2 = Replace(StrHtml2, "{user_title}", GetTitle(rs2("posts")))
				else
					StrHtml2 = Replace(StrHtml2, "{user_title}", rs2("usertitle"))
				end if
				StrHtml2 = Replace(StrHtml2, "{img_ip}", "")
				StrHtml2 = Replace(StrHtml2, "{user_titleimg}", "")
				StrHtml2 = Replace(StrHtml2, "{user_posts}", rs2("posts"))
				StrHtml2 = Replace(StrHtml2, "{user_rating}", rs2("rating"))
				StrHtml2 = Replace(StrHtml2, "{user_joindate}", year(rs2("joindate")) & "-" & month(rs2("joindate")))
				if rs2("lastactivity") > oldtime then
					StrHtml2 = Replace(StrHtml2, "{onlinetext}", "online")
				else
					StrHtml2 = Replace(StrHtml2, "{onlinetext}", "offline")
				end if
				response.write StrHtml2
				rs2.MoveNext
				pagei = pagei + 1
			loop
		end if

		response.write sfcopyright
end select

response.write loadtemplate("htmlbottom")
Conn.Close
Set Conn = nothing
Set rs = nothing
Set rs2 = nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -