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

📄 clsadm_member.asp

📁 酷虎网同学录V1.0
💻 ASP
字号:
<!--#INCLUDE FILE="setup.asp" -->
<!--#INCLUDE FILE="char.asp" -->
<!--#INCLUDE FILE="checkuser.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<%locat="班级管理"
act="管理班级成员"
if membername="" then
  	errmsg=errmsg+"<br>"+"<li>您还没有<a href=login.asp>登录</a>。"
	call top(1,1)
	call error("Information",errmsg)
else
	joinstatus=chkjoinclass(clsid)
	if joinstatus<>"" then
		call top(1,1)
		call error("Exclamation",joinstatus)
	else
		call top(2,1)
		if isclassadmin(0)=0 and not sysadmin then
			errmsg=errmsg+"<br><li>对不起!您不是班级管理员。"
			call error("Exclamation",errmsg)
		else
			select case request("action")
			case "踢出班级"
				call delmember()
			case "移交大权"
				call handover()
			case "通过审核"
				call passjoin()
			case "禁止加入"
				call refusejoin()
			case else
				call classmatelist()
			end select
		end if
	end if
end if


sub  refusejoin()
passid=request.form("wid")
if passid="" or isnull(passid) then
	Errmsg=Errmsg+"<li>"+"请选择要进行操作的同学。"
	call error("Exclamation",errmsg)
	exit sub
end if

idlist=split(passid,",")

for i= 0 to ubound(idlist)
studid=clng(idlist(i))
if chkauditing(studid)=true then

tmpsql="update [student] set classcount=classcount-1 where studid="&studid
conn.execute(tmpsql)

tmpsql="delete from [joinclass] where isauditing=true and classid="&clsid&" and userid=(select userid from student where studid ="&studid&")"
conn.execute(tmpsql)
end if
next

stitle="审核班级成员"
smsg="<br>"+"<li><b>你已经成功禁止所选同学加入到你们班级!"
call success(stitle,smsg)

end sub


sub  passjoin()
passid=request.form("wid")
if passid="" or isnull(passid) then
	Errmsg=Errmsg+"<li>"+"请选择要通过审核的同学。"
	call error("Exclamation",errmsg)
	exit sub
end if

idlist=split(passid,",")

for i= 0 to ubound(idlist)
studid=clng(idlist(i))
if chkauditing(studid)=true then
conn.execute("update [class] set studcount=studcount+1 where classid="&clsid)
conn.execute("update [student] set point=point+"&pJoinclass&" where studid="&studid)
conn.execute("update [joinclass] set isauditing=false,jointime=#"&now&"#,lastvisit=#"&now&_
"# where isauditing=true and classid="&clsid&" and userid=(select userid from [student] where studid="&studid&")")
end if
next

stitle="审核班级成员"
smsg="<br>"+"<li><b>恭喜您,成功将所选同学通过审核并加入到你们班级!"
call success(stitle,smsg)

end sub

sub classmatelist()
dim studcount
dim rs,sql
%>
<br><br>
<form action="clsadm_member.asp" method=post>
<table align=center cellpadding=4 cellspacing=1 border=0 width=500 bgcolor=<%=tablebordercolor%>>
  <TBODY><TR align=middle bgcolor=<%=tabletitlecolor%>>
    <Th height=24 colspan=3><b>班级成员管理
</b></Th></TR>
<%
sql="select userid,studid,realname from [student] where userid in (select "&_
"userid from joinclass where classid="&clsid&" and isauditing=false)"
set rs=conn.execute(sql)

studcount=1
do until rs.eof
%>
  <TR  height=10 bgcolor=<%=tablebodycolor2%>>
    <TD  valign=center align=center><%=studcount%>
	</TD> <TD  valign=center align=center><%=htmlencode(rs(2))%>(<%=htmlencode(rs(0))%>)
	</TD> 

	<TD  valign=center align=center><input type="Radio" name="id" value="<%=rs(1)%>"></td>

	</TD>
   </TR>
   <%rs.movenext
   studcount=studcount+1
   loop
  set rs=nothing
   %>
<TR align=middle bgcolor=<%=tablebodycolor1%>>
    <TD height=24 colspan=3 align=right><input type="submit" name="action" value="踢出班级">&nbsp;&nbsp;<input type=submit name="action" value="移交大权"></TD></TR>

</TBODY></TABLE>

<BR>
<%
set rs=conn.execute("select openlevel from class where classid="&clsid)
if not rs.eof and rs(0)=2 then call waitpasslist()
set rs=nothing

%>
</form>
<%
end sub

sub waitpasslist()
%>

                <table align=center cellpadding=6 cellspacing=1 border=0 width=500 bgcolor=<%=tablebordercolor%>>
  <TBODY>
  <TR align=middle bgcolor=<%=tabletitlecolor%>>
    <Th height=24 colspan=3><b>管理未审核的同学
</b></Th></TR>

<%

sql="select userid,studid,realname from [student] where userid in (select userid from joinclass where classid="&clsid&" and isauditing=true)"
set rs=conn.execute(sql)
if rs.eof then
response.write "<tr bgcolor="&tablebodycolor2&"><td colspan=3>不存在没有审核的同学:(</td></tr>"
else
studcount=1
do until rs.eof
%>
  
  <TR  height=10 bgcolor=<%=tablebodycolor2%>>
    <TD  valign=center align=center><%=studcount%>
	</TD> <TD  valign=center align=center><%=htmlencode(rs(2))%>(<%=htmlencode(rs(0))%>)
	</TD> <TD  valign=center align=center><font color=blue><input type=checkbox name=wid value=<%=cstr(rs(1))%>></a>
	</TD>
   </TR>
   <%rs.movenext
   studcount=studcount+1
   loop
   
end if%>

  <TR align=middle bgcolor=<%=tabletitlecolor%>>
    <TD height=24 colspan=3 align=right><input type=submit name=action value="通过审核">&nbsp;&nbsp;<input type=submit name=action value="禁止加入"></TD></TR>
</TBODY></TABLE>


<%end sub


sub delmember()
dim delid,mbstatus
dim founderr,errmsg
dim stitle,smsg
delid=request.form("id")

if delid="" then
	errmsg=errmsg+"<li>没有操作请求,你试图进行非法操作!"
	call error("Critical",errmsg)
	exit sub
end if

delid=clng(delid)

mbstatus=chkmember(delid)
if mbstatus=0 then
	errmsg=errmsg+"<li>操作失败,该同学不是本班成员!"
	founderr=true
elseif mbstatus>1 then
	errmsg=errmsg+"<li>操作失败,不能对其他班级管理员执行此操作!"
	founderr=true
end if

if founderr=true then
	call error("Critical",errmsg)
	exit sub
end if

sql="update class set studcount=studcount-1 where classid="&clsid
conn.execute(sql)

sql="update student set classcount=classcount-1,point=point+"&pExitClass&" where studid="&delid
conn.execute(sql)

sql="delete from joinclass where classid="&clsid&" and userid=(select "&_
"userid from student where studid="&delid&")"
conn.execute(sql)

stitle="管理操作成功"
smsg="你已经成功的将所选成员剔出本班!"
call success(stitle,smsg)

end sub

sub handover()
dim toid,errmsg,founderr
dim mbstatus,stitle,smsg

toid=request.form("id")

if toid="" then
	errmsg=errmsg+"<li>没有操作请求,你试图进行非法操作!"
	call error("Critical",errmsg)
	exit sub
end if

toid=clng(toid)

mbstatus=chkmember(toid)
if mbstatus=0 then
	errmsg=errmsg+"<li>操作失败,该同学不是本班成员!"
	founderr=true
elseif mbstatus>1 then
	errmsg=errmsg+"<li>操作失败,不能对其他班级管理员执行此项操作!"
	founderr=true
end if

if founderr=true then
	call error("Critical",errmsg)
	exit sub
end if

clsadm=isclassadmin(0)

if clsadm=0 then
	errmsg=errmsg+"<li>操作失败,系统管理员不能执行此项操作!"
	call error("Critical",errmsg)
	exit sub
end if


sql="select userid from student where studid="&toid
set rs=conn.execute(sql)


if clsadm=2 then
	sql="update class set admin1='"&rs(0)&"' where classid="&clsid&" and admin1='"&membername&"'"
	conn.execute(sql)
elseif clsadm=1 then
	sql="update class set admin2='"&rs(0)&"' where classid="&clsid&" and admin2='"&membername&"'"
	conn.execute(sql)
end if

sql="update student set point=point+"&PResignAdmin&" where userid='"&membername&"'"
conn.execute(sql)
sql="update joinclass set degree=1 where classid="&clsid&" and userid='"&membername&"'"
conn.execute(sql)

sql="update student set point=point+"&pApplyAdmin&" where studid="&toid
conn.execute(sql)
sql="update joinclass set degree=6+"&clsadm&" where classid="&clsid&" and userid='"&rs(0)&"'"
conn.execute(sql)

stitle="管理操作成功"
smsg="你已经成功将管理员身份移交给所选班级成员!"
call success(stitle,smsg)
end sub


function chkmember(byval memberid)
dim tmprs,tmpsql
tmpsql="select degree from joinclass where classid="&clsid&_
" and isauditing=false and userid=(select userid from student where studid="&memberid&")"
set tmprs=conn.execute(tmpsql)
if tmprs.eof then
	chkmember=0
else
	chkmember=tmprs(0)
end if

end function


function chkauditing(byval memberid)
dim tmprs,tmpsql
tmpsql="select isauditing from joinclass where classid="&clsid&_
" and isauditing=true and userid=(select userid from student where studid="&memberid&")"
set tmprs=conn.execute(tmpsql)
chkauditing=not tmprs.eof
end function



%>
</td></tr></table>
<%call footer%>

⌨️ 快捷键说明

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