📄 bj.asp
字号:
<!--#include file="config.asp"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<!--#include file="head.asp"-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title><%=Sitename%>-班级</title>
<LINK href="css.css" type=text/css rel=stylesheet>
</head>
<body>
<%sitehead%>
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td height="291" valign="top">
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
<tr>
<td width="85%" height="25"> <img src="skins/1/xb3.gif"> 当前位置:<a href="index.asp">首页</a> >> <a href="bj.asp">班级</a></td>
<td width="15%"><%if session("xyluser")<>"" then%><a href="#add">创建班级</a><%end if%></td>
</tr>
</table>
<br>
<%Select Case request("type2")
Case "join":
Call joinbj
Case "add":
Call add
Case "outbj":
Call outbj
Case Else:
call show
End Select
sub show%>
<table width="95%" border="0" align="center" cellpadding="1" cellspacing="2" bgcolor="#F7F7F7">
<form name="form1" method="post" action=""><tr>
<td width="16%" height="25" bgcolor="#FFCFCE"><div align="center">
班级搜索</div></td>
<td width="38%"><div align="center">班级名称:
<input name="bjname" type="text" class="formtext" id="bjname" value="<%=request("bjname")%>" maxlength="15">
<input name="Submit" type="submit" class="bottom" value="提交">
</div></td>
<td width="46%">提示:本站的班级名称是由专业+入学年份+班级编号组成</td>
</tr></form>
</table>
<br>
<table width="95%" border="0" align="center" cellpadding="1" cellspacing="2" class="border">
<tr bgcolor="#FFCFCE">
<td width="27%" height="20"><div align="center">班级名称</div></td>
<td width="11%"><div align="center">辅导员</div></td>
<td width="11%"><div align="center">创始人</div></td>
<td width="11%"><div align="center">管理员</div></td>
<td width="11%"><div align="center">副管理员</div></td>
<td width="11%"><div align="center">创建日期</div></td>
<td width="18%"><div align="center">操作</div></td>
</tr>
<%bjname=obj.regstr(request("bjname"))
if bjname="" then
rs.open "select * from bj order by bjname,id desc",conn,1,1
else
rs.open "select * from bj where bjname like '%"&bjname&"%' order by bjname,id desc",conn,1,1
end if
If Rs.eof and Rs.bof Then
Response.Write("<tr><td colspan=8>暂无班级</td></tr>")
else
dim strFileName,i,j,totalPut,CurrentPage,TotalPages
totalPut=rs.recordcount
const MaxPerPage=30
strFileName="?bjname="&bjname&""
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
if currentPage<>1 and (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
else
currentPage=1
end if
i=0
do while not rs.eof%>
<tr bgcolor="#F7F7F7">
<td height="20"><div align="center"><%=rs("bjname")%></div></td>
<td><div align="center"><%=rs("sir")%></div></td>
<td><div align="center"><A href="datum.asp?userid=<%=rs("first")%>"><%=obj.getname(rs("first"),1,SiteDatabase)%></a></div></td>
<td><div align="center"><A href="datum.asp?userid=<%=rs("adminid")%>"><%=obj.getname(rs("adminid"),1,SiteDatabase)%></a></div></td>
<td><div align="center"><A href="datum.asp?userid=<%=rs("adminid2")%>"><%=obj.getname(rs("adminid2"),1,SiteDatabase)%></a></div></td>
<td><div align="center"><%=rs("date")%></div></td>
<td><div align="center"><a href="bjindex.asp?bid=<%=rs(0)%>">浏览班级</a> <a href="?type2=join&id=<%=rs(0)%>">加入班级</a></div></td>
</tr>
<%i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
end if%>
</table>
<br>
<table width="95%" align="center" cellpadding="1" cellspacing="1" bordercolor="#CCCCCC" class="border">
<tr>
<td height="25" bgcolor="#f9f8f2"><div align="center"><%=obj.showpage(strFileName,totalput,MaxPerPage,true,true,"条",currentPage)%></div></td>
</tr>
</table>
<%rs.close
if session("xyluser")<>"" then%>
<br>
<table width="95%" border="0" align="center" cellpadding="1" cellspacing="2" class="border">
<form name="myform" method="post" action="?type2=add">
<tr bgcolor="#F7F7F7">
<td width="11%" height="20"><a name="add"></a></td>
<td width="89%">创建班级</td>
</tr>
<tr valign="top">
<td height="20">入学年份:</td>
<td> <select name="bydate" size="1">
<%rs.open "select * from [bydate] order by bydate",conn,1,1
do while not rs.eof%>
<option><%=rs("bydate")%></option>
<%rs.movenext
loop
rs.close%>
</select></td>
</tr>
<tr valign="top">
<td height="20">院系专业:</td>
<td><%call yx%></td>
</tr>
<tr valign="top">
<td height="20">班级编号:</td>
<td> <select name="byclass" size="1">
<%
rs.open "select byclass from byclass",conn,1,1
do while not rs.eof%>
<option><%=rs("byclass")%></option>
<%rs.movenext
loop
rs.close%>
</select></td>
</tr>
<tr>
<td height="20">辅 导员:</td>
<td valign="top"><input name="sir" type="text" class="formtext" id="sir" maxlength="4"></td>
</tr>
<tr valign="top">
<td height="20">班级简介:</td>
<td><textarea name="bjjz" cols="50" rows="7" id="bjjz"></textarea>
用于让校友们了解本班,向校友们展示本班特色</td>
</tr>
<tr valign="top">
<td height="20"> </td>
<td><input name="Submit" type="submit" class="bottom" value="提交"></td>
</tr></form>
</table><br>
<%end if
end sub
sub add
if session("xyluserid")="" then ShowError("请先登录!")
bydate=obj.HtmlEncode(request.form("bydate"))
byclass=obj.HtmlEncode(request.form("byclass"))
BigClassName=obj.HtmlEncode(request.form("BigClassName"))
SmallClassName=obj.HtmlEncode(request.form("SmallClassName"))
sir=obj.HtmlEncode(request.form("sir"))
bjjz=obj.HtmlEncode(request.form("bjjz"))
if bydate="" or byclass="" or BigClassName="" or SmallClassName="" or sir="" or bjjz="" then ShowError("缺少参数!")
bjname=SmallClassName&bydate&byclass
rs.open "select * from bj where bjname='"&bjname&"'",conn,1,3
if not rs.eof then ShowError("班级已存在!")
rs.addnew
rs("bjname")=bjname
rs("date")=date
rs("sir")=sir
rs("first")=session("xyluserid")
rs("adminid")=session("xyluserid")
rs("adminid2")=session("xyluserid")
rs("bjjz")=bjjz
rs.update
bid=rs("id")
rs.close
if obj.joinbj(session("xyluserid"),bid,SiteDatabase)<>1 then ShowError("创建的班级成功,但将你加入本班时出现错误,请联系站长")
set rs=nothing
a=obj.gourl(" 页面三秒后将自动返回您所创建的班级,可以继续选择以下操作:<br><br> 返回<A href='bj.asp'>[班级列表]</a><br><br> 到<A href='bjindex.asp?bid="&bid&"'>[刚创建的班级]</a>","bjindex.asp?bid="&bid&"")
end sub
sub joinbj
if session("xyluserid")="" then ShowError("请先登录!")
id=int(request("id"))
if id<1 or id="" then ShowError("缺少参数!")
if obj.inbj(session("xyluserid"),id,SiteDatabase)=1 then ShowError("你已经是本班的成员了")
set rs=conn.execute ("select count(id) from user where instr(','&bjid&',' ,',"&id&",')>0")
if rs(0)<10 then
if obj.joinbj(session("xyluserid"),id,SiteDatabase)<>1 then ShowError("在加入班级时出现错误,请联系站长")
rs.close
else
rs.close
rs.open "select * from app where userid="&session("xyluserid")&" and bjid="&id&"",conn,1,1
if not rs.eof then ShowError("你已经提交过申请了,请等候同学们的审核!")
rs.close
conn.Execute "INSERT INTO app (userid,bjid,adddate) values ("&session("xyluserid")&","&id&",'"&now&"')"
end if
set rs=nothing
a=obj.gourl(" 页面三秒后将自动返回您所申请的班级,可以继续选择以下操作:<br><br> 返回<A href='bj.asp'>[班级列表]</a><br><br> 到<A href='bjindex.asp?bid="&id&"'>[刚申请的班级]</a>","bjindex.asp?bid="&id&"")
end sub
sub outbj
bid=clng(request("bid"))
if session("xyluserid")="" then ShowError("请先登录!")
aa=obj.outbj(session("xyluserid"), bid, sitedatabase)
if aa=2 then ShowError("退出班级时出错,正管理员不能退出本班")
if aa<>1 then ShowError("退出班级时出错,请联系站长")
a=obj.gourl(" 页面三秒后将自动返回班级首页,可以继续选择以下操作:<br><br> 返回<A href='index.asp'>[学校首页]</a><br><br> 到<A href='bjindex.asp?bid="&bid&"'>[班级首页]</a>","bjindex.asp?bid="&bid&"")
end sub%>
</td></tr>
</table>
<%sitebottom%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -