📄 wap_post.asp
字号:
<!--#include file="Conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!--#include file="inc/Class_Mobile.asp"-->
<!--#include file="inc/ubblist.asp"-->
<%
Dim Topic,Body,ID,RootID,AnnounceID,ParentID,FoundErr
Dim BoardInfo
Dim DateTimeStr,Expression,MyLastPostTime,TotalUseTable,layer,orders,LastPost,LastPost_1
Dim UbblistBody
Dim OpType
Dim Toptopic,uploadpic_n,IsAudit
Dim IsTop,Child,smsuserlist
Dim Tools_LastPostTime,Tools_UseTools
Dim Myistop
Myistop=0
OpType = DvbbsWap.ChkNumeric(Trim(Request("optype")))
FoundErr = False
'http://dvbbs1:81/wap_Post.asp?path=/119/1/4938/&Stype=4&optype=4&Mobile=1234567890123&name=&content=12356789102
'http://dvbbs1:81/wap_Post.asp?path=/119/1/&Stype=3&optype=3&Mobile=1234567890123&name=&content=12356789102
DvbbsWap.ShowXMLStar
If DvbbsWap.Stype<3 or Dvbbs.UserID=0 or DvbbsWap.PathCount<2 or OpType<3 Then
DvbbsWap.ShowErr 0,"参数错误,请确认从有效的地址访问!"
Else
PostData
CheckBoard
ChkPostData
Select case OpType
Case 3 : SaveData_New
Case 4 : SaveData_Reply
Case 5 : SaveData_Edit
End Select
End If
DvbbsWap.ShowXMLEnd
'获取提交数据
Sub PostData()
Topic = DvbbsWap.Checkstr(Request("Name"))
Body = DvbbsWap.Checkstr(Request("content"))
If Body = "" Then
DvbbsWap.ShowErr 0,"内容不能为空!"
FoundErr = True
Exit Sub
End If
If OpType=3 and DvbbsWap.Stype=3 Then '发表
Dvbbs.BoardID = DvbbsWap.ChkNumeric(DvbbsWap.Path(DvbbsWap.PathCount-1))
ElseIf OpType=4 and DvbbsWap.Stype=4 Then '回复主题
Dvbbs.BoardID = DvbbsWap.ChkNumeric(DvbbsWap.Path(DvbbsWap.PathCount-2))
ID = DvbbsWap.ChkNumeric(DvbbsWap.Path(DvbbsWap.PathCount-1)) '主题ID
RootID = ID
ElseIf OpType=5 and DvbbsWap.Stype=4 and DvbbsWap.PathCount>2 Then '编辑
Dvbbs.BoardID = DvbbsWap.ChkNumeric(DvbbsWap.Path(DvbbsWap.PathCount-3))
RootID = DvbbsWap.ChkNumeric(DvbbsWap.Path(DvbbsWap.PathCount-2))
ID = DvbbsWap.ChkNumeric(DvbbsWap.Path(DvbbsWap.PathCount-1))
Else
DvbbsWap.ShowErr 0,"参数错误,操作终止!"
FoundErr = True
Exit Sub
End If
If Dvbbs.BoardID=0 Then
DvbbsWap.AddErrCode(29)
FoundErr = True
Exit Sub
End If
If OpType>3 and (ID=0 Or RootID=0) Then
DvbbsWap.ShowErr 0,"帖子参数错误!"
FoundErr = True
Exit Sub
End If
End Sub
'获取版块信息及权限
Sub CheckBoard()
If FoundErr Then Exit Sub
Dim Rs,Sql
Sql = "Select BoardID,BoardType,Child,Readme,BoardMaster,BoardUser,Board_User,Board_Setting,IsGroupSetting From Dv_board where BoardID="&Dvbbs.BoardID
Set Rs = Dvbbs.Execute(Sql)
If not Rs.Eof Then
BoardInfo = Rs.GetRows(1)
Else
DvbbsWap.ShowErr 0,"错误的版面参数!"
FoundErr = True
Exit Sub
End If
Rs.Close
Set Rs = Nothing
DvbbsWap.LoadBoardPass
''''版块权限,用户组是否有自定义权限,是否版主,是否认证等权限(待加)
End Sub
'发表验证
Sub ChkPostData()
If FoundErr Then Exit Sub
If Dvbbs.Board_Setting(43)="1" Then
DvbbsWap.AddErrCode(72)
FoundErr = True
Exit Sub
End If
If Dvbbs.Board_Setting(1)="1" and Dvbbs.GroupSetting(37)="0" Then
Dvbbs.AddErrCode(26)
FoundErr = True
Exit Sub
End If
If Dvbbs.UserID>0 Then
If Clng(Dvbbs.GroupSetting(52))>0 And DateDiff("s",Dvbbs.UserSession.documentElement.selectSingleNode("userinfo/@joindate").text(14),Now)<Clng(Dvbbs.GroupSetting(52))*60 Then
DvbbsWap.ShowErr 0,"新注册用户在"&Dvbbs.GroupSetting(52)&"分钟内不能发言。"
FoundErr = True
Exit Sub
End If
If Dvbbs.GroupSetting(62)<>"0" And Not OpType=5 Then
If Clng(Dvbbs.GroupSetting(62))<=Clng(Dvbbs.UserToday(0)) Then
DvbbsWap.ShowErr 0,"你的今日发帖数已超出了最大限制"&Dvbbs.GroupSetting(62)&"篇"
FoundErr = True
Exit Sub
End If
End If
End If
If Dvbbs.GroupSetting(3)="0" And OpType=3 Then
DvbbsWap.AddErrCode(28)
FoundErr = True
Exit Sub
End If
If Dvbbs.GroupSetting(5)="0" And OpType=5 Then
DvbbsWap.AddErrCode(29)
FoundErr = True
Exit Sub
End If
If Len(Topic)>250 Then Topic = Left(DvbbsWap.ForMatHtml(Topic),255)
'Body = DvbbsWap.ForMatHtml(Body)
DateTimeStr=Replace(Replace(CSTR(NOW()+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午","")
Expression = "face1.gif"
MyLastPostTime=Replace(Replace(CSTR(NOW()+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午","")
TotalUseTable = Dvbbs.NowUseBBS
If Dvbbs.strLength(topic)> CLng(Dvbbs.Board_Setting(45)) Then
DvbbsWap.ShowErr 0,"主题不能超过该版限制"&Dvbbs.Board_Setting(45)&"个字符!"
FoundErr = True
Exit Sub
End If
If Dvbbs.strLength(Body) > CLng(Dvbbs.Board_Setting(16)) Then
DvbbsWap.ShowErr 0,"内容不能超过该版限制"&Dvbbs.Board_Setting(16)&"个字符!"
FoundErr = True
Exit Sub
End If
If Dvbbs.strLength(Body) < CLng(Dvbbs.Board_Setting(52)) Then
DvbbsWap.ShowErr 0,"内容不能少于该版限制"&Dvbbs.Board_Setting(52)&"个字符!"
FoundErr = True
Exit Sub
End If
If Dvbbs.GroupSetting(64)="1" Then
IsAudit=0
Else
If Dvbbs.Board_Setting(57)="1" Then
IsAudit=NeedIsAudit(Body)
End If
End If
End Sub
'保存数据=================================================
'发表
Sub SaveData_New()
If FoundErr Then Exit Sub
If Topic = "" Then
DvbbsWap.ShowErr 0,"主题不能为空!"
FoundErr = True
Exit Sub
End If
layer = 1
orders = 0
ParentID = 0
Insert_To_Topic()
Insert_To_Announce()
UpdateData
'更新版块发帖数,论坛统计,用户积分
DvbbsWap.ShowErr 1,"发表成功!"
End Sub
'回复
Sub SaveData_Reply()
If FoundErr Then Exit Sub
Get_SaveRe_TopicInfo
If FoundErr Then Exit Sub
Get_ForumTreeCode
If FoundErr Then Exit Sub
Insert_To_Announce
UpdateData
DvbbsWap.ShowErr 1,"回复成功!"
End Sub
Sub UpdateData()
Dim Sql
topic=Replace(Replace(cutStr(topic,14),chr(10),""),"'","")
If topic="" Then
topic=Body
topic=Replace(cutStr(topic,14),chr(10),"")
Else
topic=Replace(cutStr(topic,14),chr(10),"")
End If
LastPost=Replace(Dvbbs.MemberName,"$","") & "$" & AnnounceID & "$" & DateTimeStr & "$" & Replace(cutStr(topic,20),"$","$") & "$" & uploadpic_n & "$" & Dvbbs.UserID & "$" & RootID & "$" & Dvbbs.BoardID
LastPost=reubbcode(Replace(LastPost,"'",""))
LastPost=Dvbbs.ChkBadWords(LastPost)
If IsAudit<>1 Then
Dim IsUpDateLastPostTime
IsUpDateLastPostTime = False
If istop>0 Or InStr("," & Tools_UseTools & ",",",13,")>0 Or InStr("," & Tools_UseTools & ",",",14,")>0 Then IsUpDateLastPostTime = True
If OpType = 4 Then
If istop=3 And IsUpDateLastPostTime Then
If IsSqlDataBase=1 Then
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd(day,300,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
Else
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd('d',300,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
End If
ElseIf istop=2 And IsUpDateLastPostTime Then
If IsSqlDataBase=1 Then
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd(day,200,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
Else
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd('d',200,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
End If
ElseIf istop=1 And IsUpDateLastPostTime Then
If IsSqlDataBase=1 Then
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd(day,100,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
Else
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd('d',100,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
End If
ElseIf IsUpDateLastPostTime Then
If DateDiff("h",Now(),Tools_LastPostTime)<=0 Then
SQL="update Dv_topic set child=child+1,LastPostTime="&SqlNowString&",LastPost='"&LastPost&"' where TopicID="&RootID
Else
SQL="update Dv_topic set child=child+1,LastPost='"&LastPost&"' where TopicID="&RootID
End If
Else
SQL="update Dv_topic set child=child+1,LastPostTime="&SqlNowString&",LastPost='"&LastPost&"' where TopicID="&RootID
End If
Dvbbs.Execute(SQL)
'Child=Child+2
'If Child mod Dvbbs.Board_Setting(27)=0 Then
' star=Child\Dvbbs.Board_Setting(27)
'Else
' star=(Child\Dvbbs.Board_Setting(27))+1
'End If
'Get_Chan_TopicOrder()
Else
Dvbbs.Execute("update Dv_topic set LastPost='"&LastPost&"' where topicid="&RootID)
End If
End If
If OpType = 3 Then
toptopic=Replace(topic,"$","$")
Else
toptopic=Replace(cutStr(toptopic,20),"$","$")
End If
If Dvbbs.Board_Setting(2)="1" Then
LastPost_1="保密$" & AnnounceID & "$" & DateTimeStr & "$请认证用户进入查看$" & uploadpic_n & "$" & Dvbbs.UserID & "$" & RootID & "$" & Dvbbs.BoardID
Else
LastPost_1=Replace(Dvbbs.MemberName,"$","") & "$" & AnnounceID & "$" & DateTimeStr & "$" & toptopic & "$" & uploadpic_n & "$" & Dvbbs.UserID & "$" & RootID & "$" & Dvbbs.BoardID
End If
LastPost_1=reubbcode(Replace(LastPost_1,"'",""))
LastPost_1=Dvbbs.ChkBadWords(LastPost_1)
If IsAudit=0 Then
UpDate_BoardInfoAndCache()
UpDate_ForumInfoAndCache()
End If
End Sub
'更新版面数据和缓存
Sub UpDate_BoardInfoAndCache()
Dim Sql
Dim UpdateBoardID
If Application(Dvbbs.CacheName&"_boardlist").documentElement.selectSingleNode("board[@boardid='"&Dvbbs.BoardID&"']/@parentstr").text <> "" Then
UpdateBoardID=Application(Dvbbs.CacheName&"_boardlist").documentElement.selectSingleNode("board[@boardid='"&Dvbbs.BoardID&"']/@parentstr").text & "," & Dvbbs.BoardID
Else
UpdateBoardID=Dvbbs.BoardID
End If
If OpType = 4 Then
SQL="update Dv_board set PostNum=PostNum+1,todaynum=todaynum+1,LastPost='"&SimEncodeJS(LastPost_1)&"' where boardid in ("&UpdateBoardID&")"
ElseIf OpType = 3 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)
Dvbbs.ReloadBoardInfo(UpdateBoardID)
End Sub
Sub UpDate_ForumInfoAndCache()
Dim Sql
Dim updateinfo,LastPostTime,LastPostTimes
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 OpType = 4 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 OpType = 4 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 OpType = 4 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
Sub Get_SaveRe_TopicInfo()
Dim Rs,Sql
SQL="select locktopic,LastPost,title,smsuserlist,IsSmsTopic,istop,Child,UseTools,LastPostTime,GetMoneyType,PostUserID, DateAndTime from Dv_topic where BoardID="&Dvbbs.BoardID&" And topicid="&cstr(RootID)
Set Rs=dvbbs.Execute(sql)
If Not (Rs.EOF And Rs.BOF) Then
toptopic = Rs(2)
istop = Rs(5)
Child = Rs(6)
Tools_UseTools = "," & Rs(7) & ","
Tools_LastPostTime = Rs(8)
'If Rs("IsSmsTopic")=1 Then smsuserlist=Rs("smsuserlist")
If Rs("LockTopic")=1 And Not (Dvbbs.Master Or Dvbbs.BoardMaster Or Dvbbs.SuperBoardMaster) Then
DvbbsWap.AddErrCode(78)
FoundErr = True
Exit Sub
End If
'锁定多少天前的帖子判断 2004-9-16 Dv.Yz
If Ubound(Dvbbs.Board_Setting) > 70 And Not (Dvbbs.Master Or Dvbbs.BoardMaster Or Dvbbs.SuperBoardMaster) Then
If Not Clng(Dvbbs.Board_Setting(71)) = 0 And Datediff("d", Rs(11), Now()) > Clng(Dvbbs.Board_Setting(71)) Then
DvbbsWap.AddErrCode(78)
FoundErr = True
Exit Sub
End If
End If
If Not IsNull(Rs(1)) Then
LastPost=split(Rs(1),"$")
If ubound(LastPost)=7 Then
UpLoadPic_n=LastPost(4)
Else
UpLoadPic_n=""
End If
End If
If Cint(Rs(9)) = 5 Then
DvbbsWap.ShowErr 0,"主题已结帖,不允许回复。"
FoundErr = True
Exit Sub
End If
Else
DvbbsWap.ShowErr 0,"该帖子不存在!"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -