📄 savepost.asp
字号:
set rs=Dvbbs.execute("select Max(userid) from [dv_user]")
MaxUserID=rs(0)
Dim num1,rndnum
Randomize
Do While Len(rndnum)<4
num1=CStr(Chr((57-48)*rnd+48))
rndnum=rndnum&num1
loop
MaxUserID=rndnum & MaxUserID
MaxLength=MaxLength-len(MaxUserID)
Select Case MaxLength
Case 7
MaxUserID="0000000" & MaxUserID
Case 6
MaxUserID="000000" & MaxUserID
Case 5
MaxUserID="00000" & MaxUserID
Case 4
MaxUserID="0000" & MaxUserID
Case 3
MaxUserID="000" & MaxUserID
Case 2
MaxUserID="00" & MaxUserID
Case 1
MaxUserID="0" & MaxUserID
Case 0
MaxUserID=MaxUserID
End Select
Session("challengeWord")=MaxUserID
Response.Write "<iframe name=getchallengeword frameborder=0 width=100% height=0 scrolling=no src=""pay_topic_postforumid.asp?chanWord="&Session("challengeWord")&"""></iframe>"
End If
End Sub
Public Sub Get_ForumTreeCode()
Dim mailbody
Set Rs=Dvbbs.Execute("select b.layer,b.orders,b.EmailFlag,b.username,u.userEmail from "&TotalUseTable&" b inner join [Dv_user] u on b.postuserid=u.userid where b.AnnounceID="&ParentID)
If Not(rs.EOF And rs.BOF) Then
If IsNull(Rs(0)) Then
iLayer=1
Else
iLayer=Rs(0)
End If
If IsNull(Rs(1)) Then
iOrders=0
Else
iOrders=Rs(1)
End If
If Rs(3)=Dvbbs.membername Then
If Cint(Dvbbs.GroupSetting(4))=0 Then Dvbbs.AddErrCode(73)
End If
If rs(3) <> Dvbbs.membername Then
Dim sUrl,Email,TempArray,etopic
TempArray = Split(template.html(10),"||")
sUrl=Dvbbs.Get_ScriptNameUrl
If Rs(2)=1 Or Rs(2)=3 Then
etopic=Replace(template.Strings(25),"{$forumname}",Dvbbs.Forum_info(0))
email=Rs(4)
mailbody = TempArray(0)
mailbody = Replace(mailbody,"{$boardid}",Dvbbs.BoardID)
mailbody = Replace(mailbody,"{$forumname}",Dvbbs.Forum_info(0))
mailbody = Replace(mailbody,"{$topicid}",RootID)
mailbody = Replace(mailbody,"{$star}",Star)
mailbody = Replace(mailbody,"{$surl}",sUrl)
mailbody = Replace(mailbody,"{$parentid}",ParentID)
Select Case Dvbbs.Forum_Setting(2)
Case "1"
jmail email,etopic,mailbody
Case "2"
Cdonts email,etopic,mailbody
Case "3"
aspemail email,etopic,mailbody
End Select
End If
If Rs(2)=2 Or Rs(2)=3 Then
mailbody = TempArray(1)
mailbody = Replace(mailbody,"{$boardid}",Dvbbs.BoardID)
mailbody = Replace(mailbody,"{$topicid}",RootID)
mailbody = Replace(mailbody,"{$star}",Star)
mailbody = Replace(mailbody,"{$surl}",sUrl)
mailbody = Replace(mailbody,"{$parentid}",ParentID)
Dvbbs.Execute("insert into dv_message(incept,sender,title,content,sendtime,flag,issend) values('"&Rs(3)&"','"&Dvbbs.Forum_info(0)&"','"&template.Strings(26)&"','"&mailbody&"',"&SqlNowString&",0,1)")
update_user_msg(Rs(3))
End If
End If
Else
iLayer=1
iOrders=0
End If
Set Rs=Nothing
If RootID<>0 Then
iLayer=ilayer+1
Dvbbs.Execute "update "&TotalUseTable&" set orders=orders+1 where RootID="&cstr(RootID)&" and orders>"&cstr(iOrders)
iOrders=iOrders+1
End If
End Sub
Public Sub Update_Edit_Announce()
Dim re,LastBoard,LastTopic
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
re.Pattern="<br>"
Content = re.Replace(Content,"[br]")
re.Pattern="\[align=right\]\[color=#000066\](.*)\[\/color\]\[\/align\]"
Content = re.Replace(Content,"")
re.Pattern="<div align=right><font color=#000066>(.*)<\/font><\/div>"
Content = re.Replace(Content,"")
re.Pattern="\[br\]>"
Content = re.Replace(Content,"<br>")
Set re=Nothing
If Dvbbs.membername<>UserName Then
If Dvbbs.forum_setting(49)="1" Then char_changed = "[align=right][color=#000066][此贴子已经被"&Dvbbs.membername&"于"&Now()&"编辑过][/color][/align]"
Else
If Dvbbs.forum_setting(48)="1" Then char_changed = "[align=right][color=#000066][此贴子已经被作者于"&Now()&"编辑过][/color][/align]"
End If
Get_Edit_PermissionInfo
Dim Contentdata
Contentdata=Content
Dvbbs.ShowErr
'取出当前版面最后回复id,如果本帖为最后回复则更新相应数据
Set Rs = Dvbbs.Execute("select LastPost from dv_board where boardid="&Dvbbs.BoardID)
If not (Rs.EOF And Rs.BOF) Then
If Not IsNull(rs(0)) And rs(0)<>"" then
LastBoard=split(rs(0),"$")
If ubound(LastBoard)=7 Then
If Clng(LastBoard(6))=Clng(AnnounceID) Then
LastPost=LastBoard(0) & "$" & LastBoard(1) & "$" & Now() & "$" & Replace(cutStr(reubbcode(topic),20),"$","$") & "$" & LastBoard(4) & "$" & LastBoard(5) & "$" & LastBoard(6) & "$" & Dvbbs.BoardID
dvbbs.execute("update dv_board set LastPost='"&SimEncodeJS(Replace(LastPost,"'",""))&"' where boardid="&Dvbbs.BoardID)
End If
End If
End If
End If
'取得当前主题最后回复id,如果本帖为最后回复则更新相应数据
Set Rs=Dvbbs.Execute("select LastPost,istop from dv_topic where topicid="&rootid)
If Not (Rs.Eof And Rs.Bof) Then
istop=rs(1)
If Not Isnull(Rs(0)) And Rs(0)<>"" Then
LastTopic=split(rs(0),"$")
If Ubound(LastTopic)=7 Then
If Clng(LastTopic(1))=Clng(Announceid) Then
LastPost=LastTopic(0) & "$" & LastTopic(1) & "$" & Now() & "$" & Replace(cutStr(reubbcode(Contentdata),20),"$","$") & "$" & LastTopic(4) & "$" & LastTopic(5) & "$" & LastTopic(6) & "$" & Dvbbs.BoardID
dvbbs.execute("update dv_topic set LastPost='"&Replace(LastPost,"'","")&"' where topicid="&rootid)
End If
End If
End If
End If
Set Rs = Server.CreateObject("ADODB.Recordset")
SQL="SELECT * FROM "&TotalUseTable&" where AnnounceID="&Announceid&" And username='"&trim(username)&"'"
rs.Open SQL,conn,1,3
If Rs.EOF And Rs.BOF Then
If Not CanEditPost Then Dvbbs.AddErrCode(77)
ElseIf Not Dvbbs.master And rs("locktopic")=1 then
Dvbbs.AddErrCode(78)
Else
If Rs("parentid")=0 then
If istop=1 Then
If IsSqlDataBase=1 Then
dvbbs.execute("update dv_topic set title='"&topic&"',LastPostTime=dateadd(day,100,"&SqlNowString&"),TopicMode="&MyTopicMode&" where topicid="&rootid)
Else
dvbbs.execute("update dv_topic set title='"&topic&"',LastPostTime=dateadd('d',100,"&SqlNowString&"),TopicMode="&MyTopicMode&" where topicid="&rootid)
End If
ElseIf istop=3 Then
If IsSqlDataBase=1 Then
dvbbs.execute("update dv_topic set title='"&topic&"',LastPostTime=dateadd(day,300,"&SqlNowString&"),TopicMode="&MyTopicMode&" where topicid="&rootid)
Else
dvbbs.execute("update dv_topic set title='"&topic&"',LastPostTime=dateadd('d',300,"&SqlNowString&"),TopicMode="&MyTopicMode&" where topicid="&rootid)
End If
Else
dvbbs.execute("update dv_topic set title='"&topic&"',TopicMode="&MyTopicMode&" where topicid="&rootid)
End If
End If
Content = Html2Ubb(Content)
Rs("Topic") =Replace(Topic,"''","'")
rs("Body") =Replace(Content,"''","'")
rs("length")=Dvbbs.strlength(Content)
rs("ip")=Dvbbs.UserTrueIP
rs("Expression")=Expression
rs("signflag")=signflag
rs("emailflag")=mailflag
If Rs("isupload")=0 And ihaveupfile=1 Then Rs("isupload")=1
Dim UbblistBody
UbblistBody = Ubblist(Content)
Rs("Ubblist")=UbblistBody
rs.Update
If ihaveupfile=1 Then dvbbs.execute("update dv_upfile set F_AnnounceID='"&rootid&"|"&AnnounceID&"',F_Readme='"&Replace(Rs("Topic"),"'","''")&"',F_flag=0 where F_ID in ("&upfileinfo&")")
End If
Rs.Close
Set Rs=Nothing
Dvbbs.ShowErr()
End Sub
'更新版面数据和缓存
Public Sub UpDate_BoardInfoAndCache()
Dim UpdateBoardID
If Dvbbs.Board_Data(3,0)<> "" Then
UpdateBoardID=Dvbbs.Board_Data(3,0) & "," & Dvbbs.BoardID
Else
UpdateBoardID=Dvbbs.BoardID
End If
Dim updateboard,i
updateboard=Split(UpdateBoardID,",")
If Action = 6 Then
SQL="update Dv_board set PostNum=PostNum+1,todaynum=todaynum+1,LastPost='"&SimEncodeJS(LastPost_1)&"' where boardid in ("&UpdateBoardID&")"
ElseIf Action = 5 Or Action = 7 Then
SQL="update Dv_board set PostNum=PostNum+1,TopicNum=TopicNum+1,todaynum=todaynum+1,LastPost='"&SimEncodeJS(LastPost_1)&"' where boardid in ("&UpdateBoardID&")"
End If
Dvbbs.Execute(sql)
For i= 0 to UBound(updateboard)
Dvbbs.ReloadBoardCache updateboard(i),1,9,1'版面ID,发贴数,最后一个参数是1 表示相加
If Not Action = 6 Then Dvbbs.ReloadBoardCache updateboard(i),1,10,1'主题数
Dvbbs.ReloadBoardCache updateboard(i),1,12,1'今日贴
Dvbbs.ReloadBoardCache updateboard(i),LastPost_1,14,0
Next
End Sub
Public Sub UpDate_ForumInfoAndCache()
Dim updateinfo,LastPostTime
Dim Forum_LastPost,Forum_TodayNum,Forum_MaxPostNum
Forum_LastPost=Dvbbs.CacheData(15,0)
Forum_TodayNum=Dvbbs.CacheData(9,0)
Forum_MaxPostNum=Dvbbs.CacheData(12,0)
LastPostTimes=split(Forum_LastPost,"$")
LastPostTime=LastPostTimes(2)
If Not IsDate(LastPostTime) Then LastPostTime=Now()
If datediff("d",LastPostTime,Now())=0 Then
If CLng(Forum_TodayNum)+1 > CLng(Forum_MaxPostNum) Then
updateinfo=",Forum_MaxPostNum=Forum_TodayNum+1,Forum_MaxPostDate="&SqlNowString&""
Dvbbs.ReloadSetupCache Now(),13
Dvbbs.ReloadSetupCache CLng(Forum_TodayNum)+1,12
End If
Dvbbs.ReloadSetupCache CLng(Forum_TodayNum)+1,9
If Action = 6 Then
SQL="update Dv_setup set Forum_PostNum=Forum_PostNum+1,Forum_TodayNum=Forum_TodayNum+1,Forum_LastPost='"&LastPost&"' "&updateinfo&" "
Else
SQL="update Dv_setup set Forum_TopicNum=Forum_TopicNum+1,Forum_PostNum=Forum_PostNum+1,Forum_TodayNum=Forum_TodayNum+1,Forum_LastPost='"&LastPost&"' "&updateinfo&" "
End If
Else
If Action = 6 Then
SQL="update Dv_setup set Forum_PostNum=Forum_PostNum+1,forum_YesTerdayNum="&CLng(Forum_TodayNum)&",Forum_TodayNum=1,Forum_LastPost='"&LastPost&"' "
Else
SQL="update Dv_setup set Forum_TopicNum=Forum_TopicNum+1,Forum_PostNum=Forum_PostNum+1,forum_YesTerdayNum="&CLng(Forum_TodayNum)&",Forum_TodayNum=1,Forum_LastPost='"&LastPost&"' "
End If
Dvbbs.ReloadSetupCache 1,9
End If
'更新总固顶部分数据和缓存
If Not Action = 6 Then
If Myistop=2 Then
Dim tmpstr
If Dvbbs.CacheData(28,0)="" Then
tmpstr=", Forum_alltopnum='"&RootID&"'"
Dvbbs.ReloadSetupCache RootID,28
Else
tmpstr=", Forum_alltopnum='"&Dvbbs.CacheData(28,0)&","&RootID&"'"
Dvbbs.ReloadSetupCache Dvbbs.CacheData(28,0)&","&RootID,28
End If
SQL=SQl&tmpstr
End If
Dvbbs.ReloadSetupCache CLng(Dvbbs.CacheData(7,0))+1,7'主题数
End If
Dvbbs.ReloadSetupCache CLng(Dvbbs.CacheData(8,0))+1,8'文章数
Dvbbs.ReloadSetupCache LastPost,15
Dvbbs.Execute(SQL)
End Sub
Public Sub succeed()
Dim TempStr,PostRetrunName,tourl,returnurl
If IsAudit=1 And Action <> 8 Then Dvbbs.BoardID=LockTopic
Dvbbs.Stats = Dvbbs.Stats & template.Strings(20)
TempStr = template.html(8)
Select case Dvbbs.Board_Setting(17)
case "1"
tourl = "index.asp"
PostRetrunName=template.Strings(13)
case "2"
tourl="list.asp?boardid="&Dvbbs.boardid
PostRetrunName=template.Strings(14)
case "3"
If IsAudit=1 And Action <> 8 Then
tourl="list.asp?boardid="&Dvbbs.boardid
If IsAuditcheck=1 Then
PostRetrunName="由于您发表的贴子含敏感内容,您的贴子需要管理员审核过才可以见到。"
Else
PostRetrunName=template.Strings(19)
End If
Else
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -