📄 admin_update.asp
字号:
<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/dv_clsother.asp" -->
<!-- #include file="inc/DvADChar.asp" -->
<!--#include file="inc/ubblist.asp"-->
<%
Head()
Server.ScriptTimeout=9999999
dim admin_flag
admin_flag="12,19"
if not Dvbbs.master or instr(","&session("flag")&",",",12,")=0 or instr(","&session("flag")&",",",19,")=0 then
Errmsg=ErrMsg + "<BR><li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登录</a>后进入。<br><li>您没有管理本页面的权限。"
dvbbs_error()
End If
dim tmprs
dim body
call main()
Footer()
sub main()
%>
<table cellpadding="0" cellspacing="0" border="0" width="95%" class="tableBorder" align=center>
<tr>
<th align=left colspan=2 height=23>论坛数据处理</th>
</tr>
<tr>
<td width="20%" class="forumrow" height=25>注意事项</td>
<td width="80%" class="forumrow">下面有的操作可能将非常消耗服务器资源,而且更新时间很长,请仔细确认每一步操作后执行。</td>
</tr>
<%
If request("action")="updat" Then
If request("submit")="更新论坛数据" Then
call updateboard()
ElseIf request("submit")="修 复" Then
call fixtopic()
Else
call updateall()
End If
If founderr Then
response.write errmsg
Else
response.write body
End If
ElseIf request("action")="fix" Then
Call Fixbbs()
If founderr Then
response.write errmsg
Else
response.write body
End If
ElseIf request("action")="delboard" then
if isnumeric(request("boardid")) then
Dvbbs.Execute("update dv_topic set boardid=444 where boardid="&request("boardid"))
for i=0 to ubound(AllPostTable)
Dvbbs.Execute("update "&AllPostTable(i)&" set boardid=444 where boardid="&request("boardid"))
next
end if
response.write "<tr><td align=left colspan=2 height=23 class=forumrow>清空论坛数据成功,请返回更新帖子数据!</td></tr>"
elseif request("action")="updateuser" then
%>
<FORM METHOD=POST ACTION="?action=updateuserinfo">
<tr>
<th align=left colspan=2 height=23>更新用户数据</th>
</tr>
<tr>
<td width="20%" class="forumrow">重新计算用户发贴</td>
<td width="80%" class="forumrow">执行本操作将按照<font color=red>当前论坛数据库</font>发贴重新计算所有用户发表帖子数量。</td>
</tr>
<tr>
<td width="20%" class="forumrow">开始用户ID</td>
<td width="80%" class="forumrow"><input type=text name="beginID" value="1" size=10> 用户ID,可以填写您想从哪一个ID号开始进行修复</td>
</tr>
<tr>
<td width="20%" class="forumrow">结束用户ID</td>
<td width="80%" class="forumrow"><input type=text name="endID" value="100" size=10> 将更新开始到结束ID之间的用户数据,之间的数值最好不要选择过大</td>
</tr>
<tr>
<td width="20%" class="forumrow"></td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="重新计算用户发贴"></td>
</tr>
</form>
<FORM METHOD=POST ACTION="?action=updateuserinfo">
<tr>
<td width="20%" class="forumrow" valign=top>更新用户等级</td>
<td width="80%" class="forumrow">执行本操作将按照<font color=red>当前论坛数据库</font>用户发贴数量和论坛的等级设置重新计算用户等级,本操作不影响等级为贵宾、版主、总版主的数据。</td>
</tr>
<tr>
<td width="20%" class="forumrow">开始用户ID</td>
<td width="80%" class="forumrow"><input type=text name="beginID" value="1" size=10> 用户ID,可以填写您想从哪一个ID号开始进行修复</td>
</tr>
<tr>
<td width="20%" class="forumrow">结束用户ID</td>
<td width="80%" class="forumrow"><input type=text name="endID" value="100" size=10> 将更新开始到结束ID之间的用户数据,之间的数值最好不要选择过大</td>
</tr>
<tr>
<td width="20%" class="forumrow"></td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="更新用户等级"></td>
</tr>
</form>
<FORM METHOD=POST ACTION="?action=updateuserinfo">
<tr>
<td width="20%" class="forumrow" valign=top>更新用户金钱/经验/魅力</td>
<td width="80%" class="forumrow">执行本操作将按照<font color=red>当前论坛数据库</font>用户的发贴数量和论坛的相关设置重新计算用户的金钱/经验/魅力,本操作也将重新计算贵宾、版主、总版主的数据<BR>注意:不推荐用户进行本操作,本操作在数据很多的时候请尽量不要使用,并且本操作对各个版面删除帖子等所扣相应分值不做运算,只是按照发贴和总的论坛分值设置进行运算,请大家慎重操作,<font color=red>而且本项操作将重置用户因为奖励、惩罚等原因管理员对用户分值的修改。</font></td>
</tr>
<tr>
<td width="20%" class="forumrow">开始用户ID</td>
<td width="80%" class="forumrow"><input type=text name="beginID" value="1" size=10> 用户ID,可以填写您想从哪一个ID号开始进行修复</td>
</tr>
<tr>
<td width="20%" class="forumrow">结束用户ID</td>
<td width="80%" class="forumrow"><input type=text name="endID" value="100" size=10> 将更新开始到结束ID之间的用户数据,之间的数值最好不要选择过大</td>
</tr>
<tr>
<td width="20%" class="forumrow"></td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="更新用户金钱/经验/魅力"></td>
</tr>
</FORM>
<%
elseif request("action")="updateuserinfo" then
if request("submit")="重新计算用户发贴" then
call updateTopic()
elseif request("submit")="更新用户等级" then
call updategrade()
else
call updatemoney()
end if
if founderr then
response.write errmsg
else
response.write body
end if
else
%>
<tr>
<th align=left colspan=2 height=23>更新论坛数据</th>
</tr>
<form action="admin_update.asp?action=updat" method=post>
<tr>
<td width="20%" class="forumrow">更新分论坛数据</td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="更新论坛数据"><BR><BR>这里将重新计算每个论坛的帖子主题和回复数,今日帖子,最后回复信息等,建议每隔一段时间运行一次。</td>
</tr>
<tr>
<td width="20%" class="forumrow">更新总论坛数据</td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="更新论坛总数据"><BR><BR>这里将重新计算整个论坛的帖子主题和回复数,今日帖子,最后加入用户等,建议每隔一段时间运行一次。</td>
</tr>
<tr>
<th align=left colspan=2 height=23>修复帖子(修复指定范围内帖子的最后回复数据)</th>
</tr>
<tr>
<td width="20%" class="forumrow">开始的ID号</td>
<td width="80%" class="forumrow"><input type=text name="beginID" value="1" size=10> 帖子主题ID,可以填写您想从哪一个ID号开始进行修复</td>
</tr>
<tr>
<td width="20%" class="forumrow">结束的ID号</td>
<td width="80%" class="forumrow"><input type=text name="EndID" value="1000" size=10> 将更新开始到结束ID之间的帖子数据,之间的数值最好不要选择过大</td>
</tr>
<tr>
<td width="20%" class="forumrow"></td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="修 复"></td>
</tr>
</form>
<form name=Fix action="admin_update.asp?action=fix" method=post>
<tr>
<th align=left colspan=2 height=23>修正贴子UBB标签(修复指定范围贴子UBB标签)</th>
</tr>
<tr>
<td width="20%" class="forumrow">开始的ID号</td>
<td width="80%" class="forumrow"><input type=text name="beginID" value="1" size=10> 帖子主题ID,可以填写您想从哪一个ID号开始进行修复</td>
</tr>
<tr>
<td width="20%" class="forumrow">结束的ID号</td>
<td width="80%" class="forumrow"><input type=text name="EndID" value="1000" size=10> 将更新开始到结束ID之间的帖子数据,之间的数值最好不要选择过大</td>
</tr>
<tr>
<td width="20%" class="forumrow">新老贴的标识日期</td>
<td width="80%" class="forumrow"><input type="text" name="updatedate" value="2003-12-1">(格式:YYYY-M-D) 就是论坛升级到v7.0的日期,如果不填写,一律按老贴处理</td>
</tr>
<tr>
<td width="20%" class="forumrow">去掉贴子中的HTML标记</td>
<td width="80%" class="forumrow">是 <input type="radio" name="killhtml" value="1">
否 <input type="radio" name="killhtml" value="0" checked> <br>选是的话,贴子中的HTML标记将会自动被清除,有利于减少数据库的大小,但是会失去原来的HTML效果。</td>
</tr>
<tr>
<td width="20%" class="forumrow"></td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="修 正"></td>
</tr>
</form>
<%
end if
%>
</table><BR><BR>
<%
end sub
sub updateboard()
'先按照所有版面ID得出帖子数,然后计算各个有下属论坛的帖子总和
Dim allarticle
Dim alltopic
Dim alltoday
Dim allboard
Dim trs,Esql,ars
Dim Maxid
Dim LastTopic,LastRootid,LastPostTime,LastPostUser
Dim LastPost,uploadpic_n,Lastpostuserid,Lastid
Dim ParentStr
Dim C,C1,C2
Dim reBoard_Setting,BoardTopStr,IsGroupSetting
Dim UserAccessCount,UpGroupSetting,ii
ii=0
'获得要更新的总数
If IsNumeric(request("boardid")) And request("boardid")<>"" Then
Set Rs=Dvbbs.Execute("Select Count(*) From [Dv_board] Where BoardID="&request("boardid"))
C1=rs(0)
If Isnull(C1) Then C1=0
Else
Set Rs=Dvbbs.Execute("Select Count(*) From [Dv_board]")
C1=rs(0)
If Isnull(C1) Then C1=0
End If
Set Rs=Nothing
%>
</table><BR>
<table cellpadding="0" cellspacing="0" border="0" width="95%" class="tableBorder" align=center>
<tr><td colspan=2 class=forumrow>
下面开始更新论坛版面资料,共有<%=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>
<%
Response.Flush
'排序按照Child和Orders,以便先更新下级论坛的数据才循环到上级版面,这时上级版面读取的就是下级版面的最新数据
If IsNumeric(request("boardid")) And request("boardid")<>"" Then
Set Rs=Dvbbs.Execute("Select BoardID,BoardType,Child,ParentStr,RootID,Board_Setting,BoardTopStr,IsGroupSetting From Dv_Board Where BoardID="&Request("BoardID"))
Else
Call Boardchild() '统计更新下属论坛个数 YZ-2004-2-26注
Set Rs=Dvbbs.Execute("Select BoardID,BoardType,Child,ParentStr,RootID,Board_Setting,BoardTopStr,IsGroupSetting From Dv_Board Order by Child,RootID,Orders Desc")
End If
Dim SQL
If Not Rs.EOF Then
SQL=Rs.GetRows(-1)
Set Rs=Nothing
For i=0 to UBound(SQL,2)
'Do While Not Rs.Eof
reBoard_Setting=Split(SQL(5,i),",")
'所有主题和帖子
Set Trs=Dvbbs.Execute("Select Count(*),Sum(Child) From Dv_Topic Where BoardID="&SQL(0,i))
AllTopic=Trs(0)
AllArticle=Trs(1)
If IsNull(AllTopic) Then AllTopic = 0
If IsNull(AllArticle) Then AllArticle = 0
AllArticle = AllArticle + AllTopic
Set Trs=Nothing
'所有今日贴
If IsSqlDataBase = 1 Then
Set Trs=Dvbbs.Execute("Select Count(*) From "&Dvbbs.NowUseBBS&" Where BoardID="&SQL(0,i)&" and datediff(d,dateandtime,"&SqlNowString&")=0")
Else
Set Trs=Dvbbs.Execute("Select Count(*) From "&Dvbbs.NowUseBBS&" Where BoardID="&SQL(0,i)&" and datediff('d',dateandtime,"&SqlNowString&")=0")
End If
AllToday=Trs(0)
Set Trs=Nothing
If IsNull(AllToday) Then AllToday=0
'最后回复信息
Set Trs=Dvbbs.Execute("Select Top 1 LastPost From Dv_Topic Where BoardID="&SQL(0,i)&" Order by LastPostTime Desc")
If Not (Trs.Eof And Trs.Bof) Then
LastPost=Replace(Trs(0)&"","'","''")
Else
LastPost="无$0$"&Now()&"$无$$$$"
End If
Set Trs=Nothing
'更新当前版面数据
Dvbbs.Execute("Update [Dv_board] Set PostNum="&AllArticle&",TopicNum="&AllTopic&",TodayNum="&AllToday&",LastPost='"&LastPost&"' Where BoardID="&SQL(0,i))
'如果当前版面有下属论坛,则更新其数据为下属论坛数据
If SQL(2,i)>0 Then
'帖子总数,主题总数,今日贴总数,下属版面数
If SQL(3,i)="0" Then
ParentStr=SQL(0,i)
Set Trs=Dvbbs.Execute("Select Sum(PostNum),Sum(TopicNum),Sum(TodayNum),Count(*) From Dv_board Where (Not BoardID="&SQL(0,i)&") And RootID="&SQL(4,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
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 From Dv_Topic Where BoardID In ("&ParentStr&") Order by LastPostTime Desc")
If Not (Trs.Eof And Trs.Bof) Then
LastPost=Replace(Trs(0),"'","''")
Else
LastPost="无$0$"&Now()&"$无$$$$"
End If
'更新版面数据
Dvbbs.Execute("Update [Dv_board] Set PostNum="&AllArticle&",TopicNum="&AllTopic&",TodayNum="&AllToday&",LastPost='"&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)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -