📄 update.asp
字号:
'Set Trs=Dvbbs.Execute("Select Sum(PostNum),Sum(TopicNum),Sum(TodayNum),Count(*) From Dv_board Where (Not BoardID="&SQL(0,i)&") And RootID="&SQL(0,i))
Else
ParentStr=SQL(3,i) & "," & SQL(0,i)
'Set Trs=Dvbbs.Execute("Select Sum(PostNum),Sum(TopicNum),Sum(TodayNum),Count(*) From Dv_board Where ParentStr Like '%"&ParentStr&"%'")
End If
Set Trs=Dvbbs.Execute("Select Sum(PostNum),Sum(TopicNum),Sum(TodayNum),Count(*) From Dv_board Where ParentStr Like '%"&ParentStr&"%'")
If Not (Trs.Eof And Trs.Bof) Then
'如果该版面允许发贴,则帖子数应该是该版面贴数+下属版面帖子数
If reBoard_Setting(43)="0" Then
If Not IsNull(Trs(0)) Then AllArticle = Trs(0) + AllArticle
If Not IsNull(Trs(1)) Then AllTopic = Trs(1) + AllTopic
If Not IsNull(Trs(2)) Then AllToday = Trs(2) + AllToday
If Not IsNull(Trs(3)) Then AllBoard = Trs(3) + AllBoard
Else
AllArticle=Trs(0)
AllTopic=Trs(1)
AllToday=Trs(2)
AllBoard=Trs(3)
If IsNull(AllArticle) Then AllArticle=0
If IsNull(AllTopic) Then AllTopic=0
If IsNull(AllToday) Then AllToday=0
If IsNull(AllBoard) Then AllBoard=0
End If
End If
Set Trs=Nothing
'下属版块ID
ParentStr = Sql(0,i)
Set Trs = Dvbbs.Execute("SELECT Boardid FROM Dv_Board WHERE ParentID = "&Sql(0,i))
If Not (Trs.Eof And Trs.Bof) Then
Do While Not Trs.Eof
ParentStr = ParentStr & "," & Trs(0)
Trs.Movenext
Loop
End If
Set Trs=Nothing
'最后回复信息
Set Trs=Dvbbs.Execute("Select Top 1 LastPost,TopicID,Title,PostTable From Dv_Topic Where BoardID In ("&ParentStr&") Order by LastPostTime Desc")
If Not (Trs.Eof And Trs.Bof) Then
LastPostArr = Split(Trs(0),"$")
If UBound(LastPostArr)<>7 Then
ReDim LastPostArr(7)
LastPostArr(1)=Trs(3)
LastPostArr(3)= Replace(cutStr(Trs(2),20),"$","$")
LastPostArr(6)=Trs(1)
Trs.Close:Set Trs=Nothing
Set Trs = Dvbbs.Execute("Select Top 1 AnnounceID,BoardID,UserName,DateAndTime,PostUserID From "&LastPostArr(1)&" Where RootID="&LastPostArr(6)&" Order by DateAndTime")
If Not (Trs.Eof And Trs.Bof) Then
LastPostArr(0) = Trs(2)
LastPostArr(1) = Trs(0)
LastPostArr(2) = Trs(3)
LastPostArr(4) = ""
LastPostArr(5) = Trs(4)
LastPostArr(7) = Trs(1)
Else
LastPostArr(0) = "无"
LastPostArr(1) = 0
LastPostArr(2) = now()
LastPostArr(3) = "无"
LastPostArr(4) = ""
LastPostArr(5) = ""
LastPostArr(6) = ""
LastPostArr(7) = ""
End if
Else
LastPostArr(3)= Replace(cutStr(Trs(2),20),"$","$")
End if
Trs.Close:Set Trs=Nothing
LastPost=Join(LastPostArr,"$")
LastPost=Replace(Dvbbs.Replacehtml(LastPost&""),"'","''")
'LastPost=Replace(Dvbbs.Replacehtml(Trs(0)&""),"'","''")
Else
Trs.Close:Set Trs=Nothing
LastPost="无$0$"&Now()&"$无$$$$"
End If
'更新版面数据
'SLastPost = Split(LastPost,"$")
'If Ubound(SLastPost) < 7 Then LastPost = LastPost & "$"
Dvbbs.Execute("Update [Dv_board] Set PostNum="&AllArticle&",TopicNum="&AllTopic&",TodayNum="&AllToday&",LastPost='"&Dvbbs.ChkBadWords(LastPost)&"' Where BoardID="&SQL(0,i))
End If
'更新IsGroupSetting
'IsGroupSetting=SQL(7,i)
'Set Trs=Dvbbs.Execute("Select Count(*) From Dv_UserAccess Where uc_BoardID="&SQL(0,i))
'UserAccessCount = Trs(0)
'If IsNull(UserAccessCount) Or UserAccessCount="" Then UserAccessCount=0
'If UserAccessCount>0 Then UpGroupSetting="0"
'Set Trs=Dvbbs.Execute("Select GroupID From Dv_BoardPermission Where BoardID="&SQL(0,i))
'If Not Trs.Eof Then
' Do While Not Trs.Eof
' If UpGroupSetting="" Then
' UpGroupSetting = Trs(0)
' Else
' UpGroupSetting = UpGroupSetting & "," & Trs(0)
' End If
' Trs.MoveNext
' Loop
'End If
'更新和清理固顶贴数据(固顶和区域固顶)
'Set Trs=Dvbbs.Execute("Select TopicID From Dv_Topic Where BoardID="&Rs(0)&" And IsTop In (1,2)")
If Not IsNull(SQL(6,i)) And SQL(6,i)<>"" Then
Set Trs=Dvbbs.Execute("Select TopicID,BoardID,IsTop From Dv_Topic Where TopicID In ("&SQL(6,i)&")")
If tRs.Eof And tRs.Bof Then
BoardTopStr=""
Else
Do While Not Trs.Eof
If Trs(1)<>444 And Trs(1)<>777 And Trs(2)>0 And Trs(2)<>3 Then
If BoardTopStr="" Then
BoardTopStr = Trs(0)
Else
BoardTopStr = BoardTopStr & "," & Trs(0)
End If
End If
Trs.MoveNext
Loop
End If
End If
Dvbbs.Execute("Update Dv_Board Set BoardTopStr='"&BoardTopStr&"' Where BoardID="&SQL(0,i))
UserAccessCount=""
IsGroupSetting=""
UpGroupSetting=""
BoardTopStr=""
ii=ii+1
'If (i mod 100) = 0 Then
Response.Write "<script>img2.width=" & Fix((ii/C1) * 400) & ";" & VbCrLf
Response.Write "txt2.innerHTML=""" & FormatNumber(ii/C1*100,4,-1) & """;" & VbCrLf
Response.Write "img2.title=""" & SQL(0,i) & "(" & ii & ")"";</script>" & VbCrLf
Response.Flush
'End If
body="<table cellpadding=0 cellspacing=0 border=0 width=100% align=center><tr><td colspan=2 class=td1>更新论坛数据成功,"&SQL(1,i)&"共有"&AllArticle&"篇贴子,"&AllTopic&"篇主题,今日有"&AllToday&"篇帖子。</td></tr></table>"
Response.Write body
Response.Flush
'Rs.MoveNext
'Loop
Next
Set Trs=Nothing
End If
body=""
Response.Write "<script>img2.width=400;txt2.innerHTML=""100"";</script>"
Dvbbs.loadSetup()
Dim Board
Dvbbs.LoadBoardList()
For Each board in Application(Dvbbs.CacheName&"_boardlist").documentElement.selectNodes("board/@boardid")
Dvbbs.LoadBoardData board.text
Dvbbs.LoadBoardinformation board.text
Next
End Sub
Rem 统计下属论坛函数 2004-5-3 Dvbbs.YangZheng
Sub Boardchild()
Dim cBoardNum, cBoardid
Dim Trs,rs,Sql,i
Dim Bn
Dvbbs.Execute("UPDATE Dv_Board SET Child = 0")
Set Rs = Dvbbs.Execute("SELECT Boardid, Rootid, ParentID, Depth, Child, ParentStr FROM Dv_Board ORDER BY Boardid DESC")
If Not (Rs.Eof And Rs.Bof) Then
Sql = Rs.GetRows(-1)
Rs.Close:Set Rs = Nothing
For Bn = 0 To Ubound(Sql,2)
If Isnull(Sql(4,Bn)) And Cint(Sql(3,Bn)) > 0 Then
Dvbbs.Execute("UPDATE Dv_Board SET Child = 0 WHERE Boardid = " & Sql(0,Bn))
End If
If Cint(Sql(2,Bn)) = 0 And Cint(Sql(3,Bn)) = 0 Then
Set Trs = Dvbbs.Execute("SELECT COUNT(*) FROM Dv_Board WHERE RootID = " & Sql(1,Bn))
Cboardnum = Trs(0) - 1
Trs.Close:Set Trs = Nothing
If Isnull(Cboardnum) Or Cboardnum < 0 Then Cboardnum = 0
Dvbbs.Execute("UPDATE Dv_Board SET Child = " & Cboardnum & " WHERE Boardid = " & Sql(0,Bn))
Elseif Cint(Sql(3,Bn)) > 1 Then
cBoardid = Split(Sql(5,Bn),",")
For i = 1 To Ubound(cBoardid)
Dvbbs.Execute("UPDATE Dv_Board SET Child = Child + 1 WHERE Boardid = " & cBoardid(i))
Next
End If
Next
End If
End Sub
Sub Updateall()
'主题数,帖子数,用户数,今日贴,昨日贴,总固顶,最后注册
Body = "<tr><td colspan=2 class=td1>更新总论坛数据成功。"
Dim AllTopNum,PostNum,TopicNum,LastUser
Dim TodayNum,UserNum, YesterdayNum,SqlStr,Sql_a,sql
If Request.Form("u1") = "1" Or Request("index")="1" Then
TopicNum = GetTopicnum()
If Sql_a = "" Then
Sql_a = "Forum_TopicNum = " & TopicNum & ""
Else
Sql_a = Sql_a & ",Forum_TopicNum = " & TopicNum & ""
End If
If SqlStr = "" Then
SqlStr = "论坛共有 " & TopicNum & " 篇主题"
Else
SqlStr = SqlStr & "," & TopicNum & " 篇主题"
End If
End If
If Request.Form("u2") = "1" Or Request("index")="1" Then
PostNum = Announcenum()
If Sql_a = "" Then
Sql_a = "Forum_PostNum = " & PostNum & ""
Else
Sql_a = Sql_a & ",Forum_PostNum = " & PostNum & ""
End If
If SqlStr = "" Then
SqlStr = "论坛共有 " & PostNum & " 篇帖子"
Else
SqlStr = SqlStr & "," & PostNum & " 篇帖子"
End If
End If
If Request.Form("u3") = "1" Or Request("index")="1" Then
UserNum = Allusers()
If Sql_a = "" Then
Sql_a = "Forum_UserNum = " & UserNum & ""
Else
Sql_a = Sql_a & ",Forum_UserNum = " & UserNum & ""
End If
If SqlStr = "" Then
SqlStr = "论坛共有 " & UserNum & " 个用户"
Else
SqlStr = SqlStr & "," & UserNum & " 个用户"
End If
End If
If Request.Form("u4") = "1" Or Request("index")="1" Then
TodayNum = Alltodays()
If Sql_a = "" Then
Sql_a = "Forum_TodayNum = " & TodayNum & ""
Else
Sql_a = Sql_a & ",Forum_TodayNum = " & TodayNum & ""
End If
If SqlStr = "" Then
SqlStr = "论坛共有 " & TodayNum & " 篇今日帖"
Else
SqlStr = SqlStr & "," & TodayNum & " 篇今日帖"
End If
End If
If Request.Form("u5") = "1" Or Request("index")="1" Then
YesterdayNum = Allyesterdays()
If Sql_a = "" Then
Sql_a = "Forum_YesterdayNum = " & YesterdayNum & ""
Else
Sql_a = Sql_a & ",Forum_YesterdayNum = " & YesterdayNum & ""
End If
If SqlStr = "" Then
SqlStr = "论坛共有 " & YesterdayNum & " 篇昨日帖"
Else
SqlStr = SqlStr & "," & YesterdayNum & " 篇昨日帖"
End If
End If
If Request.Form("u6") = "1" Or Request("index")="1" Then
AllTopNum = Forum_AllTopNum()
If Sql_a = "" Then
Sql_a = "Forum_AllTopNum = '" & AllTopNum & "'"
Else
Sql_a = Sql_a & ",Forum_AllTopNum = '" & AllTopNum & "'"
End If
If SqlStr = "" Then
SqlStr = "论坛共有 " & UBound(Split(AllTopNum, ",")) + 1 & " 个固顶主题"
Else
SqlStr = SqlStr & "," & UBound(Split(AllTopNum, ",")) + 1 & " 个固顶主题"
End If
End If
If Request.Form("u7") = "1" Or Request("index")="1" Then
LastUser = Newuser()
If Sql_a = "" Then
Sql_a = "Forum_lastUser = '" & Dvbbs.CheckStr(Dvbbs.HtmlEncode(LastUser)) & "'"
Else
Sql_a = Sql_a & ",Forum_lastUser = '" & Dvbbs.CheckStr(Dvbbs.HtmlEncode(LastUser)) & "'"
End If
If SqlStr = "" Then
SqlStr = "论坛最新加入用户为 " & LastUser & ""
Else
SqlStr = SqlStr & ",最新加入用户为 " & LastUser & ""
End If
End If
Body = Body & SqlStr
Body = Body & "</td></tr>"
If Sql_a = "" Then Exit Sub
Sql = "UPDATE Dv_Setup SET " & Sql_a
Dvbbs.Execute(Sql)
Dvbbs.Name="setup"
Dvbbs.loadSetup()
End sub
Sub fixtopic()
if not isnumeric(request.form("beginid")) then
body="<tr><td colspan=2 class=td1>错误的开始参数!</td></tr>"
exit sub
End If
if not isnumeric(request.form("endid")) then
body="<tr><td colspan=2 class=td1>错误的结束参数!</td></tr>"
exit sub
end if
if clng(request.form("beginid"))>clng(request.form("endid")) then
body="<tr><td colspan=2 class=td1>开始ID应该比结束ID小!</td></tr>"
exit sub
end if
dim TotalUseTable,Ers,sql,rs,i
dim username,dateandtime,rootid,announceid,postuserid,lastpost,topic
'set rs=server.createobject("adodb.recordset")
'Dvbbs.Execute("update Dv_topic set PostTable='dv_bbs1'")
Dim C1
C1=clng(request.form("endid"))-clng(request.form("beginid"))
%>
</table>
<BR>
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
<tr><td colspan=2 class=td1>
下面开始更新论坛帖子资料,预计本次共有<%=C1%>个帖子需要更新
<table width="400" border="0" cellspacing="1" cellpadding="1">
<tr>
<td bgcolor=#000000>
<table width="400" border="0" cellspacing="0" cellpadding="1">
<tr>
<td bgcolor=#ffffff height=9><img src="../skins/default/bar/bar3.gif" width=0 height=16 id=img2 name=img2 align=absmiddle></td></tr></table>
</td></tr></table> <span id=txt2 name=txt2 style="font-size:9pt">0</span><span style="font-size:9pt">%</span></td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="100%" align="center">
<%
Response.Flush
sql="select topicid,PostTable from Dv_topic where topicid>="&request.form("beginid")&" and topicid<="&request.form("endid")
set rs=Dvbbs.Execute(sql)
if rs.eof and rs.bof then
body="<tr><td colspan=2 class=td1>已经到记录的最尾端,请结束更新!</td></tr>"
exit sub
end if
do while not rs.eof
sql="select top 1 username,dateandtime,topic,Announceid,PostUserID,rootid,body,boardid from "&rs(1)&" where rootid="&rs(0)&" order by Announceid desc"
set ers=Dvbbs.Execute(sql)
if not (ers.eof and ers.bof) then
username=Ers("username")
dateandtime=Ers("dateandtime")
rootid=Ers("rootid")
topic=left(Ers("body"),20)
Announceid=ers("Announceid")
postuserid=ers("postuserid")
LastPost=username & "$" & Announceid & "$" & dateandtime & "$" & replace(topic,"$","") & "$$" & postuserid & "$" & rootid & "$" & ers("BoardID") & "$"
LastPost=Dvbbs.Checkstr(LastPost)
Dvbbs.Execute("update [DV_topic] set LastPost='"&replace(LastPost,"'","")&"' where topicid="&rs(0))
i=i+1
'If (i mod 100) = 0 Then
Response.Write "<script>img2.width=" & Fix((i/C1) * 400) & ";" & VbCrLf
Response.Write "txt2.innerHTML=""更新完"&server.htmlencode(ers(2)&"")&"的数据,正在更新下一个帖子数据," & FormatNumber(i/C1*100,4,-1) & """;" & VbCrLf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -