📄 regclass.asp
字号:
<%response.expires=0%>
<!--#INCLUDE FILE="conn.asp" -->
<!--#INCLUDE FILE="const.asp" -->
<!--#INCLUDE FILE="char.asp" -->
<!--#INCLUDE FILE="checkuser.asp" -->
<!--#INCLUDE FILE="email.asp" -->
<html><head>
<title><%=SchoolmateName%>——班级注册</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="JavaScript" src="script/jsfun.js"></script>
<link href="txl.css" type="text/css" rel="stylesheet">
</head>
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 leftmargin=0 bgColor="<%=bodycolor%>">
<%
dim bisystemadmin,classname,enyear
bisystemadmin=isSystemadmin(0)
scID=request.form("scID")
if request("action")="join" then
call main()
elseif request("action")="passwordjoin" then
call chkclspwd()
else
call selclsform()
end if
call endconnection()
sub selclsform()
if isjoinclass(0)=true then
errmsg=errmsg+"<br>"+"<li>对不起!你已经加入了班级或者正处于班级管理员审核中,每个注册用户只能注册一个班级。"
call error(errmsg)
exit sub
end if
set rs=conn.Execute("Select * from [class] order by classname")
%>
<div align="center"><center>
<table border="0" width="671" cellspacing="0" cellpadding="0" bgcolor=<%=tablebordercolor%>>
<tr>
<td colspan="3" bgcolor="<%=tabletitlecolor%>" height="30" width="671"><p align="right"><font
color="#000000"><b><%=SchoolmateName%>——班级注册</b></font></td>
</tr>
<tr align="left" bgcolor=<%=tablebodycolor1%>>
<td width="34"></td>
<td width="609"><font color="#000000"> <form name="selsc"
action="RegClass.asp" method="POST" onsubmit="return submitonce(this)">
<input type=hidden name=action value=join>
<p>找到你的班级 </font></p>
<table border="0" width="603" bgcolor=<%=tablebordercolor%> cellspacing="1" cellpadding="0"
height="294">
<tr bgcolor=<%=tablebodycolor2%>>
<td width="601" colspan="5" height="28" ><font color="#000000">1、你的班级是下面列表中的哪一个(按班级名排序):</font></td>
</tr>
<tr bgcolor=<%=tabletitlecolor%> height=28>
<td width="27" align="center" valign="middle">选择</td>
<td width="240" align="center" valign="middle">班 级 名</td>
<td width="64" align="center" valign="middle">现有人数</td>
<td width="99" align="center" valign="middle">管理员</td>
<td align="center" valign="middle">注册时间</td>
</tr>
<%
if rs.EOF then
response.write "<tr><td colspan=5>目前还没有任何班级!</td></tr>"
else
do until rs.EOF
%>
<tr bgcolor=<%=tablebodycolor2%>><td height="1" >
<input type="Radio" name="scId" value='<%=rs("classid")%>'></td>
<td height="1" > <%=htmlencode(rs("classname"))%></td>
<td height="1" align="center" ><%=rs("studcount")%></td>
<td height="1" align="center" ><%=htmlencode(rs("admin"))%></td>
<td height="1" align="center" ><%=rs("regdate")%></td>
</tr>
<%rs.movenext
loop
end if
set rs=nothing
%>
<tr bgcolor=<%=tablebodycolor1%>>
<td width="601" height="25" align="center" valign="middle" colspan="5"><div align="left"><p><font
color="#000000"> 亲爱的用户,如果你在上表中发现有重复的</font><font
color="Brown">班级</font>,请<a href=mailto:<%=SystemEmail%>><font
color="Blue">告诉我们</font></a>! </font></td>
</tr>
<tr bgcolor="<%=tabletitlecolor%>">
<td width="601" height="28" align="center" valign="middle" colspan="5"><font
color="#800080"><div align="left"><p></font>2、如果上表中还没有你想要加入的班级,请从下面注册:</td>
</tr>
<tr bgcolor="<%=tablebodycolor2%>">
<td width="27" height="1" align="center" valign="middle"><input type="Radio" name="scId"
value="-1" checked></td>
<td width="317" height="1" align="center" valign="middle" colspan="3"><div align="left"><br> 班级名:<input name="classname" size="28" maxlength="30"> *
</div><table border="0" width="110%" cellspacing="12" cellpadding="0" align=center>
<tr>
<td width="100%"><font color="brown">注意:</font>
为避免出现同一班级多个名称的现象,班级名必须遵守以下规范!<br>
1.在班级名中尽量写明入学年份,让人一目了然,如"99级1班"<br>
2.用中文不用英文,且文字之间不能有空格.</td>
</tr>
</table>
</td>
<td width="253" height="1" align="center" valign="middle"><table border="0" width="93%"
cellspacing="0" cellpadding="0">
<tr>
<td width="100%">你要注册的班级是哪一界的(以入学年份为准):<br>
入学年份:<select
name="enyear" size="1" class="txt"><%
currentyear=cint(year(date()))
startyear=currentyear-50
for i=startyear to currentyear%>
<option value="<%=i%>" <%if i=currentyear-4 then response.write "selected"%>><%=i%></option>
<%next%>
</select> *<br>
</td>
</tr>
</table>
</td>
</tr>
</table>
<div align="right"><p><font color="#000000"><input type="submit" value="提交注册"></font></p>
</div>
</form>
</td>
<td width="28"></td>
</tr>
</table>
<%
end sub
sub add2class()
if not bisystemadmin then
sql="update [class] set studcount=studcount+1 where classid="&scID
conn.execute(sql)
end if
SQL = "Select classname,enyear from [class] where classid="&scID
set rs=conn.execute(sql)
scname=rs(0)
scenyear=rs(1)
sql="update [student] set classid="&scID&",enyear='"&scenyear&_
"',point=point+"&pJoinClass&" where userid='"&membername&"'"
conn.execute(sql)
if not bisystemadmin then
call sendjoinmail()
end if
response.write "<meta http-equiv=refresh content=3;URL=myclass.asp>"
response.write "<br><br><table cellpadding=0 cellspacing=1 border=0 width=85% bgcolor="&tablebordercolor&" align=center>"&_
"<tr><td><table cellpadding=3 cellspacing=1 border=0 width=""100%"">"&_
"<tr align=center><td width=100% bgcolor="&tabletitlecolor&"><b><FONT COLOR="&TableFontcolor&">状态:注册班级成功</font></b></td>"&_
"</tr><tr><td width=100% bgcolor="&tablebodycolor2&">"&_
"<FONT COLOR="&TableContentcolor&">您已经成功的注册了班级:<font color=red>"&htmlencode(scname)&"</font>。<br><ul>"&_
"<li><a href=myclass.asp><font color="&TableContentcolor&">进入班级页面</font></a></li>"&_
"</ul></td></tr></table></td></tr></table>"
end sub
sub waitpass()
'sql="update [class] set studcount=studcount+1 where classid="&scID
'conn.execute(sql)
SQL = "select classname,enyear from [class] where classid="&scID
set rs=conn.execute(sql)
scname=rs(0)
scenyear=rs(1)
sql="update [student] set classid="&scID&",enyear='"&scenyear&_
"',status=true where userid='"&membername&"'"
conn.execute(sql)
'update student point
stitle="发出请求"
smsg="<li>您已经成功的向<font color=brown>"&htmlencode(scname)&"</font>的班级管理员发出加入班级的请求。"
smsg=smsg&"<br>但是在没有通过班级管理员的审核前,你暂时还不能访问这个班级"
call success(stitle,smsg)
end sub
sub pswform()
%><br><br>
<form name="selsc"
action="RegClass.asp" method="POST">
<input type=hidden name=action value=passwordjoin>
<input type=hidden name="scID" value=<%=scID%>>
<table cellpadding=0 cellspacing=0 border=0 width=90% bgcolor=<%=TableborderColor%> align=center>
<tr>
<td>
<table cellpadding=5 cellspacing=1 border=0 width=100%>
<tr align="center">
<td width="100%" colspan=2 bgcolor=<%=TabletitleColor%>><font color="<%=TableFontColor%>"><b>班级注册密码验证</b></font></td>
</tr>
<tr bgcolor="<%=TablebodyColor2%>">
<td width="40%" class=mp align=center><font color="<%=TableContentColor%>">请输入班级密码:</font>
</td><td> <input type=password name=clspwd size=30> </td>
</tr>
<tr align="center">
<td width="100%" colspan=2 bgcolor=<%=TabletitleColor%>>
<input type=submit name=submit value="提交">
</td>
</tr>
</table> </td></tr></table></form>
<%
end sub
sub chkclspwd()
clspwd=request.form("clspwd")
clspwd=replace(clspwd,"'","")
scID=request.form("scID")
sql="select classpwd from [class] where classid="&scID
set rs=conn.execute(sql)
if clspwd<>rs("classpwd") then
errmsg=errmsg+"<br><li>班级密码错误!"
call error(errmsg)
exit sub
end if
call add2class()
end sub
sub joinclass()
dim rs,sql
if chkinput=false then
exit sub
end if
sql="select openlevel from [class] where classid="&scID
set rs=conn.execute(sql)
openlevel=rs(0)
if bisystemadmin then
openlevel=0
end if
select case openlevel
case 0
call add2class()
case 1
call pswform()
case 2
call waitpass()
case 3
errmsg=errmsg+"<br><li>班级管理员已经锁定了这个班级,禁止其他用户加入!"
call error(errmsg)
end select
end sub
sub sendjoinmail()
SQL = "select realname,email from [student] where userid='"&membername&"'"
set rs=conn.execute(sql)
studname=rs(0)
studmail=rs(1)
StrSQL = "select distinct email from [student] where classid="&scID&" and NewMemberFlag=true and userid<>'"&membername&"'"
set rs=conn.execute(StrSQL)
if not rs.eof and EmailFlag<>0 then
mailto=rs("email")
rs.movenext
do until rs.eof
mailto=mailto&","&rs("email")
rs.movenext
loop
set rs=nothing
mailfrom=schoolmatename
mailtopic="好消息,贵班又增新成员!--"&SchoolmateName
crlf=chr(13)&chr(10)
mailbody="亲爱的同学,您好!"&crlf&crlf
mailbody=mailbody&" 贵班("&scname&")又有新成员加入:"&crlf&crlf
mailbody=mailbody&" 姓名:"&studname&crlf
mailbody=mailbody&" EMAIL:"&studmail&crlf&crlf
mailbody=mailbody&" 快快去信给他(她)一声问候吧!"&crlf&crlf
mailbody=mailbody&" ——"&SchoolmateName&crlf
mailbody=mailbody&SchoolmateURL&crlf
if EmailFlag=1 then
call jmail()
elseif EmailFlag=2 then
call Cdonts()
elseif EmailFlag=3 then
call aspemail()
end if
end if
end sub
sub createclass()
if not bisystemadmin then studcount=1 else studcount=0
sql="insert into [class] (classname,studcount,admin,enyear,regdate,"&_
"creator,visitcount) values('"&htmlencode(classname)&"',"&studcount&",'',"&_
htmlencode(enyear)&",'"&cdate(now)&"','"&membername&"',1)"
conn.execute(sql)
sql="update [config] set classes=classes+1,lastclass='"&classname&"'"
conn.execute(sql)
SQL = "select top 1 classid from [class] order by classid desc"
set rs=conn.execute(sql)
ncid=rs(0)
sql="update [student] set point=point+"&pJoinClass&",classid="&ncid&",enyear='"&enyear&"' where userid='"&membername&"'"
conn.execute(sql)
set rs=nothing
response.write "<meta http-equiv=refresh content=3;URL=myclass.asp>"
response.write "<br><br><table cellpadding=0 cellspacing=1 border=0 width=85% bgcolor="&tablebordercolor&" align=center>"&_
"<tr><td><table cellpadding=3 cellspacing=1 border=0 width=""100%"">"&_
"<tr align=center><td width=100% bgcolor="&tabletitlecolor&"><b><FONT COLOR="&TableFontcolor&">状态:创建班级成功</font></b></td>"&_
"</tr><tr><td width=100% bgcolor="&tablebodycolor2&">"&_
"<FONT COLOR="&TableContentcolor&">您已经成功的创建了班级:<font color=red>"&htmlencode(classname)&"</font>,并成为该班级的成员。<br><ul>"&_
"<li><a href=myclass.asp><font color="&TableContentcolor&">进入班级页面</font></a></li>"&_
"</ul></td></tr></table></td></tr></table>"
end sub
sub main()
if isjoinclass(0)=true then
errmsg=errmsg+"<br>"+"<li>对不起!你已经加入了班级或者正处于班级管理员审核中,每个注册用户只能注册一个班级。"
call error(errmsg)
exit sub
end if
if chkinput=false then
exit sub
end if
if scID="-1" then
call createclass()
else
call joinclass()
end if
end sub
function chkinput()
if scID="-1" then
classname=trim(request.form("classname"))
if classname="" then
errmsg=errmsg+"<br>"+"<li>"+"请输入您要创建的班级名称!"
founderr=true
elseif strlength(classname)<5 then
errmsg=errmsg+"<br>"+"<li>"+"班级名称不得少于5个字符!"
founderr=true
elseif strlength(classname)>20 then
errmsg=errmsg+"<br>"+"<li>"+"班级名称不得多于20个字符!"
founderr=true
else
sql="select classid from [class] where classname='"&classname&"'"
set rs=conn.execute(sql)
if not rs.eof then
errmsg=errmsg+"<br>"+"<li>"+"您输入的班级名已经存在,请在班级列表中选择或重新输入其他班级名!"
founderr=true
end if
end if
enyear=request.form("enyear")
thisyear=cint(year(date()))
startyear=currentyear-50
if not isinteger(enyear) or not (cint(enyear)>startyear or cint(enyear)<thisyear ) then
errmsg=errmsg+"<br>"+"<li>"+"您提交的数据非法!"
founderr=true
end if
else
sql="select classid from [class] where classid="&scID
set rs=conn.execute(sql)
if rs.eof then
errmsg=errmsg+"<br>"+"<li>"+"您选择的班级不存在!"
founderr=true
end if
end if
if founderr=true then
call error(errmsg)
chkinput=false
else
chkinput=true
end if
end function
%>
<!--#INCLUDE FILE="footer.asp" -->
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -