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

📄 sysadm_update.asp

📁 酷虎网同学录V1.0
💻 ASP
字号:
<!--#INCLUDE FILE="setup.asp" -->
<!--#include file=char.asp-->
<!--#include file=checkuser.asp-->
<title><%=SchoolmateName%>--管理页面</title>
<!--#include file="css.asp"-->

<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<%
	if  not sysadmin or session("adminlogin")<>"OK" then
		Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=sysadm_index.asp target=_top>登陆</a>后进入。"
		call Error("Information",errmsg)
	else
		call main()
		call endconnection()
	end if

	sub main()
%><BR>
<table cellpadding=0 cellspacing=0 border=0 width=90% bgcolor=<%=tablebordercolor%> align=center>
  <tr>
    <td>
      <table cellpadding=3 cellspacing=1 border=0 width=100%>
        <tr bgcolor='<%=Tabletitlecolor%>'>
        <td><font color="<%=TablefontColor%>">欢迎<b><%=membername%></b>进入管理页面</font>
        </td>
        </tr>
            <tr bgcolor=<%=tablebodycolor2%>>
              <td width="100%" valign=top><font color="<%=TableContentColor%>">
<%
if request("action")="update" then
call update()
else
call updateoption()
end if
%></font>
	      </td>
            </tr>
        </table>
        </td>
    </tr>
</table>
<%
end sub

sub updateoption()
%>
<BR>
<form method="POST" action=sysadm_update.asp?action=update>
<table width="95%" border="0" cellspacing="1" cellpadding="3"  align=center bgcolor=<%=Tablebordercolor%>>
<tr bgcolor=<%=Tabletitlecolor%>> 
<td height="11" colspan="2" ><font color="<%=TableContentColor%>"><b>数据更新与维护</b></font></td>
</tr>
<tr  bgcolor=<%=Tablebodycolor2%>> 
<td width="41%" height="18"><font color="<%=TableContentColor%>">重新统计同学录注册用户总数、注册班级总数</font></td>
<td width="59%" height="18"> 
<input type="checkbox" name="option1" value="1">
</td>
</tr>
<tr   bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">重新统计每个班级内的成员数</font></td>
<td width="59%" height="18"> 
        <input type="checkbox" name="option2" value="1">
</td></tr>

<tr   bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">重新统计每个用户注册的班级数</font></td>
<td width="59%" height="18"> 
        <input type="checkbox" name="option3" value="1">
</td></tr>
<tr   bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">重新统计校园论坛主题数、帖子数</font></td>
<td width="59%" height="18"> 
        <input type="checkbox" name="option4" value="1">
</td></tr>
<tr   bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">清理数据库中的无用数据</font></td>
<td width="59%" height="18"> 
        <input type="checkbox" name="option5" value="1">
</td></tr>

<tr bgcolor=<%=Tabletitlecolor%>> 
<td height="23" colspan="2" align=right > 
<input type="submit" name="Submit" value="执行操作">
</td>
</tr>
</table>
</form>
<%
end sub

sub update()

dim rs,sql

if request("option1")="1" then
	set rs=conn.execute("select count(classid) from [class] where classname<>'' and classname is not null")
	conn.execute("update [config] set classes="&rs(0))
	set rs=nothing
	

	set rs=conn.execute("select count(userid) from [student] where userid<>'' and userid is not null")
	conn.execute("update [config] set users="&rs(0))
	set rs=nothing
end if


if request("option2")="1" then
	conn.execute("update [class] set studcount=0")
	sql="select classid,count(classid) from [joinclass] group by classid order by classid"
	set rs=conn.execute(sql)
	do until rs.eof
	conn.execute("update [class] set studcount="&rs(1)&" where classid="&rs(0))
	rs.movenext
	loop
	set rs=nothing
end if


if request("option3")="1" then
	conn.execute("update [student] set classcount=0")
	sql="select userid,count(userid) from [joinclass] group by userid order by userid"
	set rs=conn.execute(sql)
	do until rs.eof
	conn.execute("update [student] set classcount="&rs(1)&" where userid='"&rs(0)&"'")
	rs.movenext
	loop
	set rs=nothing
end if

if request("option4")="1" then
	sql="select count(bbsid) from bbs where parentid=0"
	set rs=conn.execute(sql)
	sql="update config set topicnum="&rs(0)
	conn.execute(sql)
	set rs=nothing
	sql="select count(bbsid) from bbs"
	set rs=conn.execute(sql)
	sql="update config set bbsnum="&rs(0)
	conn.execute(sql)
	set rs=nothing
end if

if request("option5")="1" then
	sql="delete from [student] where userid='' or userid is null"
	conn.execute(sql)

	sql="delete from [class] where classname='' or classname is null"
	conn.execute(sql)

	sql="delete from [joinclass] where classid is null or userid is null"
	conn.execute(sql)

	sql="delete from [schoolboard] where name is null or name=''"
	conn.execute(sql)

	sql="delete from [append] where classid=0 or classid is null"
	conn.execute(sql)

	sql="delete from [classboard] where classid=0 or classid is null"
	conn.execute(sql)
end if

%><center><p><b>数据维护成功!</b>
<%
end sub
%>



⌨️ 快捷键说明

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