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

📄 admin_update.asp

📁 此文件为一个电子同学录
💻 ASP
字号:
<!--#include file="conn.asp"-->
<!-- #include file="inc/const.asp" -->
<title><%=txl_info(0)%>--管理页面</title>
<!--#include file="inc/admin_css.asp"-->
<meta NAME=GENERATOR Content="Microsoft FrontPage 3.0" CHARSET=GB2312>
<BODY leftmargin="0" bottommargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#DDEEFF">
<%
if not supermaster or session("flag")="" then
	Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=admin_index.asp target=_top>登陆</a>后进入。<br><li>您没有管理本页面的权限。"
	call txl_error()
else
	dim tmprs
	dim body
	call main()
	conn.close
	set conn=nothing
end if

sub main()
%>
<table cellpadding="2" cellspacing="1" border="0" width="95%" class="tableBorder" align=center>
<tr>
<th colspan=2 height=23>更新同学录数据</th>
</tr>
<tr>
<td width="20%" class="txlrow">注意事项</td>
<td width="80%" class="txlrow">①建议每隔一段时间,更新以下数据;<br>②下面有的操作可能将非常消耗服务器资源,而且更新时间很长,请仔细确认每一步操作后执行。</td>
</tr>
<%
	if request("action")="all" then
		call all()
	elseif request("action")="user" then
		call user()
	elseif request("action")="updateall" then
		call updateall()
		if founderr then
		response.write errmsg
		else
		response.write body
		end if
	elseif request("action")="updateuser" then
		call updateuser()
		if founderr then
		response.write errmsg
		else
		response.write body
		end if
	end if
%>
</table>
<%
	end sub

	sub all()
%>
<form action="admin_update.asp?action=updateall" method=post>
<tr> 
<th align=left colspan=2 height=23>更新同学录数据</th>
</tr>
<tr>
<td width="20%" class="txlrow">更新同学录总数据</td>
<td width="80%" class="txlrow">这里将重新计算整个同学录班级留言数、班级论坛帖子数、注册用户数、班级照片数、最后加入用户等,建议每隔一段时间运行一次。<BR><BR><input type="submit" name="Submit" value="更新同学录总数据"></td>
</tr>
</form>
<%
	end sub

	sub updateall()
	sql="update config set BbsNum="&BbsNum()&",GbookNum="&GbookNum()&",PhotoNum="&PhotoNum()&",UserNum="&allusers()&",lastUser='"&newuser()&"'"
	conn.execute(sql)
	body="<tr><td colspan=2 class=txlrow>更新同学录总数据成功,同学录共有"&BbsNum()&"篇贴子,"&GbookNum()&"篇留言,"&PhotoNum()&"张照片,有"&allusers()&"用户,最新加入为"&newuser()&"。</td></tr>"
	end sub

	'所有论坛主题
	function BbsNum() 
	tmprs=conn.execute("Select Count(topicid) from topic where islock<2") 
	BbsNum=tmprs(0) 
	set tmprs=nothing 
	if isnull(BbsNum) then BbsNum=0 
	end function 

	'所有留言数
	function GbookNum() 
	tmprs=conn.execute("Select Count(postid) from gbook where rootid=0") 
	GbookNum=tmprs(0) 
	set tmprs=nothing 
	if isnull(GbookNum) then GbookNum=0 
	end function 

	'所有照片数
	function PhotoNum() 
	tmprs=conn.execute("Select Count(picid) from imgdata where picset<2") 
	PhotoNum=tmprs(0) 
	set tmprs=nothing 
	if isnull(PhotoNum) then PhotoNum=0 
	end function 

	'所有注册用户数量
	function allusers() 
	tmprs=conn.execute("Select count(userid) from [user]") 
	allusers=tmprs(0) 
	set tmprs=nothing 
	if isnull(allusers) then allusers=0 
	end function

	'最新注册用户
	function newuser()
	sql="Select top 1 realname from [user] order by userid desc"
	set tmprs=conn.execute(sql)
	if tmprs.eof and tmprs.bof then
		newuser="没有会员"
	else
   		newuser=tmprs("realname")
	end if
	set tmprs=nothing
	end function

	sub user()
%> 
<form action="admin_update.asp?action=updateuser" method=post>
<tr> 
<th align=left colspan=2 height=23>更新用户数据</th>
</tr>
<tr>
<td width="20%" class="txlrow">更新用户总数据</td>
<td width="80%" class="txlrow">这里将重新计算用户留言数、班级论坛帖子数、金钱数、班级照片数、登录数用户等,建议每隔一段时间运行一次。<BR><BR><input type="submit" name="Submit" value="更新同学录总数据"></td>
</tr>
</form>
<%
	end sub

	sub updateuser()
	dim bbscount,bookcount,photocount
	sql="select logins,userid from [user] order by userid desc"
	set rs=conn.execute(sql)
	do while not rs.eof
		bbscount=bbscountNum(rs(1))
		bookcount=bookcountNum(rs(1))
		photocount=photocountNum(rs(1))
		usermoney=txl_user(0)+rs(0)*txl_user(1) + bbscount*txl_user(2) + bookcount*txl_user(6) + photocount*txl_user(9)
		if isnull(usermoney) or not isnumeric(usermoney) then usermoney=0
	conn.execute("update [user] set usermoney="&usermoney&",bbscount="&bbscount&",bookcount="&bookcount&",photocount="&photocount&" where userid="&rs(1))
	rs.movenext
	loop
	set rs=nothing
	body="<tr><td colspan=2 class=txlrow>更新同学录用户数据成功。</td></tr>"

	end sub

	'用户发帖数
	function bbscountNum(userid) 
	tmprs=conn.execute("Select Count(bbsid) from bbs where PostUserID="&userid) 
	bbscountNum=tmprs(0) 
	set tmprs=nothing 
	if isnull(bbscountNum) then bbscountNum=0 
	end function 

	'用户留言数
	function bookcountNum(userid) 
	tmprs=conn.execute("Select Count(postid) from gbook where PostUserID="&userid) 
	bookcountNum=tmprs(0) 
	set tmprs=nothing 
	if isnull(bookcountNum) then bookcountNum=0 
	end function 

	'用户上传照片数
	function photocountNum(userid) 
	tmprs=conn.execute("Select Count(PicID) from imgdata where PostUserID="&userid) 
	photocountNum=tmprs(0) 
	set tmprs=nothing 
	if isnull(photocountNum) then photocountNum=0 
	end function 
%>

⌨️ 快捷键说明

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