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

📄 postsave.asp

📁 一个asp写的论坛源代码,论坛所需要的功能都有
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<!-- #include file="conn.asp" -->
<!-- #include file="INC/Const.asp" -->
<%
Dim fID,tID,PostSave
fID = Cid(Request("fid"))
tID = Cid(Request("tid"))
Set PostSave = New MypostSave
Set PostSave = Nothing

Class MypostSave
	Public Boards,Board_Setting
	Private Sub Class_Initialize()
		Select Case Request("action")
			Case "saves"	'发贴保存
				Call newsave
			Case "resaves"	'回复保存
				Call resaves
			Case "edsaves"	'编辑保存
				Call edsaves
			Case Else
				Team.Error("参数错误!")
		End Select
	End Sub

	Private	Sub newsave
		Dim Subject,Message,SQL,Rs,uID,Code
		Dim CacheRs,Rewardprice,NextID,Istop,isgood,info,SetMyTime,Settotime
		Call ConfigSet
		Call CheckpostTime
		Call NewUserpostTime()
		Istop = Cid(Request.Form("istop"))
		Isgood = Cid(Request.Form("isgood"))
		Subject = HtmlEncode(Trim(Request.Form("subject")))
		Message = HTMLEncode(Trim(Request.Form("message")))
		If strLength(Subject)<cid(team.Forum_setting(64)) Then
			team.error " 主题字数不能少于 "&team.Forum_setting(64)&" 个字符。 "
		ElseIf strLength(Subject)>cid(team.Forum_setting(89)) Then
			team.error " 主题字数不能大于 "&team.Forum_setting(89)&" 个字符。 "
		ElseIf strLength(Message)<cid(team.Forum_setting(64)) Then
			team.error " 内容字数不能少于 "&team.Forum_setting(64)&" 个字符。 "
		ElseIf strLength(Message)>cid(team.Forum_setting(67)) Then
			team.error " 内容字数不能多于 "&team.Forum_setting(67)&" 个字符。 "
		End if
		Code = Trim(Request.Form("code"))
		If Cid(team.Forum_setting(48))>=2 then
			if Not Team.CodeIsTrue(code) Then
				team.error "验证码错误,请刷新后重新填写。"
			End If
		End If
		If Cid(Request.Form("createpoll")) = 1 Then
			if Request.Form("pollitemid") = "" Then 
				team.Error " 投票项不能为空。"
			End if
		End If
		If Cid(Request.Form("creatactivity")) = 1 Then
			If Request.Form("activityname") = "" Then
				team.Error " 活动名称不能为空 "
			End if
			If Request.Form("activityclass") = "" Then
				team.Error " 活动类别不能为空 "
			End if		
			If Request.Form("activityplace") = "" Then
				team.Error " 活动地点不能为空 "
			End If
			If Request.Form("activitytime") = "0" Then 
				If Request.Form("starttimefrom1") = "" Then
					team.Error " 活动时间不能为空 "
				End If
				SetMyTime = Request.Form("starttimefrom1")
				Settotime = ""
			Else
				If Request.Form("starttimefrom2") = "" Then
					team.Error " 活动开始时间不能为空 "
				End If
				SetMyTime = Request.Form("starttimefrom2")
				Settotime = Request.Form("starttimeto")
			End If
		End if
		If Cid(Request.Form("createreward")) = 1 Then
			Rewardprice = Cid(Request.Form("rewardprice"))
		Else
			Rewardprice = 0
		End If
		SQL="insert into ["&Isforum&"forum] (Forumid,Topic,Username,Views,Icon,Replies,Color,PostClass,Content,Toptopic,Locktopic,Goodtopic,Posttime,Lasttime,LastText,Postip,Createpoll,Creatdiary,Creatactivity,Createreward,Rewardprice,Readperm,ReList,Rewardpricetype,Tags,CloseTopic,Deltopic,RunMsg) values ("&fid&",'"&Subject&"','"&TK_UserName&"',0,"&Cid(Request.Form("icon"))&",0,"&Cid(Request.Form("color"))&","&Cid(Request.Form("posttopic"))&",'"&Message&"',"&Istop&","&Cid(Request.Form("islocks"))&","&Isgood&","&SqlNowString&","&SqlNowString&",'"&TK_UserName&"$@$"&Cutstr(Subject,200)&"','"&Remoteaddr&"',"&Cid(Request.Form("createpoll"))&","&Cid(Request.Form("todiary"))&","&Cid(Request.Form("creatactivity"))&","&Cid(Request.Form("createreward"))&","&Rewardprice&","&Cid(Request.Form("readperm"))&",'"&team.Club_Class(11)&"',0,'"&HtmlEncode(Request.Form("tags"))&"',0,0,0) "
		team.execute (SQL)
		Set Rs = team.execute("Select Max(ID) from [forum] Where Forumid="&Fid)
		If Not Rs.Eof Then
			uID = Rs(0)
		End if
		Rs.Close:Set Rs=Nothing
		If Cid(Request.Form("createpoll")) = 1 Then
			Dim Pollitemid,PollResult,PollResultmax,i
			Pollitemid = Replace(Replace(HtmlEncode(Request.Form("pollitemid"))," ",""),",","|")
			PollResult = Split(Pollitemid,"|")
			for i = 0 to Ubound(PollResult)
				if i = 0 Then
					PollResultmax = "0"
				else
					PollResultmax = PollResultmax &"|0"
				end if
			next
			team.execute ("insert into ["&Isforum&"FVote] (Rootid,PollClose,Pollday,PollMax,Polltime,Pollmult,Polltopic,PollResult) values ("&uID&",0,"&Cid(Request.Form("enddatetime"))&","&Cid(Request.Form("maxchoices"))&","&SqlNowString&","&Cid(Request.Form("multiplepoll"))&",'"&Pollitemid&"','"&PollResultmax&"') ")
			info = " <li> 投票设置完成 。"
		End if
		If Cid(Request.Form("creatactivity")) = 1 Then
			team.execute ("insert into ["&Isforum&"Activity] (Rootid,PlayName,PlayClass,PlayCity,PlayFrom,Playto,Playplace,PlayCost,PlayGender,PlayNum,PlayStop,PlayUserNum) values ("&uID&",'"&HtmlEncode(Request.Form("activityname"))&"','"&HtmlEncode(Request.Form("activityclass"))&"','"&HtmlEncode(Request.Form("activitycity"))&"','"&Replace(SetMyTime,"'","''")&"','"&Replace(Settotime,"'","''")&"','"&HtmlEncode(Request.Form("activityplace"))&"',"&Cid(Request.Form("cost"))&","&Cid(Request.Form("gender"))&","&Cid(Request.Form("activitynumber"))&",'"&Replace(Request.Form("activityexpiration"),"'","''")&"',0) ")
			info = " <li> 活动设置完成 。"
		End if
		If Request.form("upfileid")<>"" Then
			Dim NewID
			NewID=Split(Replace(Replace(Request.Form("upfileid")," ",""),"'",""),",")
			For i=0 To Ubound(newid)-1
				team.execute("Update ["&IsForum&"Upfile] Set ID= "&uID&" Where FileID="& newid(i))
			Next
		End If
		Call UpdateUserpostExc()
		NextID = team.execute("Select Followid From [bbsconfig] Where ID="& fID )(0)
		team.execute("Update ["&IsForum&"Bbsconfig] Set Board_Last='<A href=Thread.asp?tid="&uID&" target=""_blank"">"&Cutstr(Subject,200)&"</a>$@$"&TK_UserName&"$@$"&Now()&"',Toltopic=Toltopic+1,today=today+1 Where ID = "& fID )
		team.execute("update ["&IsForum&"ClubConFig] Set today=today+1,PostNum=PostNum+1")
		team.LockCache "PostNum" , Application(CacheName&"_PostNum")+1
		team.LockCache "TodayNum" , Application(CacheName&"_TodayNum")+1
		Set CacheRs = Team.Execute("Select Followid,ID From ["&IsForum&"bbsconfig] Where ID="& NextID)
		If Not CacheRs.Eof Then
			If Cid(CacheRs(0)) > 0 Then
				NextID = CacheRs(0)
				team.execute("Update ["&IsForum&"Bbsconfig] Set Board_Last='<A href=Thread.asp?tid="&uID&" target=""_blank"">"&Cutstr(Subject,200)&"</a>$@$"&TK_UserName&"$@$"&Now()&"',today=today+1 Where ID = "& Cid(CacheRs(1)))
			End If
		End If
		CacheRs.Close:Set CacheRs=Nothing
		Cache.DelCache("BoardLists")
		Session(CacheName&"_UserLogin")=""
		Session(CacheName & "posttime") = Now()
		team.error1 info & "<li>新主题发表成功<li><a href=Thread.asp?tid="&uID&">返回主题</a><li><a href=Forums.asp?fid="&fid&">返回论坛</a><li><a href=""Default.asp"">返回论坛首页</a><meta http-equiv=refresh content=3;url=Thread.asp?tid="&uID&"> "
	End Sub


	Private Sub edsaves
		Dim Subject,Message,SQL,Rs,uID,Code,Istop,isgood,info,Rewardprice
		Dim ReList,PostNames,SetMyTime,Settotime,PostTime
		Call ConfigSet
		Istop = Cid(Request.Form("istop"))
		Isgood = Cid(Request.Form("isgood"))
		Subject = HtmlEncode(Trim(Request.Form("subject")))
		Message = HTMLEncode(Trim(Request.Form("message")))
		Code = Trim(Request.Form("code"))
		If Cid(team.Forum_setting(48))>=2 then
			if Not Team.CodeIsTrue(code) Then
				team.error "验证码错误,请刷新后重新填写。"
			End If
		End If
		If strLength(Message)<cid(team.Forum_setting(64)) Then
			team.error " 内容字数不能少于 "&team.Forum_setting(64)&" 个字符。 "
		ElseIf strLength(Message)>cid(team.Forum_setting(67)) Then
			team.error " 内容字数不能多于 "&team.Forum_setting(67)&" 个字符。 "
		End If
		Set rs = team.execute("select ReList,UserName,PostTime,Locktopic From ["&IsForum&"Forum] Where ID="&tID)
		If Rs.Eof Then
			team.Error "您编辑的帖子ID错误。"
		Else
			If Int(RS(3)) = 1 Then
				team.Error "此主题帖已经被锁定,无法进行编辑操作。"
			End if
			ReList = Rs(0)
			PostNames = Rs(1)
			PostTime = Rs(2)
		End If
		Rs.Close:Set Rs=Nothing
		If IsNumEric(Request("retopicid")) Then
			Set Rs = team.execute("Select UserName,PostTime,Lock From ["&IsForum & ReList &"] Where ID = "& Cid(Request("retopicid")))
			If Rs.Eof Then
				team.Error "您编辑的帖子ID错误。"
			Else
				If Int(RS(2)) = 1 Then
					team.Error "此帖已经被锁定,无法进行编辑操作。"
				End if
				If Not UpPostName(Rs(0)) Then
					team.Error "您没有编辑他人帖子的权限。"
				Else
					If Int(team.Forum_setting(94)) > 0 And DateDiff("s",RS(1),Now()) > team.Forum_setting(94) And Not team.ManageUser Then
						team.Error " 此帖子已经超过了编辑时限,您无法编辑了。"
					Else
						team.execute ("Update ["&IsForum & ReList &"] Set ReTopic='"&Subject&"',Content='"&UpEditTags(Message,RS(1))&"' Where ID = "& Cid(Request("retopicid")) )
						info = info & " <li> 回帖编辑完成 。"
					End if
				End if
			End if
		Else
			If Not UpPostName(PostNames) Then
				team.Error "您没有编辑他人帖子的权限。"
			End if
			If strLength(Subject)<cid(team.Forum_setting(64)) Then
				team.error " 主题字数不能少于 "&team.Forum_setting(64)&" 个字符。 "
			ElseIf strLength(Subject)>cid(team.Forum_setting(89)) Then
				team.error " 主题字数不能大于 "&team.Forum_setting(89)&" 个字符。 "
			End if
			If Cid(Request.Form("createpoll")) = 1 Then
				if Request.Form("pollitemid") = "" Then 
					team.Error " 投票项不能为空。"
				End if
			End If
			If Cid(Request.Form("creatactivity")) = 1 Then
				If Request.Form("activityname") = "" Then
					team.Error " 活动名称不能为空 "
				End if
				If Request.Form("activityclass") = "" Then
					team.Error " 活动类别不能为空 "
				End if		
				If Request.Form("activityplace") = "" Then
					team.Error " 活动地点不能为空 "
				End If
				If Request.Form("activitytime") = 0 Then 
					If Request.Form("starttimefrom1") = "" Then
						team.Error " 活动时间不能为空 " & Request.Form("starttimefrom1")
					End If
					SetMyTime = Request.Form("starttimefrom1")
					Settotime = ""
				Else
					If Request.Form("starttimefrom2") = "" Then
						team.Error " 活动开始时间不能为空 "
					End If
					SetMyTime = Request.Form("starttimefrom2")
					Settotime = Request.Form("starttimeto")
				End If
			End if
			If Cid(Request.Form("createreward")) = 1 Then
				Rewardprice = Cid(Request.Form("rewardprice"))
			Else
				Rewardprice = 0
			End If
			team.execute ("Update ["&Isforum&"forum] Set Topic='"&Subject&"',Icon="&Cid(Request.Form("icon"))&",Color="&Cid(Request.Form("color"))&",PostClass="&Cid(Request.Form("posttopic"))&",Content='"&UpEditTags(Message,PostTime)&"',Goodtopic="&Isgood&",Lasttime="&SqlNowString&",LastText='"&TK_UserName&"$@$"&Cutstr(Subject,200)&"',Createpoll="&Cid(Request.Form("createpoll"))&",Creatdiary="&Cid(Request.Form("todiary"))&",Creatactivity="&Cid(Request.Form("creatactivity"))&",Createreward="&Cid(Request.Form("createreward"))&",Rewardprice="&Rewardprice&",Readperm="&Cid(Request.Form("readperm"))&",ReList='"&team.Club_Class(11)&"',Tags='"&HtmlEncode(Request.Form("tags"))&"' Where ID="&tid)
			If Cid(Request.Form("createpoll")) = 1 Then
				Dim Pollitemid,PollResult,PollResultmax,i
				Pollitemid = Replace(Replace(HtmlEncode(Request.Form("pollitemid"))," ",""),",","|")
				PollResult = Split(Pollitemid,"|")
				for i = 0 to Ubound(PollResult)
					if i = 0 Then
						PollResultmax = "0"
					else
						PollResultmax = PollResultmax &"|0"
					end if
				next
				team.execute ("Update ["&Isforum&"FVote] Set Pollday="&Cid(Request.Form("enddatetime"))&",PollMax="&Cid(Request.Form("maxchoices"))&",Pollmult="&Cid(Request.Form("multiplepoll"))&",Polltopic='"&Pollitemid&"',PollResult='"&PollResultmax&"' Where RootID="&tid)
				info = " <li> 投票设置完成 。"
			End if
			If Cid(Request.Form("creatactivity")) = 1 Then
				team.execute ("Update ["&Isforum&"Activity] Set PlayName='"&HtmlEncode(Request.Form("activityname"))&"',PlayClass='"&HtmlEncode(Request.Form("activityclass"))&"',PlayCity='"&HtmlEncode(Request.Form("activitycity"))&"',PlayFrom='"&SetMyTime&"',Playto='"&Replace(Settotime,"'","''")&"',Playplace='"&HtmlEncode(Request.Form("activityplace"))&"',PlayCost="&Cid(Request.Form("cost"))&",PlayGender="&Cid(Request.Form("gender"))&",PlayNum="&Cid(Request.Form("activitynumber"))&",PlayStop='"&Replace(Request.Form("activityexpiration"),"'","''")&"' Where RootID="&tid)
				info = " <li> 活动设置完成 。"
			End if
			Dim CacheRs,NextID
			NextID = team.execute("Select Followid From ["&IsForum&"bbsconfig] Where ID="& fID )(0)
			team.execute("Update ["&IsForum&"Bbsconfig] Set Board_Last='<A href=Thread.asp?tid="&tID&" target=""_blank"">"&Cutstr(Subject,200)&"</a>$@$"&TK_UserName&"$@$"&Now()&"' Where ID = "& fID )
			Set CacheRs = Team.Execute("Select Followid,ID From ["&IsForum&"bbsconfig] Where ID="& NextID)
			If Not CacheRs.Eof Then
				If Cid(CacheRs(0)) > 0 Then
					NextID = CacheRs(0)
					team.execute("Update ["&IsForum&"Bbsconfig] Set Board_Last='<A href=Thread.asp?tid="&tID&" target=""_blank"">"&Cutstr(Subject,200)&"</a>$@$"&TK_UserName&"$@$"&Now()&"' Where ID = "& Cid(CacheRs(1)))
				End If
			End If
			CacheRs.Close:Set CacheRs=Nothing
			Cache.DelCache("BoardLists")
			info = info & " <li> 主题编辑完成 。"
		End if
		If Request.form("upfileid")<>"" Then
			Dim NewID
			NewID=Split(Replace(Replace(Request.Form("upfileid")," ",""),"'",""),",")
			For i=0 To Ubound(newid)-1
				team.execute("Update ["&IsForum&"Upfile] Set ID= "&tID&" Where FileID="& newid(i))
			Next
		End if
		team.error1 info & "<li><a href=Thread.asp?tid="&tID&">返回主题</a><li><a href=Forums.asp?fid="&fid&">返回论坛</a><li><a href=""Default.asp"">返回论坛首页</a><meta http-equiv=refresh content=3;url=Thread.asp?tid="&tID&"> "
	End Sub

	Private Sub resaves
		Dim Message,SQL,Rs,Code,ReTopic
		Dim ReForumid,fastReTopic,RsCountlist,Pageinfo
		Dim RePage,i
		Call NewUserpostTime()
		Call CheckpostTime
		Message = HTMLEncode(Trim(Request.Form("message")))
		ReTopic = HTMLEncode(Trim(Request.Form("subject")))
		If strLength(Message)<cid(team.Forum_setting(64)) Then
			team.error " 内容字数不能少于 "&team.Forum_setting(64)&" 个字符。 "
		ElseIf strLength(Message)>cid(team.Forum_setting(67)) Then
			team.error " 内容字数不能多于 "&team.Forum_setting(67)&" 个字符。 "
		End if
		Code = Trim(Request.Form("code"))
		If Cid(team.Forum_setting(48))>=2 then

⌨️ 快捷键说明

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