⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 update.asp

📁 前台及后台用户名密码都是:gz35gz35.com
💻 ASP
📖 第 1 页 / 共 4 页
字号:
			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 "<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=95% class=tableBorder align=center><tr><td colspan=2 class=forumrow>更新论坛数据成功,"&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>"
	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 = "<tr><td colspan=2 class=forumrow>更新总论坛数据成功,全部论坛共有 " & PostNum & " 篇贴子," & TopicNum & " 篇主题,总固顶主题共 " & UBound(Split(AllTopNum, ",")) + 1 & " 篇,有 " & UserNum & " 用户,最新加入为 " & LastUser & "。<br>今日有 " & TodayNum & " 篇帖子,昨天有 " & YesterdayNum & " 篇帖子。</td></tr>"
	Dvbbs.Name="setup"
	ReloadSetup()
End sub

Sub fixtopic()
if not isnumeric(request.form("beginid")) then
	body="<tr><td colspan=2 class=forumrow>错误的开始参数!</td></tr>"
	exit sub
End If
if not isnumeric(request.form("endid")) then
	body="<tr><td colspan=2 class=forumrow>错误的结束参数!</td></tr>"
	exit sub
end if
if clng(request.form("beginid"))>clng(request.form("endid")) then
	body="<tr><td colspan=2 class=forumrow>开始ID应该比结束ID小!</td></tr>"
	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"))
%>
</table>
&nbsp;<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>

<table cellpadding="0" cellspacing="0" border="0" width="95%" class="tableBorder" 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=forumrow>已经到记录的最尾端,请结束更新!</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
		Response.Write "img2.title=""" & server.htmlencode(eRs(2)&"") & "(" & i & ")"";</script>" & 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 "<script>img2.width=400;txt2.innerHTML=""100"";</script>"
%>
<form action="update.asp?action=updat" method=post>
<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="<%=request.form("endid")+1%>" size=5>&nbsp;帖子主题ID,可以填写您想从哪一个ID号开始进行修复</td>
</tr>
<tr>
<td width="20%" class="forumrow">结束的ID号</td>
<td width="80%" class="forumrow"><input type=text name="EndID" value="<%=request.form("endid")+(request.form("endid")-request.form("beginid"))+1%>" size=5>&nbsp;将更新开始到结束ID之间的帖子数据,之间的数值最好不要选择过大</td>
</tr>
<tr>
<td width="20%" class="forumrow"></td>
<td width="80%" class="forumrow"><input type="submit" name="Submit" value="修 复"></td>
</tr>
</form>
<%
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)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -