?? 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 + -