reload.asp

来自「关于网络渗透技术的详细讲解」· ASP 代码 · 共 442 行 · 第 1/2 页

ASP
442
字号
<!-- #include file="../Conn.asp" -->
<!-- #include file="inc.asp" -->
<%
'====================================================================
'=              Copyright (c) 2004,NB联盟 E.P.K开发小组             =
'=                      All rights reserved.                        =
'=------------------------------------------------------------------=
'=                     文件名称:ReLoad.asp                         =
'=                     摘    要:后台—数据更新文件                 =
'=------------------------------------------------------------------=
'=                     最后更新:eason007                           =
'=                     最后日期:2004-12-10                         =
'====================================================================

Dim Atcion,PostId
Dim TopicList
Atcion=Request.QueryString("atcion")
PostId=Request.QueryString("postid")
Admin_Nav

If Instr(1,Session("Master_Power"),"11,")<=0 Then 
	ErrMsg="对不起,你没有访问该页面的权限"
	Call Error(1)
End If

Select Case Atcion
Case "reload"
	Call ReLoadCache
Case "update"
	Call UpDate(PostId)
Case "updatesys"
	Call ReLoadSystem
Case "markjs"
	Call MarkJs
Case Else
	Call Main
End Select

Sub Main
%>
<table width="95%" cellpadding="0" cellspacing="0" align="center" class=TableBorder>
	<tr height=22>
		<th>系统数据更新</th>
	</tr>
	<tr>
		<td class=forumRowHighlight>&nbsp;<B>注意</B>:下列这些操作可能会非常消耗服务器资源,请慎重使用</td>
	</tr>
	<form action="?atcion=reload" method=post id=form1 name=form1>
    <tr height=22>
		<td>&nbsp;&nbsp;更新系统缓存&nbsp;&nbsp;<input type="submit" name="Submit" value="开始"></td>
	</tr>
	</form>
	<form action="?atcion=update" method=post id=form2 name=form2>
    <tr height=22>
		<td>&nbsp;&nbsp;更新栏目统计数据&nbsp;&nbsp;<input type="submit" name="Submit" value="开始"></td>
	</tr>
	</form>
	<form action="?atcion=updatesys" method=post id=form3 name=form3>
    <tr height=22>
		<td>&nbsp;&nbsp;更新系统统计数据&nbsp;&nbsp;<input type="submit" name="Submit" value="开始"></td>
	</tr>
	</form>
	<form action="?atcion=markjs" method=post id=form4 name=form4>
    <tr height=22>
		<td>&nbsp;&nbsp;生成系统JS&nbsp;&nbsp;<input type="submit" name="Submit" value="开始">&nbsp;该功能将需要使用服务器FSO组件,请确认是否支持。</td>
	</tr>
	</form>
</table>
<%
End Sub

Sub ReLoadCache
	DelCahe
	SetupSystemDate

	Response.Write "重建系统缓存成功"
End Sub

Sub ReLoadSystem
	Dim ColumnTotal,UserTotal,ContentTotal,MangerTopicTotal,ReviewTotal
	ColumnTotal=0
	UserTotal=0
	ContentTotal=0
	SQL="select count(id) from [NB_Column]"
	ColumnTotal=conn.execute(sql)(0)
	SQL="select count(id) from [NB_User]"
	UserTotal=conn.execute(sql)(0)
	SQL="select count(id) from [NB_Content] where ispass=-1 and isdel=0"
	ContentTotal=conn.execute(sql)(0)
	SQL="select count(id) from [NB_Content] where ispass=0 and isdel=0"
	MangerTopicTotal=conn.execute(sql)(0)
	SQL="select count(id) from [NB_Review] where ispass=-1"
	ReviewTotal=conn.execute(sql)(0)

	SQL="update [NB_System] set reguser="&UserTotal&",TopicNum="&ContentTotal&",ColumnNum="&ColumnTotal&",MangerTopicNum="&MangerTopicTotal&",ReviewNum="&ReviewTotal
	conn.execute(sql)

	Dim i,j
	Dim Count,Tmp
	Count=0
	Sql="select id,groupName from [nb_usergroup]"
	Set rs=conn.execute(sql)
	If Not rs.eof And Not rs.bof Then
		TopicList=rs.getrows()
		Count=Ubound(TopicList,2)+1
	%>
	<table cellpadding="0" width="420" cellspacing="0" border="0" class="tableBorder">
		<tr>
			<th height="22">下面开始更新用户组统计资料,预计本次共有<%=Count%>个用户组需要更新</td>
		</tr>
		<tr>
			<td>
				<table width="400" border="0" cellspacing="1" cellpadding="1" bgcolor=000000 align=center>
					<tr>
						<td bgcolor=ffffff height=9><img src="images/bar4.gif" width=0 height=16 id=img2 name=img2 align=absmiddle></td>
					</tr>
				</table>
			</td>
		</tr>
		<tr>
			<td height="22">&nbsp;<span id=txt2 name=txt2 style="font-size:9pt">0</span><span style="font-size:9pt">%</span></td>
		</tr>		
	</table>
	<%
		For i=0 To Ubound(TopicList,2)
			SQL="select iif(count(id)=null,0,count(id)) from NB_User where user_group="&TopicList(0,i)
			Tmp=conn.execute(sql)(0)
			Sql="update nb_usergroup set usertotal="&Tmp&" where id="&TopicList(0,i)
			conn.execute(sql)
			j=j+1
			Response.Write "<script>img2.width=" & Fix((j/Count) * 400) & ";" & VbCrLf
			Response.Write "txt2.innerHTML=""更新完『 "&TopicList(1,i)&"』的数据,正在更新下一个数据," & FormatNumber(j/Count*100,4,-1) & """;</script>" & VbCrLf
			Response.Flush
		Next
		Response.Write "<script>img2.width=400;txt2.innerHTML=""100"";"& VbCrLf
		Response.Write "txt2.innerHTML=""<B>用户组数据更新完成。</B>100"";</script>"& VbCrLf
	End If
	rs.close
	Set rs=Nothing
End Sub

Function UpDate(ColumnId)
	Dim Count
	If ColumnId<>"" And IsNumeric(ColumnId) And ColumnId<>"0" Then 	
		SQL="select iif(count(id)=null,0,count(id)) from NB_Content where columnid="&ColumnId&" and isdel=0"
		Count=conn.execute(sql)(0)
		Sql="update nb_column set countnum="&Count&" where id="&ColumnId
		Conn.Execute(sql)
		ErrMsg="一个栏目更新完成"
		Call Error(0)
	Else
		Dim i,j
		Dim Tmp,Temp
		
		SQL="update [NB_Content] left join [NB_Column] c on [NB_Content].columnid=c.id set [NB_Content].columncode=c.code,[NB_Content].ColumnName=c.Title"
		Conn.Execute(SQL)

		Sql="select id,title from [nb_column]"
		Set rs=conn.execute(sql)
		If Not rs.eof And Not rs.bof Then
			TopicList=rs.getrows()
			Count=Ubound(TopicList,2)+1
		%>
		<table width="420" cellpadding="0" cellspacing="0" border="0" class="tableBorder">
			<tr>
				<th height="22">下面开始更新文件夹统计资料,预计本次共有<%=Count%>个文件夹需要更新</th>
			</tr>
			<tr>
				<td>
					<table width="400" border="0" cellspacing="1" cellpadding="1" align=center bgcolor=000000>
						<tr>
							<td bgcolor=ffffff height=9><img src="images/bar4.gif" width=0 height=16 id=img2 name=img2 align=absmiddle></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td height="22">&nbsp;<span id=txt2 name=txt2 style="font-size:9pt">0</span><span style="font-size:9pt">%</span></td>
			</tr>
		</table>
		<%
			Response.Flush 
			For i=0 To Ubound(TopicList,2)
				SQL="select iif(count(id)=null,0,count(id)) from NB_Content where columnid="&TopicList(0,i)&" and isdel=0 and ispass=-1"
				Tmp=conn.execute(sql)(0)
				SQL="select iif(count(id)=null,0,count(id)) from NB_Content where columnid="&TopicList(0,i)&" and isdel=0 and ispass=0"
				Temp=conn.execute(sql)(0)
				Sql="update nb_column set countnum="&Tmp&",mangernum="&Temp&" where id="&TopicList(0,i)
				conn.execute(sql)
				j=j+1
				Response.Write "<script>img2.width=" & Fix((j/Count) * 400) & ";" & VbCrLf
				Response.Write "txt2.innerHTML=""更新完『 "&TopicList(1,i)&"』的数据,正在更新下一个数据," & FormatNumber(j/Count*100,4,-1) & """;</script>" & VbCrLf
				Response.Flush
			Next
			Response.Write "<script>img2.width=400;txt2.innerHTML=""100"";"& VbCrLf
			Response.Write "txt2.innerHTML=""<B>文件夹数据更新完成。</B>100"";</script>"& VbCrLf
		End If
		rs.close
		Set rs=Nothing
	End If
End Function

Function SetupSystemDate
'环境变量配置函数
	Dim Temp
	Sql="select info from [nb_system]"
	Set Rs=conn.execute(sql)
	If Not rs.eof And Not rs.bof Then 
		Temp=split(rs(0),",")
		Application.Lock 
		Application(sCacheName&"SystemData")=Temp
		Application.UnLock 
	End If
End Function

Sub DelCahe()
	Application.Lock
	Application.Contents.Remove(sCacheName&"SystemData")
	Application.Contents.Remove(sCacheName&"ColumnData")
	Application.Contents.Remove(sCacheName&"Vote")
	Application.unLock

⌨️ 快捷键说明

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