<!-- #include file=../../inc/BBSsetup.asp -->
<!-- #include file=../../inc/Board_Popfun.asp -->
<!-- #include file=../inc/bbsmanage_Fun.asp -->
<!-- #include file=inc/ForumBoard_fun.asp -->
<%
Server.ScriptTimeOut = 300
DEF_BBS_HomeUrl = "../../"
Dim GBL_ID
initDatabase
GBL_CHK_TempStr = ""
GBL_ID = checkSupervisorPass

SiteHead(DEF_SiteNameString & " - 管理员")
UserTopicTopInfo
DisplayUserNavigate("修复论坛昨日发帖量")%>
<br><br><%
If GBL_CHK_Flag=1 Then
	If Request.Form("submitflag") = "yes" then
		UpdateBoardYesterdayAnnounceNum
		Response.Write "<p><br><font color=008800 class=GreenFont>修复昨日发帖量成功！</font>" & VbCrLf
	Else
		%><br>
			注意：此功能将修复以下内容：<br><br>
			&nbsp; &nbsp; &nbsp; 1.统计每个版面的昨日发帖量，重新计算昨日发表的帖子<br>
			&nbsp; &nbsp; &nbsp; 2.如果服务器时间调整，仍然依发帖的时间来重新统计昨日的帖子(24小时)
			<p>
			&nbsp; &nbsp; &nbsp; <b><font color=ff0000 class=RedFont>确认信息：确定开始重新统计昨日发帖吗？点击后耐心等待程序完成执行。</b></font><br><br>
			<p>
			&nbsp; &nbsp; &nbsp; 
			<form action=RepairYesterdayAnc.asp method=post name=LeadBBSFm id=LeadBBSFm>
			<input name=submitflag value=yes type=hidden>
			<input type=button value="点击确认开始统计昨日发帖量" onclick="javascript:LeadBBSFm.submit();this.disabled=true;" class=fmbtn>
			</form>
		<%
	End If
Else%>
	<table width=96%>
	<tr>
	<td>
	<%
	If Request("submitsure")="" Then
		Response.Write "<br><b>请先登录</b>"
	Else
		Response.Write "<br><p align=left><font color=ff0000 class=RedFont><b>" & GBL_CHK_TempStr & "</b></font>"
	End If
	DisplayLoginForm
	Response.Write "</p>"%>
	</td>
	</tr>
	</table>
<%End If
UserTopicBottomInfo
closeDataBase
SiteBottom
If GBL_ShowBottomSure = 1 Then Response.Write GBL_SiteBottomString


Function UpdateBoardYesterdayAnnounceNum

	Dim Rs,GetData,BoardNum,YesterdayAnnounceNum
	Set Rs = Con.ExeCute("Select BoardID,BoardName from LeadBBS_Boards")
	GBL_DBNum = GBL_DBNum + 1
	If Not Rs.Eof Then
		GetData = Rs.GetRows(-1)
		BoardNum = Ubound(GetData,2)
	Else
		BoardNum = -1
	End If
	Rs.Close
	Set Rs = Nothing

	YesterdayAnnounceNum = 0
	If BoardNum = -1 Then
		YesterdayAnnounceNum = 0
	Else
		Dim N,StartTime1,StartTime2,GoodNum
		StartTime1 = Left(GetTimeValue(DateAdd("d",-1,DEF_Now)),8) & "000000"
		StartTime2 = Left(GetTimeValue(DEF_Now),8) & "000000"
		Response.Write "<br>"
		For N = 0 to BoardNum
			Set Rs = Con.ExeCute("select count(*) from LeadBBS_Announce where BoardID=" & getData(0,N) & " and ndatetime>=" & StartTime1 & " and ndatetime<" & StartTime2)
			GBL_DBNum = GBL_DBNum + 1
			If Rs.Eof Then
				GoodNum = 0
			Else
				GoodNum = Rs(0)
				If isNull(GoodNum) Then GoodNum = 0
				GoodNum = cCur(GoodNum)
				YesterdayAnnounceNum = YesterdayAnnounceNum + GoodNum
			End If
			Rs.Close
			Set Rs = Nothing
			Response.Write GetData(1,N) & "昨日发帖共" & GoodNum & "条<br>" & VbCrLf
		Next
	End If
	Dim MaxAnnounce
	Set Rs = Con.ExeCute("Select top 1 MaxAnnounce from LeadBBS_SiteInfo")
	If Rs.Eof Then
		Rs.Close
		Set Rs = Nothing
	Else
		MaxAnnounce = Rs(0)
		Rs.Close
		Set Rs = Nothing
		If isNull(MaxAnnounce) Then MaxAnnounce = 0
		MaxAnnounce = cCur(MaxAnnounce)
		If MaxAnnounce < YesterdayAnnounceNum Then
			Con.ExeCute("Update LeadBBS_SiteInfo Set MaxAnnounce=" & YesterdayAnnounceNum)
		End If
	End If
	Con.ExeCute("Update LeadBBS_SiteInfo Set YesterdayAnc=" & YesterdayAnnounceNum)
	ReloadStatisticData
	Response.Write "<p>完成更新，昨日发帖量共计" & YesterdayAnnounceNum & "条<br>"

End Function
%>