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

📄 sysadm_merge.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()
		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="clsadm1" 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="clsadm2" size="35" >
</td></tr>
<tr   bgcolor=<%=Tablebodycolor2%> >
<td colspan=2 height="18"><font color="<%=TableContentColor%>"><b>说明:</b>合并后的班级将保留班级1的班级信息,如果合并前班级2的开放等级为班长审核请改为完全开放后再执行合并操作!</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不存在。"
	founderr=true
else
	class1=rs(0)
end if

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不存在。"
	founderr=true
else
	class2=rs(0)
end if

clsadm1=trim(request.form("clsadm1"))

if clsadm1<>"" then
	sql="select userid from [joinclass] where userid='"&clsadm1&"' and (classid="&class1&" or classid="&class2&")"
	set	rs=conn.execute(sql)
	if rs.eof then
		errmsg=errmsg+"<br>"+"<li>对不起,"&clsadm1&"不是这两个班级的成员。"
		founderr=true
	end if

end if

clsadm2=trim(request.form("clsadm2"))


if clsadm2<>"" then
	sql="select userid from [joinclass] where userid='"&clsadm2&"' and (classid="&class1&" or classid="&class2&")"
	set	rs=conn.execute(sql)

	if rs.eof then
		errmsg=errmsg+"<br>"+"<li>对不起,"&clsadm2&"不是这两个班级的成员。"
		founderr=true
	end if

end if

if founderr=true then
	call error("Information",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 admin1,admin2 from [class] where classid="&class1&" or classid="&class2
set rs=conn.execute(sql)
do until rs.eof
	conn.execute("update student set point=point+"&PResignAdmin&" where userid='"&rs(0)&"' or userid='"&rs(1)&"'")
rs.movenext
loop

sql="update [student] set point=point+"&pApplyAdmin&" where userid='"&clsadm1&"' or userid='"&clsadm2&"'"
conn.execute(sql)

sql="update class set admin1='"&clsadm1&"',admin2='"&clsadm2&"' where classid="&class1
conn.execute(sql)

sql="delete from joinclass where classid="&class2&" and userid in(select userid from joinclass where classid="&class1&")"
conn.execute(sql)

sql="update [joinclass] set classid="&class1&" where classid="&class2
conn.execute(sql)

sql="select count(userid) from [joinclass] where classid="&class1
set rs=conn.execute(sql)

sql="update [class] set studcount=studcount+"&rs(0)&" where classid="&class1
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 + -