%
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 + "
本页面为管理员专用,请登录后进入。
您没有管理本页面的权限。"
dvbbs_error()
End If
dim tmprs
dim body
call main()
Footer()
sub main()
%>
| 论坛数据处理 |
| 注意事项 |
下面有的操作可能将非常消耗服务器资源,而且更新时间很长,请仔细确认每一步操作后执行。 |
<%
If request("action")="updat" Then
If request("submit")="更新论坛数据" Then
call updateboard()
ElseIf request("submit")="修 复" Then
call fixtopic()
ElseIf request("submit")="清空在线用户" Then
call Delallonline()
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 "| 清空论坛数据成功,请返回更新帖子数据! |
"
elseif request("action")="updateuser" then
%>
<%
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
%>
| 更新论坛数据 |
<%
end if
%>
<%
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
Dim Slastpost
ii=0
'设置打开数据时间
conn.CommandTimeout=3600
'获得要更新的总数
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
%>
|
下面开始更新论坛版面资料,共有<%=C1%>个版面需要更新
0% |
<%
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),",")
AllBoard = 0
'所有主题和帖子
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
'更新当前版面数据
SLastPost = Split(LastPost,"$")
If Ubound(SLastPost) < 7 Then LastPost = LastPost & "$"
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(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 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
'更新版面数据
SLastPost = Split(LastPost,"$")
If Ubound(SLastPost) < 7 Then LastPost = LastPost & "$"
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)
Else
BoardTopStr = BoardTopStr & "," & Trs(0)
End If
End If
Trs.MoveNext
Loop
End If
End If
Dvbbs.Execute("Update Dv_Board Set BoardTopStr='"&BoardTopStr&"',IsGroupSetting='"&UpGroupSetting&"' Where BoardID="&SQL(0,i))
UserAccessCount=""
IsGroupSetting=""
UpGroupSetting=""
BoardTopStr=""
ii=ii+1
'If (i mod 100) = 0 Then
Response.Write "" & VbCrLf
Response.Flush
'End If
body="| 更新论坛数据成功,"&SQL(1,i)&"共有"&AllArticle&"篇贴子,"&AllTopic&"篇主题,今日有"&AllToday&"篇帖子。 |
"
Response.Write body
Response.Flush
'Rs.MoveNext
'Loop
Next
Set Trs=Nothing
End If
body=""
Response.Write ""
MakXMLBoardInfo 0
LoadBoardNews_Paper
ReloadSetup()
End Sub
Rem 统计下属论坛函数 2004-5-3 Dvbbs.YangZheng
Sub Boardchild()
Dim cBoardNum, cBoardid
Dim Trs
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()
Dim AllTopNum,PostNum,TopicNum,LastUser
Dim TodayNum,UserNum, YesterdayNum
TopicNum = GetTopicnum()
AllTopNum = Forum_AllTopNum()
PostNum = Announcenum()
LastUser = Newuser()
TodayNum = Alltodays()
UserNum = Allusers()
YesterdayNum= Allyesterdays()
Sql = "UPDATE Dv_Setup SET Forum_TopicNum = " & TopicNum & ", Forum_PostNum = " & PostNum & ", Forum_TodayNum = " & TodayNum & ", Forum_YesterdayNum = " & YesterdayNum & ", Forum_UserNum = " & UserNum & ", Forum_lastUser = '" & Dvbbs.HtmlEncode(LastUser) & "', Forum_AllTopNum = '" & AllTopNum & "'"
Dvbbs.Execute(Sql)
Body = "更新总论坛数据成功,全部论坛共有 " & PostNum & " 篇贴子," & TopicNum & " 篇主题,总固顶主题共 " & UBound(Split(AllTopNum, ",")) + 1 & " 篇,有 " & UserNum & " 用户,最新加入为 " & LastUser & "。 今日有 " & TodayNum & " 篇帖子,昨天有 " & YesterdayNum & " 篇帖子。 |
"
Dvbbs.Name="setup"
ReloadSetup()
End sub
Sub fixtopic()
if not isnumeric(request.form("beginid")) then
body="| 错误的开始参数! |
"
exit sub
End If
if not isnumeric(request.form("endid")) then
body="| 错误的结束参数! |
"
exit sub
end if
if clng(request.form("beginid"))>clng(request.form("endid")) then
body="| 开始ID应该比结束ID小! |
"
exit sub
end if
dim TotalUseTable,Ers
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"))
%>
|
下面开始更新论坛帖子资料,预计本次共有<%=C1%>个帖子需要更新
0% |
<%
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="| 已经到记录的最尾端,请结束更新! |
"
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 "" & VbCrLf
Response.Flush
'End If
end if
'计算回帖数 2004-8-2
Sql = "SELECT COUNT(*) FROM " & Rs(1) & " WHERE Rootid = " & Rs(0) & " AND Boardid <> 444 AND Boardid <> 777"
Set Ers = Dvbbs.Execute(Sql)
Dvbbs.Execute("UPDATE Dv_Topic SET Child = " & Ers(0)-1 & " WHERE Topicid = " & Rs(0) & "")
Rs.Movenext
loop
set ers=nothing
set rs=nothing
Response.Write ""
%>
<%
end sub
'分论坛今日帖子
REM 修改查询所有帖子表数据 2004-8-26.Dv.Yz
Function Todays(Boardid)
Todays = 0
If IsSqlDataBase = 1 Then
For i = 0 To Ubound(AllPostTable)
Set Tmprs = Dvbbs.Execute("SELECT COUNT(Announceid) FROM " & AllPostTable(i) & " WHERE Boardid = " & Boardid & " AND DATEDIFF(day, Dateandtime, " & SqlNowString & ") = 0")
Todays = Todays + Tmprs(0)
Next
Else
For i = 0 To Ubound(AllPostTable)
Set Tmprs = Dvbbs.Execute("SELECT COUNT(Announceid) FROM " & AllPostTable(i) & " WHERE Boardid = " & Boardid & " AND DATEDIFF('d', Dateandtime, " & SqlNowString & ") = 0")
Todays = Todays + Tmprs(0)
Next
End If
Set Tmprs = Nothing
End Function
'全部论坛今日帖子
REM 修改查询所有帖子表数据 2004-8-26.Dv.Yz
Function Alltodays()
Alltodays = 0
If IsSqlDataBase = 1 Then
For i = 0 To Ubound(AllPostTable)
Set Tmprs = Dvbbs.Execute("SELECT COUNT(Announceid) FROM " & AllPostTable(i) & " WHERE NOT Boardid IN (444,777) AND DATEDIFF(day, Dateandtime, " & SqlNowString & ") = 0")
Alltodays = Alltodays + Tmprs(0)
Next
Else
For i = 0 To Ubound(AllPostTable)
Set Tmprs = Dvbbs.Execute("SELECT COUNT(Announceid) FROM " & AllPostTable(i) & " WHERE NOT Boardid IN (444,777) AND DATEDIFF('d', Dateandtime, " & SqlNowString & ") = 0")
Alltodays = Alltodays + Tmprs(0)
Next
End If
Set Tmprs = Nothing
End Function
'论坛昨天的帖子 2004-8-31.Dv.Yz
Function Allyesterdays()
Allyesterdays = 0
If IsSqlDataBase = 1 Then
For i = 0 To Ubound(AllPostTable)
Set Tmprs = Dvbbs.Execute("SELECT COUNT(Announceid) FROM " & AllPostTable(i) & " WHERE NOT Boardid IN (444,777) AND DATEDIFF(day, Dateandtime, " & SqlNowString & ") = 1")
Allyesterdays = Allyesterdays + Tmprs(0)
Next
Else
For i = 0 To Ubound(AllPostTable)
Set Tmprs = Dvbbs.Execute("SELECT COUNT(Announceid) FROM " & AllPostTable(i) & " WHERE NOT Boardid IN (444,777) AND DATEDIFF('d', Dateandtime, " & SqlNowString & ") = 1")
Allyesterdays = Allyesterdays + Tmprs(0)
Next
End If
Set Tmprs = Nothing
End Function
'所有注册用户数量
function allusers()
allusers=Dvbbs.Execute("Select count(userid) from [Dv_user]")(0)
If IsNull(allusers) Then allusers=0
End function
'最新注册用户
Function newuser()
sql="Select top 1 username from [Dv_user] order by userid desc"
Set tmprs=Dvbbs.Execute(sql)
If tmprs.eof and tmprs.bof Then
newuser="没有会员"
Else
newuser=tmprs("username")
End If
Set tmprs=Nothing
End function
'所有论坛帖子
function AnnounceNum()
dim AnnNum
AnnNum=0
AnnounceNum=0
For i=0 to ubound(AllPostTable)
AnnNum=Dvbbs.Execute("Select Count(announceID) from "&AllPostTable(i)&" where not boardid in (444,777)")(0)
if isnull(AnnNum) then AnnNum=0
AnnounceNum=AnnounceNum + AnnNum
next
end function
'分论坛帖子
function BoardAnnounceNum(boardid)
dim BoardAnnNum
BoardAnnNum=0
BoardAnnounceNum=0
For i=0 to ubound(AllPostTable)
BoardAnnNum=Dvbbs.Execute("Select Count(announceID) from "&AllPostTable(i)&" where boardid="&boardid)(0)
if isnull(BoardAnnNum) then BoardAnnNum=0
BoardAnnounceNum=BoardAnnounceNum + BoardAnnNum
next
end function
'所有论坛主题
function GetTopicnum()
Dim TopicNum
TopicNum=Dvbbs.Execute("Select Count(topicid) from DV_topic where not boardid in (444,777)")(0)
if isnull(TopicNum) then TopicNum=0
GetTopicnum = TopicNum
end function
'分论坛主题
function BoardTopicNum(boardid)
BoardTopicNum=Dvbbs.Execute("Select Count(topicid) from [Dv_topic] where boardid="&boardid)(0)
if isnull(BoardTopicNum) then BoardTopicNum=0
end function
'论坛总固顶主题数
function Forum_AllTopNum()
Set tmprs=Dvbbs.Execute("Select TopicID From Dv_Topic Where IsTop=3 And (Not BoardID In (444,777)) ")
If tmprs.eof and tmprs.bof Then
Forum_AllTopNum=""
Else
Do While Not tmprs.Eof
If Forum_AllTopNum="" Then
Forum_AllTopNum = tmprs(0)
Else
Forum_AllTopNum = Forum_AllTopNum & "," & tmprs(0)
End If
tmprs.MoveNext
Loop
End If
Set tmprs=Nothing
end function
'更新用户发贴数
sub updateTopic()
if not isnumeric(request.form("beginid")) then
body="| 错误的开始参数! |
"
exit sub
end if
if not isnumeric(request.form("endid")) then
body="| 错误的结束参数! |
"
exit sub
end if
if clng(request.form("beginid"))>clng(request.form("endid")) then
body="| 开始ID应该比结束ID小! |
"
exit sub
end if
Dim C1
C1=clng(request.form("endid"))-clng(request.form("beginid"))
%>
|
下面开始更新论坛用户资料,预计本次共有<%=C1%>个用户需要更新
0% |
<%
Response.Flush
dim userTopic,UserPost
sql="select userid,username from [Dv_user] where userid>="&request.form("beginid")&" and userid<="&request.form("endid")
set rs=Dvbbs.Execute(sql)
if rs.eof and rs.bof then
body="| 已经到记录的最尾端,请结束更新! |
"
exit sub
end if
do while not rs.eof
UserTopic=UserallTopicnum(rs(0))
userPost=Userallnum(rs(0))
Dvbbs.Execute("update [Dv_user] set UserPost="&userPost&",UserTopic="&UserTopic&" where userid="&rs(0))
i=i+1
'If (i mod 100) = 0 Then
Response.Write "" & VbCrLf
Response.Flush
'End If
rs.movenext
loop
set rs=nothing
Response.Write ""
%>
<%
end sub
'更新用户金钱/经验/魅力
sub updatemoney()
if not isnumeric(request.form("beginid")) then
body="| 错误的开始参数! |
"
exit sub
end if
if not isnumeric(request.form("endid")) then
body="| 错误的结束参数! |
"
exit sub
end if
if clng(request.form("beginid"))>clng(request.form("endid")) then
body="| 开始ID应该比结束ID小! |
"
exit sub
end if
dim userTopic,userReply,userWealth
dim userEP,userCP
Dim C1
C1=clng(request.form("endid"))-clng(request.form("beginid"))
%>
|
下面开始更新论坛用户资料,预计本次共有<%=C1%>个用户需要更新
0% |
<%
Response.Flush
sql="select userlogins,userid,userpost,usertopic,username from [Dv_user] where userid>="&request.form("beginid")&" and userid<="&request.form("endid")
set rs=Dvbbs.Execute(sql)
'shinzeal加入自动提示完成
if rs.eof and rs.bof then
body="| 已经到记录的最尾端,请结束更新! |
"
exit sub
end if
do while not rs.eof
'userTopic=UserTopicNum(rs(1))
'userreply=UserReplyNum(rs(1))
userwealth=rs(0)*Dvbbs.Forum_user(4) + rs("usertopic")*Dvbbs.Forum_user(1) + (rs("userpost")-rs("usertopic"))*Dvbbs.Forum_user(2)
userEP=rs(0)*Dvbbs.Forum_user(9) + rs("usertopic")*Dvbbs.Forum_user(6) + (rs("userpost")-rs("usertopic"))*Dvbbs.Forum_user(7)
userCP=rs(0)*Dvbbs.Forum_user(14) + rs("usertopic")*Dvbbs.Forum_user(11) + (rs("userpost")-rs("usertopic"))*Dvbbs.Forum_user(12)
if isnull(UserWealth) or not isnumeric(userwealth) then userwealth=0
if isnull(Userep) or not isnumeric(userep) then userep=0
if isnull(Usercp) or not isnumeric(usercp) then usercp=0
Dvbbs.Execute("update [Dv_user] set userWealth="&userWealth&",userep="&userep&",usercp="&usercp&" where userid="&rs(1))
i=i+1
'If (i mod 100) = 0 Then
Response.Write "" & VbCrLf
Response.Flush
'End If
rs.movenext
loop
set rs=nothing
Response.Write ""
%>
<%
end sub
'更新用户等级
sub updategrade()
if not isnumeric(request.form("beginid")) then
body="| 错误的开始参数! |
"
exit sub
end if
if not isnumeric(request.form("endid")) then
body="| 错误的结束参数! |
"
exit sub
end if
if clng(request.form("beginid"))>clng(request.form("endid")) then
body="| 开始ID应该比结束ID小! |
"
exit sub
end if
Dim oldMinArticle,Rss
oldMinArticle=0
Set Rss=Dvbbs.Execute("Select UserID From [Dv_User] Where UserID>="&Request.Form("beginid"))
If Rss.Eof And Rss.Bof Then
body="| 已经到记录的最尾端,请结束更新! |
"
Exit Sub
End If
Rss.Close
SQL = "Select UserGroupID From Dv_UserGroups Where Not ParentGID In (0,3)"
Set Rss = Dvbbs.Execute(SQL)
SQL = Rss.GetString(,, "", ",", "")
Rss.close
Set Rss = Nothing
SQL = SQL & "1"
Set Rs=Dvbbs.Execute("Select * From Dv_UserGroups Where ParentGID=3 Order By MinArticle Desc")
Do While Not Rs.Eof
Dvbbs.Execute("Update [Dv_User] Set UserClass='"&Rs("UserTitle")&"',TitlePic='"&Rs("GroupPic")&"',UserGroupID="&Rs("UserGroupID")&" Where (Not UserGroupID In ("&SQL&")) And (UserID>="&Request.Form("beginid")&" And UserID<="&Request.Form("endid")&") And (UserPost<"&oldMinArticle&" And UserPost>="&Rs("MinArticle")&" )")
oldMinArticle=Rs("MinArticle")
Rs.MoveNext
Loop
Rs.Close
Set Rs=Nothing
%>
<%
end sub
'用户所有主题数
function UserTopicNum(userid)
dim topicnum
topicnum=0
usertopicnum=0
set tmprs=Dvbbs.Execute("select count(*) from dv_topic where not boardid in (444,777) and PostUserID="&userid)
TopicNum=tmprs(0)
if isnull(TopicNum) then TopicNum=0
UserTopicNum=UserTopicNum + TopicNum
set tmprs=nothing
end function
'用户所有回复数
Function UserReplyNum(userid)
dim replynum
replynum=0
userreplynum=0
For i=0 to ubound(AllPostTable)
set tmprs=Dvbbs.Execute("select count(announceid) from "&AllPostTable(i)&" where not boardid in (444,777) and ParentID>0 and PostUserID="&userid)
replyNum=tmprs(0)
if isnull(replyNum) then replyNum=0
UserReplyNum=UserReplyNum + replynum
next
set tmprs=nothing
end function
'用户所有帖子
function Userallnum(userid)
dim allnum
allnum=0
userallnum=0
For i=0 to ubound(AllPostTable)
set tmprs=Dvbbs.Execute("select count(announceid) from "&AllPostTable(i)&" where not boardid in (444,777) and PostUserID="&userid)
allnum=tmprs(0)
if isnull(allnum) then allnum=0
userallnum=userallnum+allnum
Next
Set tmprs=nothing
End function
function UserallTopicnum(userid)
dim allnum
allnum=0
UserallTopicnum=0
For i=0 to ubound(AllPostTable)
set tmprs=Dvbbs.Execute("select count(*) from Dv_Topic where not boardid in (444,777) and PostUserID="&userid)
allnum=tmprs(0)
if isnull(allnum) then allnum=0
UserallTopicnum=UserallTopicnum+allnum
Next
Set tmprs=nothing
End function
Sub fixbbs()
Dim killhtml,updatedate
updatedate=Request("updatedate")
killhtml=Request("killhtml")
If Not IsNumeric(request.form("beginid")) Then
body="| 错误的开始参数! |
"
Exit Sub
End If
If Not IsNumeric(request.form("endid")) Then
body="| 错误的结束参数! |
"
Exit Sub
End If
If CLng(request.form("beginid"))>clng(request.form("endid")) Then
body="| 开始ID应该比结束ID小! |
"
Exit Sub
End If
Dim C1
C1=clng(request.form("endid"))-clng(request.form("beginid"))
%>
|
下面开始更新论坛帖子资料,预计本次共有<%=C1%>个帖子需要更新
0% |
<%
Response.Flush
Dim TotalUseTable,Ers,SQL1
Dim vBody,isagree,re
Dim Maxid
Set Rs=Dvbbs.Execute("select Max(topicid) from dv_topic")
Maxid=Rs(0)
Set Rs=Nothing
If Maxid< CLng(request.form("beginid")) Then
body="| 已经到记录的最尾端,请结束更新! |
"
set rs=nothing
Exit Sub
End If
sql="select topicid,PostTable from dv_topic where topicid>="&CLng(request.form("beginid"))&" and topicid<="&CLng(request.form("endid"))
Set Rs=Dvbbs.Execute(sql)
Set ERs=server.createobject("adodb.recordset")
Do While Not rs.eof
SQl1 ="select Body,isagree,Ubblist,topic,DateAndTime,Announceid from "&Rs(1)&" where Rootid="&CLng(Rs(0))&""
Ers.open SQL1,Conn,1,3
If Not(eRs.eof OR ers.BOF) Then
Do While Not ers.eof
vbody=eRs(0)
isagree=eRs(1)
If IsNull(isagree) Then isagree=""
If isagree <>"" Then
isagree=Replace(isagree,"[isubb]","")
Else
isagree=ers(1)
End If
If killhtml="1" Then
eRs(0)=vbody
End If
ers(1)= isagree&""
If IsDate(updatedate) And IsDate(ers(4)) Then
If updatedate > ers(4) Then
ers(2)=Ubblist(vbody)
Else
If killhtml="1" Then
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
re.Pattern="
"
vbody=re.Replace(vbody,"[br]")
re.Pattern="<(.[^>]*)>"
vbody=re.Replace(vbody,"")
Set re=Nothing
End If
ers(2)=UbblistOLD(vbody)
End If
Else
ers(2)=UbblistOLD(vbody)
End If
ers.update
Response.Write ""
Response.Flush
eRs.movenext
Loop
End If
ERs.close
i=i+1
'If (i mod 100) = 0 Then
Response.Write "" & VbCrLf
Response.Flush
'End If
Rs.movenext
Loop
Set ers=nothing
set rs=nothing
Response.Write ""
%>
<%
End Sub
'清空在线用户 2004-10-11 Dv.Yz
Sub Delallonline()
Sql = "DELETE FROM Dv_Online"
Dvbbs.Execute(Sql)
Body = "| 清空在线用户数据成功,请 更新服务器缓存 。"
End Sub
%>
|