savepost.asp

来自「现在好了」· ASP 代码 · 共 356 行 · 第 1/2 页

ASP
356
字号
	Public Sub GetMoney_SaveRe()
		Dim ToUserID,ToUserName,UpPostBuyUser,UpGetMoney,Tempstr
		SQL="Select PostUserID,GetMoney,PostBuyUser,Username From "&TotalUseTable&" Where RootID="&RootID&" and ParentID=0 and GetMoneyType=2"
		Set Rs = Server.CreateObject("ADODB.Recordset")
		Rs.Open SQL,conn,1,3
			If Not Rs.Eof Then
				ToUserID = Clng(Rs(0))
				UpGetMoney = Rs(1) + ToMoney
				UpPostBuyUser = Rs(2)
				ToUserName = Rs(3)
				Tempstr = Split(UpPostBuyUser,"|||",2)
				Tempstr(0) = UpGetMoney
				Tempstr(1) = Tempstr(1) & "|||" & UserName &","& ToMoney
				UpPostBuyUser = Tempstr(0) & "|||" & Tempstr(1)
				UpPostBuyUser = Trim(UpPostBuyUser)
				Rs(1) = UpGetMoney
				Rs(2) = UpPostBuyUser
			Rs.update
			End If
		Rs.Close : Set Rs=Nothing

		'更新主题MONEY值
		Sql = "Update [Dv_Topic] Set GetMoney="&UpGetMoney&" where TopicID="&RootID
		Dvbbs.Execute(sql)
		'主题作者获取金币
		Sql = "Update [Dv_User] Set UserMoney=UserMoney + "&ToMoney&" where UserID="&ToUserID
		Dvbbs.Execute(sql)
		'插入道具日志
		'Dim LogMsg
		'LogMsg = "<a href=""dispbbs.asp?boardid="&Dvbbs.boardid&"&id="&RootID&"&star="&Star&"#"&Announceid&""" target=_blank>回复主题:《<B>"&topic&"</B>》</a> 赠道给作者:<b>"&ToUserName&"</b><font color="&Dvbbs.mainsetting(1)&">"&ToMoney&"</font>个金币成功,并插入道具日志记录。"
		'Call Dvbbs.ToolsLog(0,0,ToMoney,0,0,LogMsg,Dvbbs.MyUserInfo(37)&"|"&Dvbbs.MyUserInfo(38))
	End Sub

	Rem ------------------------
	Rem 保存部分函数开始
	Rem ------------------------
	'检查数据,提取数据,获得贴子数据表名等。
	Public Sub Save_CheckData()

		Chk_Post()
		CheckfromScript()
		'Dim mysessiondata
		'把提交的数据保存到session
		Content = Dvbbs.Checkstr(Request.Form("body"))
		Dvbbs.MyUserInfo(Dvbbs.UserInfoCount-1) = Content
		Session(Dvbbs.CacheName & "UserID") = Dvbbs.MyUserInfo
		If Dvbbs.Board_Setting(4) = "1" Then
			If Not Dvbbs.CodeIsTrue() Then
				 Response.redirect "showerr.asp?ErrCodes=<li>验证码校验失败,2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
			End If
		End If
		Chk_PostType()

		'魔法表情检查部分
		tMagicFace = Request("tMagicFace")
		If tMagicFace = "" Or Not IsNumeric(tMagicFace) Then tMagicFace = 0
		tMagicFace = Cint(tMagicFace)
		iMagicFace = Request("iMagicFace")
		If iMagicFace = "" Or Not IsNumeric(iMagicFace) Then iMagicFace = 0
		iMagicFace = Clng(iMagicFace)
		Expression = Dvbbs.Checkstr(Request.Form("Expression"))
		If Expression = "" Then
			Expression = "face1.gif"
		Else
			Expression = Replace(Expression,"|","")
		End If
		If tMagicFace = 1 And iMagicFace > 0 And Dvbbs.Forum_Setting(98)="1" Then
			Set Rs = Dvbbs.Plus_Execute("Select tMoney,tTicket,MagicSetting From Dv_Plus_Tools_MagicFace Where MagicFace_s = " & iMagicFace)
			If Rs.Eof And Rs.Bof Then
				Expression = "0|" & Expression
				tMagicMoney = 0
				tMagicTicket = 0
			Else
				If cCur(Dvbbs.MyUserInfo(38)) < Rs(1) And cCur(Dvbbs.MyUserInfo(37)) < Rs(0) Then Response.redirect "showerr.asp?ErrCodes=<li>您没有足够的金币或点券使用魔法表情,2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
				Dim iMagicSetting
				iMagicSetting = Split(Rs(2),"|")
				If cCur(iMagicSetting(0)) > cCur(Dvbbs.MyUserInfo(8)) Then Response.redirect "showerr.asp?ErrCodes=<li>您的帖子数没有达到使用魔法表情的标准,2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
				If cCur(iMagicSetting(1)) > cCur(Dvbbs.MyUserInfo(21)) Then Response.redirect "showerr.asp?ErrCodes=<li>您的金钱数没有达到使用魔法表情的标准,2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
				If cCur(iMagicSetting(2)) > cCur(Dvbbs.MyUserInfo(22)) Then Response.redirect "showerr.asp?ErrCodes=<li>您的经验数没有达到使用魔法表情的标准,2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
				If cCur(iMagicSetting(3)) > cCur(Dvbbs.MyUserInfo(23)) Then Response.redirect "showerr.asp?ErrCodes=<li>您的魅力数没有达到使用魔法表情的标准,2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
				If cCur(iMagicSetting(4)) > cCur(Dvbbs.MyUserInfo(24)) Then Response.redirect "showerr.asp?ErrCodes=<li>您的威望数没有达到使用魔法表情的标准,2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
				Expression = iMagicFace & "|" & Expression
				tMagicMoney = Rs(0)
				tMagicTicket = Rs(1)
				FoundUseMagic = True
			End If
			Rs.Close
			Set Rs=Nothing
		Else
			Expression = "0|" & Expression
		End If
		Expression = Split(Expression,"|")
		Topic = Dvbbs.Checkstr(Trim(Request.Form("topic")))
		'Content=Dvbbs.Checkstr(Request.Form("Content"))
		signflag = Dvbbs.Checkstr(Trim(Request.Form("signflag")))
		mailflag = Dvbbs.Checkstr(Trim(Request.Form("emailflag")))
		MyTopicMode = Dvbbs.Checkstr(Trim(Request.Form("topicximoo")))
		MyLockTopic = Dvbbs.Checkstr(Trim(Request.Form("locktopic")))
		Myistop = Dvbbs.Checkstr(Trim(Request.Form("istop")))
		Myistopall = Dvbbs.Checkstr(Trim(Request.Form("istopall")))
		TopicMode = Request.Form("topicmode")
		If Dvbbs.strLength(topic)> CLng(Dvbbs.Board_Setting(45)) Then Response.redirect "showerr.asp?ErrCodes=<li>"&Replace(template.Strings(23),"{$topiclimited}",Dvbbs.Board_Setting(45))&"<BR>2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
		If Dvbbs.strLength(Content) > CLng(Dvbbs.Board_Setting(16)) Then Response.redirect "showerr.asp?ErrCodes=<li>"&Replace(template.Strings(24),"{$bodylimited}",Dvbbs.Board_Setting(16))&"<BR>2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
		REM 2004-4-23添加限制帖子内容最小字节数,下次在模板中添加。Dvbbs.YangZheng
		If Dvbbs.strLength(Content) < CLng(Dvbbs.Board_Setting(52)) And Not CLng(Dvbbs.Board_Setting(52)) = 0 Then Response.redirect "showerr.asp?ErrCodes=<li>"&Replace(template.Strings(24),"大于{$bodylimited}","小于"&Dvbbs.Board_Setting(52))&"<BR>2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
		Dim testContent
		testContent=Content
		testContent=Html2Ubb(testContent)
		testContent=Replace(testContent,vbNewLine,"")
		testContent=Replace(testContent," ","")
		testContent=Replace(testContent,"&nbsp;","")		
		If testContent="" Then Response.redirect "showerr.asp?ErrCodes=<li>您没有填写内容,或因当前不支持HTML模式,内容被自动过滤<BR>2秒后自动返回上一页面。&action=OtherErr&autoreload=1"
		If Not IsNumeric(mailflag) Or mailflag="" Then mailflag=0
		If TopicMode<>"" and IsNumeric(TopicMode) Then TopicMode=Cint(TopicMode) Else TopicMode=0
		mailflag=CInt(mailflag)
		If signflag="yes" Then
			signflag=1
		Else
			signflag=0
		End If
		If Request.form("upfilerename")<>"" Then
			ihaveupfile=1
			upfileinfo=Replace(Request.form("upfilerename"),"'","")
			upfileinfo=Replace(upfileinfo,";","")
			upfileinfo=Replace(upfileinfo,"--","")
			upfileinfo=Replace(upfileinfo,")","")
			Dim fixid,upfilelen
			fixid=Replace(upfileinfo," ","")
			fixid=Replace(fixid,",","")
			If Not IsNumeric(fixid) Then ihaveupfile=0
			upfilelen=len(upfileinfo)
			upfileinfo=left(upfileinfo,upfilelen-1)
		Else
			ihaveupfile=0
		End If
		voteid=0
		isvote=0
		If Action = 7 Then
			votetype=Dvbbs.Checkstr(request.Form("votetype"))
			If IsNumeric(votetype)=0 or votetype="" Then votetype=0
			vote=Dvbbs.Checkstr(trim(Replace(request.Form("vote"),"|","")))
			Dim j,k,vote_1,votelen,votenumlen
			If vote="" Then
				Dvbbs.AddErrCode(81)
			Else
				vote=split(vote,chr(13)&chr(10))
				j=0
				For i = 0 To ubound(vote)
					If Not (vote(i)="" Or vote(i)=" ") Then
						vote_1=""&vote_1&""&vote(i)&"|"
						j=j+1
					End If
					If i>cint(Dvbbs.Board_Setting(32))-2 Then Exit For
				Next
				For k = 1 to j
					votenum=""&votenum&"0|"
				Next
				votelen=len(vote_1)
				votenumlen=len(votenum)
				votenum=left(votenum,votenumlen-1)
				vote=left(vote_1,votelen-1)
			End If
			If Not IsNumeric(request("votetimeout")) Then
				Dvbbs.AddErrCode(82)
			Else
				If request("votetimeout")="0" Then
					votetimeout=dateadd("d",9999,Now())
				Else
					votetimeout=dateadd("d",request("votetimeout"),Now())
				End If
				votetimeout=Replace(Replace(CSTR(votetimeout+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午","")
			End If
		End If
		If Action = 5 Or Action = 7 Then
			CanLockTopic=False
			CanTopTopic=False
			CanTopTopic_a=False
			If Topic="" OR Replace(Topic&"","

⌨️ 快捷键说明

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