📄 sysadm_merge.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="const.asp" -->
<!--#include file=char.asp-->
<!--#include file=checkuser.asp-->
<title><%=SchoolmateName%>--管理页面</title>
<link rel="stylesheet" type="text/css" href="txl.css">
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<%
if issystemadmin(0)=false or session("adminlogin")<>"OK" then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=sysadm_index.asp target=_top>登陆</a>后进入。"
call Error(errmsg)
else
call main()
set rs=nothing
conn.close
set conn=nothing
end if
sub main()
%><BR>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> 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")="merge" then
call merge()
else
call classinfo()
end if
%></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
end sub
sub classinfo()
%>
<BR>
<form method="POST" action=sysadm_merge.asp?action=merge>
<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%>">班级名1</font></td>
<td width="59%" height="18">
<input type="text" name="classname1" size="35" >
</td>
</tr>
<tr bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">班级名2</font></td>
<td width="59%" height="18">
<input type="text" name="classname2" size="35" >
</td></tr>
<tr bgcolor=<%=Tablebodycolor2%> >
<td width="41%" height="18"><font color="<%=TableContentColor%>">合并后班级的管理员</font></td>
<td width="59%" height="18">
<input type="text" name="clsadm" size="35" >
</td></tr>
<tr bgcolor=<%=Tablebodycolor2%> >
<td colspan=2 height="18"><font color="<%=TableContentColor%>"><b>说明:</b>合并后的班级将保留班级1的班级信息</font></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 merge()
classname1=trim(request.form("classname1"))
sql="select classid from [class] where classname='"&classname1&"'"
set rs=conn.execute(sql)
if rs.eof then
errmsg=errmsg+"<br>"+"<li>班级1不存在。"
call error(errmsg)
exit sub
end if
class1=rs(0)
classname2=trim(request.form("classname2"))
sql="select classid from [class] where classname='"&classname2&"'"
set rs=conn.execute(sql)
if rs.eof then
errmsg=errmsg+"<br>"+"<li>班级2不存在。"
call error(errmsg)
exit sub
end if
class2=rs(0)
clsadm=trim(request.form("clsadm"))
sql="select userid from [student] where userid='"&clsadm&"' and (classid="&class1&" or classid="&class2&")"
set rs=conn.execute(sql)
if rs.eof then
errmsg=errmsg+"<br>"+"<li>对不起,"&clsadm&"不是这两个班级的成员。"
call error(errmsg)
exit sub
end if
sql="update [classboard] set classid="&class1&" where classid="&class2
conn.execute(sql)
sql="update [photo] set classid="&class1&" where classid="&class2
conn.execute(sql)
sql="update [append] set classid="&class1&" where classid="&class2
conn.execute(sql)
sql="select studcount from [class] where classid="&class2
set rs=conn.execute(sql)
sql="update [class] set studcount=studcount+"&rs(0)&" where classid="&class1
conn.execute(sql)
sql="update [student] set isadmin=0,point=point+"&PResignAdmin&" where isadmin=1 and userid<>'"&clsadm&"' and (classid="&class1&" or classid="&class2&")"
conn.execute(sql)
sql="update [student] set isadmin=1,point=point+"&pApplyAdmin&" where userid='"&clsadm&"' and isadmin=0"
conn.execute(sql)
sql="update [class] set admin='"&clsadm&"' where classid="&class1
conn.execute(sql)
sql="update [student] set classid="&class1&" where classid="&class2
conn.execute(sql)
sql="delete from [class] where classid="&class2
conn.execute(sql)
set rs=nothing
%><center><p><b>班级合并成功!</b>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -