📄 admin_board.asp
字号:
Call GoBack("","请先指定论坛后再进行合并!")
Exit Sub
ElseIf BoardID=NewBoardID Then
Call Goback("","同一个论坛不用合并了!")
Exit sub
End If
Set Rs=BBS94KK.Execute("Select ParentStr,BoardID,Depth,ParentID,Child,RootID from KK_board where BoardID="&BoardID)
If Rs(2)="0" then
Call Goback("系统错误","分类不能做合并操作!")
Exit Sub
End If
ParentStr=Rs(0) & "," & Rs(1)
ParentID=Rs(3)
TempParentStr=rs(1)
DepTh=rs(2)
Child=rs(4)+1
RootID=rs(5)
Rs.Close
TempParentID=ParentID
'判断是否合并到下属论坛
Set Rs=BBS94KK.Execute("Select BoardID From [KK_Board] where BoardID="&NewBoardID&" And ParentStr like '%"&ParentStr&"%'")
If Not (rs.eof and rs.bof) then
Call Goback("","不能将论坛合并到其下属论坛中!")
Exit Sub
End if
Rs.Close
'得到全部下属论坛ID
i=0
Set Rs=BBS94KK.Execute("Select BoardID from [KK_Board] where RootID="&RootID&" And ParentStr like '%"&ParentStr&"%'")
do while not rs.eof
If i=0 then
TempParentStr=Rs(0)
Else
TempParentStr=TempParentStr & "," & Rs(0)
End if
i=i+1
Rs.movenext
loop
If i>0 then
ParentStr=TempParentStr & "," & BoardID
Else
ParentStr=BoardID
End if
'更新其原来所属论坛版面数
BBS94KK.Execute("update [KK_Board] set Child=Child-"&child&" where BoardID="&TempParentID)
'更新其原来所属论坛数据,排序相当于剪枝而不需考虑
For I=1 to Depth
'得到其父类的父类的版面ID
Set rs=BBS94KK.Execute("select ParentID from [KK_Board] where boardID="&TempParentID)
If Not (rs.eof and rs.bof) then
TempParentID=rs(0)
BBS94KK.Execute("update [KK_Board] set Child=Child-"&Child&" where boardid="&TempParentID)
End if
Next
'更新论坛帖子数据
AllTable=Split(BBS94KK.BBSTable(0),",")
For i=0 To uBound(AllTable)
BBS94KK.Execute("update [KK_BBS"&AllTable(i)&"] set BoardID="&NewBoardID&" where BoardID in ("&ParentStr&")")
Next
BBS94KK.Execute("update [KK_Topic] set BoardID="&NewBoardID&" where BoardID in ("&ParentStr&")")
'删除被合并论坛
Set Rs=BBS94KK.Execute("Select Sum(EssayNum),sum(TopicNum),sum(TodayNum) from [KK_Board] where RootID="&RootID&" And BoardID in ("&ParentStr&")")
BBS94KK.Execute("Delete from [KK_Board] where RootID="&RootID&" And BoardID in ("&ParentStr&")")
'更新新论坛帖子计数
BBS94KK.Execute("update [KK_Board] set EssayNum=EssayNum+"&rs(0)&",TopicNum=TopicNum+"&rs(1)&",TodayNum=TodayNum+"&rs(2)&" where BoardID ="&NewBoardID&"")
'更新上级版块
set Rs1=BBS94KK.Execute("select Depth,ParentStr,Boardid from [KK_Board] where BoardID="&NewBoardID)
If Rs1(0)>1 Then
ParentStr=Rs1(0)
BBS94KK.Execute("update [KK_Board] set EssayNum=EssayNum+"&rs(0)&",TopicNum=TopicNum+"&rs(1)&",TodayNum=TodayNum+"&rs(2)&" where boardid in ("&ParentStr&")")
End If
Rs1.Close:Set Rs1=Nothing
Rs.Close
Call Suc("","合并成功!已经将原论坛(包括属下)的所有帖子合并到目标论坛。","?")
UpdateBoardCache
End Sub
Sub ClearData
Set Rs=BBS94KK.execute("Select BoardName,TopicNum,EssayNum From[KK_Board] where BoardID="&BBS94KK.BoardID&"")
IF Rs.Eof Then
Call GoBack("","论坛版面不存在,可能经被删除了")
Exit Sub
End If%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE"><tbody>
<tr bgcolor="#4D65A4"><td height="25" colspan="2"><b><font color="#FFFFFF"><%=Rs("BoardName")%> 数据清理</font></b></td></tr>
<tr><td height="40"><b>帖子信息</b><br>版面主题数:<%=Rs("TopicNum")%><br>版面总帖数:<%=Rs("EssayNum")%><br>精华主题数:<%=BBS94KK.Execute("Select Count(TopicID) From[KK_Topic] where IsGood and BoardID="&BBS94KK.BoardID&"")(0)%><br></td><td><b>注意事项</b><br><font color=red>此操作不可恢复!精华帖子不会被删除!</Font><br>如果您的论坛数据众多,执行此操作将消耗大量的服务器资源。<br>执行过程请耐心等候,最好选择夜间在线人少的时候更新。</td></tr>
<tr bgcolor="#E8F4EF"><td height="40" colspan="2" ><form method=POST style="margin:0" action="?Action=StartClearData">清除 <b><%=Rs(0)%></b> 在 <input name="BoardID" value="<%=BBS94KK.BoardID%>" type="hidden"><select name="SqlTableID"><option value="0">所有数据表</option><%=SqlTableList%></select> 中 <input type=text name="ClearDate" value="365" size=5> 天前的帖子。 <input type="submit" value=" 执行清理 "></form></td></tr></tbody></table>
<%Rs.Close
End Sub
Sub StartClearData
Dim SqlTableID,ClearDate,BoardID,AllTable,i
SqlTableID=BBS94KK.Fun.GetStr("SqlTableID")
ClearDate=BBS94KK.Fun.GetStr("ClearDate")
BoardID=BBS94KK.Fun.GetStr("BoardID")
If Not isnumeric(ClearDate) or Not isNumeric(SqlTableID) or Not isNumeric(BoardID) Then
Call GoBack("","请用数字填写!")
Exit Sub
End If
IF Int(SqlTableID)=0 Then
AllTable=Split(BBS94KK.BBSTable(0),",")
Else
AllTable=Split(SqlTableID,",")
End if
For i=0 to uBound(AllTable)
Set Rs=BBS94KK.Execute("Select TopicID,isVote From[KK_Topic] where BoardID="&BoardID&" And IsGood=False And DATEDIFF('d',[LastTime],'"&BBS94KK.NowBbsTime&"')>"&ClearDate&" ")
Do While Not Rs.Eof
BBS94KK.Execute("Delete from [KK_Bbs"&AllTable(i)&"] where BoardID="&BoardID&" And (TopicId="&RS(0)&" Or ReplyTopicId="&RS(0)&")")
IF Rs(1) Then'删除投票
BBS94KK.Execute("Delete from [KK_TopicVote] where TopicID="&RS(0)&"")
BBS94KK.Execute("Delete from [KK_TopicVoteUser] where TopicID="&RS(0)&"")
End If
Rs.movenext
Loop
Rs.Close
BBS94KK.Execute("Delete From[KK_Topic] where BoardID="&BoardID&" And SqlTableID="&AllTable(i)&" And IsGood=False And DATEDIFF('d',[LastTime],'"&BBS94KK.NowBbsTime&"')>"&ClearDate&" ")
Next
Call Suc("","成功的清理了论坛数据!","?")
End Sub
Sub PassUser
Set Rs=BBS94KK.execute("Select PassUser,BoardName From [KK_Board] where BoardID="&BBS94KK.BoardID&" and BoardType=3 And ParentID<>0")
IF Rs.eof Then
Call GoBack("","此论坛的类型不是认证论坛,不能设置认证用户。")
Exit Sub
End If%>
<form method=POST style='margin:0' action="?Action=SavePassUser">
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#DEF0FE"><tbody>
<tr bgcolor="#4D65A4"><td height="25" colspan="2"><b><font color="#FFFFFF">修改论坛论证用户</font></b></td></tr>
<tr><td height="28" width="30%"><b>所在论坛:</b> </td><td width="70%"><input name="BoardID" value="<%=BBS94KK.BoardID%>" type="hidden"><%=Rs("BoardName")%></td></tr>
<tr><td height="28"><b>通过认证的用户:</b><br>各用户之间用“|”隔开<Br>请不要使用回车键Enter</td><td height="28"><textarea name="PassUser" rows="3"><%=Rs("PassUser")%></textarea></td></tr>
<tr><td colspan="2" align="center"><input type="submit" value=" 提 交 "> <input type="reset" name="Submit" value=" 重 置 "></td></tr></tbody></table>
</table></form>
<%Rs.Close
End Sub
Sub SavePassUser
Dim PassUsers,BoardID
BoardID=BBS94KK.Fun.GetStr("BoardID")
PassUsers=Trim(Replace(Request.Form("PassUser"),"'",""))
PassUsers=Replace(PassUsers,chr(10), "")
PassUsers=Replace(PassUsers,chr(13), "")
BBS94KK.Execute("Update [KK_Board] Set PassUser='"&PassUsers&"' where BoardID="&BoardID&" And ParentID<>0 And BoardType=3")
Call Suc("","成功的更新了该论坛的认证会员!","?")
End Sub
Sub BoardUpdate
Response.flush
%>
<table width="98%" border="2" align="center" cellpadding="3" cellspacing="0" bordercolor="#999999" bordercolordark="#FFFFFF" bgcolor="#E8F4EF"><tbody>
<tr><td><div align="center"><b><span id=BBS94KKT name=BBS94KKT>数据版面正在整理,请稍等</span></b></div>
<table width="400" border="0" align="center" cellpadding="1" cellspacing="1">
<tr><td bgcolor=#d7d7d7>
<table width="400" border="0" cellspacing="0" cellpadding="1">
<tr>
<td bgcolor=ffffff height=9><img src="Images/hr1.gif" width=0 height=16 id=BBS94KKimg name=BBS94KKimg align=absmiddle></td>
</tr></table>
</td></tr></table>
<div align="center"><span id=BBS94KKtxt name=BBS94KKtxt style="font-size:9pt">0</span><span style="font-size:9pt">%</span></div></td></tr>
</tbody></table><br>
<%Response.Flush
Dim BoardNum,EssayNum,TopicNum,TodayNum,BoardAdmin,ParentStr,LastReply,LastCaption
Dim AllTable,I,II,III,SQL
BoardNum=BBS94KK.Execute("Select Count(BoardID) from[KK_Board] Where ParentID<>0")(0)
II=0
Set Rs=BBS94KK.Execute("Select BoardID,BoardName,Child,ParentStr,RootID from[KK_Board] Where ParentID<>0 Order by Child,RootID,Orders Desc")
If Not Rs.EOF Then
SQL=Rs.GetRows()
Rs.Close
For i=0 to UBound(SQL,2)
EssayNum=0
TopicNum=0
TodayNum=0
BoardAdmin=""
LastReply=""
LastCaption="无"
AllTable=Split(BBS94KK.BBSTable(0),",")
For III=0 To uBound(AllTable)
EssayNum=EssayNum+BBS94KK.Execute("Select Count(*) From[KK_Bbs"&AllTable(III)&"] where BoardID="&SQL(0,i)&" And IsDel=False")(0)
TodayNum=TodayNum+BBS94KK.Execute("Select Count(*) From[KK_Bbs"&AllTable(III)&"] where BoardID="&SQL(0,i)&" And IsDel=False And DATEDIFF('d',[LastTime],'"&BBS94KK.NowBbsTime&"')<1")(0)
Next
TopicNum=BBS94KK.Execute("Select Count(TopicID) From[KK_Topic] where BoardID="&SQL(0,i)&" and IsDel=False")(0)
Set Rs=BBS94KK.Execute("Select Name From[KK_Admin] Where BoardID="&SQL(0,i)&"")
Do While Not Rs.Eof
BoardAdmin=BoardAdmin&Rs(0)&"|"
Rs.Movenext
Loop
If BoardAdmin<>"" Then BoardAdmin=left(BoardAdmin,len(BoardAdmin)-1)
Rs.Close
Set Rs=BBS94KK.execute("Select top 1 TopicID,Name,Caption,AddTime,Face,SqlTableID,BoardID From [KK_Topic] where IsDel=False And BoardID="&SQL(0,i)&" order by TopicID desc")
If Not Rs.eof then
LastCaption=Replace(BBS94KK.Fun.StrLeft(Rs("Caption"),20),"'","'")
LastReply=Rs("Name")&"|"&LastCaption&"|"&Rs("AddTime")&"|"&Rs("Face")&"|"&Rs("TopicID")&"|"&Rs("BoardID")&"|"&Rs("SqlTableID")&""
End If
Rs.Close
BBS94KK.Execute("update [KK_Board] Set EssayNum="&EssayNum&",TodayNum="&TodayNum&",TopicNum="&TopicNum&",BoardAdmin='"&BoardAdmin&"',LastReply='"&LastReply&"' where BoardID="&SQL(0,i)&"")
'如果有上级论坛,那么更新上级论坛
If SQL(2,I)>0 Then
ParentStr=SQL(3,i) & "," & SQL(0,i)
Set Rs=BBS94KK.Execute("Select Sum(EssayNum),Sum(TopicNum),Sum(TodayNum) From [KK_Board] Where ParentStr = '"&ParentStr&"'")
If Not IsNull(Rs(0)) Then EssayNum = Rs(0) + EssayNum
If Not IsNull(Rs(1)) Then TopicNum = Rs(1) + TopicNum
If Not IsNull(Rs(2)) Then TodayNum = Rs(2) + TodayNum
Rs.Close
Set Rs=BBS94KK.execute("Select top 1 TopicID,Name,Caption,AddTime,Face,SqlTableID,BoardID From [KK_Topic] where IsDel=False And BoardID In ("&ParentStr&") Order by LastTime Desc")
If Not Rs.eof then
LastCaption=replace(BBS94KK.Fun.StrLeft(Rs("Caption"),20),"'","'")
LastReply=Rs("Name")&"|"&LastCaption&"|"&Rs("AddTime")&"|"&Rs("Face")&"|"&Rs("TopicID")&"|"&Rs("BoardID")&"|"&Rs("SqlTableID")&""
End If
Rs.Close
BBS94KK.Execute("update [KK_Board] Set EssayNum="&EssayNum&",TodayNum="&TodayNum&",TopicNum="&TopicNum&",LastReply='"&LastReply&"' where BoardID="&SQL(0,i)&"")
End IF
If BoardAdmin="" Then
BoardAdmin="无"
Else
BoardAdmin=Replace(Boardadmin,"|","、")
End If
Call Table("论坛 <Font color=blue>"&SQL(1,i)&"</Font> 整理成功","总帖数"&EssayNum&" | 主题数:"&TopicNum&" | 今日帖:"&TodayNum&" | 版主:"&BoardAdmin&" | 最新主题:"&LastCaption&"")
II=II+1
Response.Write "<script>BBS94KKimg.width=" & Fix((ii/BoardNum) * 400) & ";" & VbCrLf
Response.Write "BBS94KKtxt.innerHTML=""" & FormatNumber(ii/BoardNum*100,4,-1) & """;" & VbCrLf
Response.Write "</script>" & VbCrLf
Response.Flush
Next
End If
Response.Write "<script>BBS94KKimg.width=400;BBS94KKtxt.innerHTML=""100"";BBS94KKT.innerHTML=""<font color=red>成功完成整理!</font>"";</script>"
updateBoardCache
End Sub
Function SqlTableList()
Dim AllTable,I
AllTable=Split(BBS94KK.BBSTable(0),",")
For i=0 To uBound(AllTable)
SqlTableList=SqlTableList&"<option value='"&AllTable(I)&"'>数据表"&AllTable(I)&"</option>"
Next
End Function
Sub Table(Str1,Str2)
Response.Write("<table width='98%' border='1' align='center' cellpadding='3' cellspacing='2' bordercolor='#999999' bordercolordark='#FFFFFF' bgcolor='#DEF0FE'><tr><td><Div style='margin:5;line-height: 150%'>"&Str1&"<br>"&Str2&"</Div></td></tr></table>")
End Sub
'2005-8-1 增加论坛排序
Sub OrdersTopBoard
Dim BoardID,ParentID,RootID,Orders,ParentStr,I,BoardNum,P_Rs
BoardID=BBS94KK.BoardID
Set Rs=BBS94KK.execute("Select Orders,ParentID,ParentStr From[KK_Board] where BoardID="&BBS94KK.BoardID)
IF Rs.Eof or Rs.Bof Then
Call GoBack("系统出错!","该版面不存在,可能已经删除了!")
Exit Sub
End If
Orders=Rs(0)
ParentID=Rs(1)
ParentStr=Rs(2)
Rs.Close
'当版面为类时
If ParentID=0 then Call GoBack("系统出错!","版面ID出错。"):Exit Sub
'得到其下属版面数
ParentStr=ParentStr & ","
BoardNum=BBS94KK.Execute("select count(*) from [KK_Board] where ParentStr like '%"&ParentStr & BoardID&"%'")(0)
If Isnull(BoardNum) Then BoardNum=1
'获得父级信息
Set P_rs=BBS94KK.Execute("select * from [KK_board] where Boardid="&ParentID)
'在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据
BBS94KK.Execute("update [KK_Board] set orders=Orders + "&BoardNum&"+1 where RootID="&P_rs("RootID")&" And orders>"&P_rs("orders")&"")
'更新当前版面数据
BBS94KK.Execute("update [KK_Board] set orders="&P_Rs("orders")&"+1 Where BoardID="&BoardID)
Dim TempParentStr
i=1
'更新下属,同时获得移动总数i
'如果有则更新下属版面数据
Set Rs=BBS94KK.Execute("select * from [KK_Board] where ParentStr like '%"&ParentStr & BoardID&"%' order by orders")
Do while not rs.eof
i=i+1
If P_rs("parentstr")="0" Then'如果其父级为类,那么其下属的版面数据
TempParentStr=P_rs("boardid") & "," & Replace(rs("parentstr"),ParentStr,"")
Else
TempParentStr=P_rs("parentstr") & "," & P_rs("boardID") & "," & replace(Rs("Parentstr"),ParentStr,"")
End If
BBS94KK.Execute("update [KK_Board] set orders="&P_rs("orders")&"+"&I&",ParentStr='"&TempParentStr&"' where BoardID="&Rs("BoardID"))
Rs.movenext
Loop
Rs.Close
P_Rs.Close
Set P_Rs=Nothing
UpdateBoardCache
Response.Redirect"?"
Response.End
End Sub
'成功,随冰在高兴中...
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -