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

📄 admin_count.asp

📁 本科毕业课程设计!学生管理系统!功能相当强大
💻 ASP
字号:
<%if session("password")<>"" then%>
<!-- #include file="inc/top.asp" -->
<!-- #include file="inc/adminmenu.asp" -->
<!-- #include file="inc/conn.asp" -->
<%if Request.form("method")="add" then
dim error,mes,putime,content,puser,i
    i=0
    putime=Request.Form("year")&"-"&Request.Form("month")&"-"&Request.Form("day")
    if ubound(split(putime,"-"))<>2 then
        i=i+1
        mes=i&".出现未知错误!\n"
        error=true
    end if
    content=checkstr(Request.Form("content"))
    if content=empty then
        i=i+1
        mes=mes&i&".请填写公告内容!\n"
        error=true
    end if
    puser=checkstr(Request.Form("puser"))
    if puser=empty then
        i=i+1
        mes=mes&i&".请填写您的名字!"
        error=true
    end if
    if error=true then
        Response.Write("<script language=JavaScript>" & chr(13) & "alert('" & mes & "');" & "history.back()" & "</script>")
        Response.end
    end if
    sql="insert into notice(content,putime,puser)values('"&content&"','"&putime&"','"&puser&"')"
    conn.execute(sql)
        Response.Write("<script language=JavaScript>" & chr(13) & "alert('公告添加成功');" & "window.location.href = 'admin_notice.asp'" & "</script>")
        Response.End
end if

if Request.querystring("method")="del" then
    id=Request.querystring("id")
    sql="delete from notice where id in ("& id &")"
    conn.execute(sql)
    Response.Redirect("admin_notice.asp")
end if

if Request.form("method")="mod" then
    id=Request.form("id")
    i=0
    putime=Request.Form("year")&"-"&Request.Form("month")&"-"&Request.Form("day")
    if ubound(split(putime,"-"))<>2 then
        i=i+1
        mes=i&".出现未知错误!\n"
        error=true
    end if
    content=checkstr(Request.Form("content"))
    if content=empty then
        i=i+1
        mes=mes&i&".请填写公告内容!\n"
        error=true
    end if
    puser=checkstr(Request.Form("puser"))
    if puser=empty then
        i=i+1
        mes=mes&i&".请填写您的名字!"
        error=true
    end if
    if error=true then
        Response.Write("<script language=JavaScript>" & chr(13) & "alert('" & mes & "');" & "history.back()" & "</script>")
        Response.end
    end if
    sql="update notice set putime='"&putime&"',puser='"&puser&"',content='"&content&"' where id in ("& id &")"
    conn.execute(sql)
        Response.Write("<script language=JavaScript>" & chr(13) & "alert('公告修改成功');" & "window.location.href = 'admin_notice.asp'" & "</script>")
        Response.End
end if

if Request.Querystring("method")="mod" then
    sql="select puser,content,putime,id from notice where id in ("&Request.Querystring("id")&")"
    set rs=conn.execute(sql)
    if rs(0)<>"" then username=rs(0)
    if rs(1)<>"" then content=rs(1)
    if rs(2)<>"" then
        date0=split(rs(2),"-")
        year0=Cint(date0(0))
        month0=Cint(date0(1))
        day0=Cint(date0(2))
    end if
    method="mod"
    id=rs(3)
else
    content=""
    username=session("username")
    method="add"
    year0=year(date())
    month0=month(date())
    day0=day(date())
end if

%>
<table width="752" height="25" align="center" cellpadding="0" cellspacing="0" class="unnamed_rld2">
<tr><td height=20></td></tr>

<tr>
<td align=center>
  <table width="80%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td>&nbsp;<span style="font-weight: bold">数据统计页面</span>    本系统共被登录
      <strong><%
	  Set Rs=Server.CreateObject("Adodb.REcordset")
	  Rs.Open "select top 1 *  from countip",conn,1,1
	If Not (Rs.Eof And Rs.Bof)Then
	   Response.Write(Rs("count"))
	End If
	Rs.Close%>
      </strong>次  点击数字查看</td>
  </tr>
  <tr>
    <td>&nbsp;共有<strong><a href="?check=bj"><%Rs.Open "select * from bjb",conn,1,1
	If Not(Rs.Eof And Rs.Bof)THen
	   Response.Write(Rs.RecordCount)
	End If
	Rs.Close
	%></a></strong>班级    <strong><a href="?check=xs"><%Rs.Open "select * from user",conn,1,1
	IF Not(Rs.Eof And Rs.Bof)Then
	   Response.Write(Rs.RecordCount)
	End If
	Rs.Close%></a></strong>学生</td>
  </tr>
  <tr>
    <td>&nbsp;共添加了<strong><a href="?check=kc"><%Rs.Open "select * from kcb ",conn,1,1
	If Not(Rs.Eof And Rs.Bof)Then
	   Response.Write(Rs.RecordCount)
	End If
	Rs.Close%></a></strong>课程</td>
  </tr>
  <tr>
    <td>&nbsp;</td>
  </tr>
</table>
<%
c=Request.QueryString("check")
If c="bj"Then
   bj()
ENd If
If c="xs" Then
   xs()
End If
If c="kc" THen
   kc()
End If

Sub bj()%>
<table width="80%" border="0" cellspacing="1" cellpadding="0">
  <tr><td colspan="3">&nbsp;班级列表</td></tr>
  <tr>
    <td colspan="3">&nbsp;<%
	Set Rs=SErver.CreateObject("Adodb.REcordset")
	Rs.Open "select * from bjb",conn,1,1
	If Rs.Eof And Rs.Bof Then%></td>
  </tr>
  <tr>
    <td colspan="3" align="center">&nbsp;没有添加班级</td>
  </tr>
  <%else
 %>
  <tr align="center">
    <td width="36%">班级</td>
    <td width="27%">主学号</td>
    <td width="37%">学生数</td>
  </tr><% while not rs.eof%>
  <tr align="center">
    <td>&nbsp;<%=Rs("bj")%></td>
    <td>&nbsp;<%=RS("xhf")%></td>
    <td>&nbsp;<a href="?check=xs"><%Set r=Server.CreateObject("Adodb.RecordSet")
	R.Open "select * from user where bj='"&rs("bj")&"'",conn,1,1
	If Not (Rs.Eof And Rs.Bof)Then
	   Response.WRite(R.RecordCount)
	End If
	R.Close
	SEt R=Nothing%></a></td>
  </tr>
  <%
  rs.movenext
  wend
  End If
  Rs.Close%>
</table>

<%End Sub
Sub xs()%>
<table width="80%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td colspan="4">&nbsp;学生列表</td>
  </tr>
  <%Set Rs=Server.CreateObject("Adodb.RecordSet")
  Rs.Open "select * from user",conn,1,1
  If Rs.Eof And Rs.Bof Then%>
  <tr>
    <td colspan="4" align="center">&nbsp;没有学生,请先添加</td>
  </tr>
  <%Else%>
  <tr align="center">
    <td>&nbsp;姓名</td>
    <td>&nbsp;学号</td>
    <td>&nbsp;性别</td>
    <td>&nbsp;班级</td>
  </tr>
  <%While Not Rs.Eof%>
  <tr align="center">
    <td>&nbsp;<%=Rs("xm")%></td>
    <td>&nbsp;<%=Rs("xh")%></td>
    <td>&nbsp;<%=Rs("sex")%></td>
    <td>&nbsp;<%Set r=conn.execute("select * from bjb where bj='"&Rs("bj")&"'")
	IF Not(R.Eof And R.Bof)Then
	   Response.Write(R("bj"))
	End IF
	R.Close
	Set R=Nothing%></td>
  </tr>
  <%
  Rs.MoveNext
  WEnd
  End If
  Rs.Close
  Set Rs=Nothing%>
</table>

<%End Sub

Sub kc()%>
<table width="80%" border="0" cellspacing="1" cellpadding="0">
  <tr>
    <td colspan="5">&nbsp;课程列表</td>
  </tr><%Set Rs=Server.CreateObject("Adodb.RecordSet")
  Rs.Open "select * from kcb",conn,1,1
  If Rs.Eof And Rs.BOf Then%>
  <tr>
    <td colspan="5" align="center">&nbsp;没有添加课程</td>
  </tr>
  <%Else%>
  <tr align="center">
    <td>&nbsp;课程</td>
    <td>&nbsp;班级</td>
    <td>&nbsp;学期</td>
    <td>&nbsp;类型</td>
    <td>&nbsp;学分</td>
  </tr>
  <%while not rs.eof%>
  <tr align="center">
    <td>&nbsp;<%=rs("kc")%></td>
    <td>&nbsp;<%=rs("bj")%></td>
    <td>&nbsp;<%=rs("xq")%></td>
    <td>&nbsp;<%=rs("lx")%></td>
    <td>&nbsp;<%=rs("xf")%></td>
  </tr>
  <%rs.movenext
    wend
	end if
	rs.close
	set rs=nothing%>
</table>
<%End Sub%>
  
</td></tr><tr><td height=20></td><tr><td>
<tr><td height=20></td></tr>


<!-- #include file="inc/copyright.asp" -->

⌨️ 快捷键说明

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