?? admin_count.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> <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> 共有<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> 共添加了<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> </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"> 班級列表</td></tr>
<tr>
<td colspan="3"> <%
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"> 沒有添加班級</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> <%=Rs("bj")%></td>
<td> <%=RS("xhf")%></td>
<td> <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"> 學生列表</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"> 沒有學生,請先添加</td>
</tr>
<%Else%>
<tr align="center">
<td> 姓名</td>
<td> 學號</td>
<td> 性別</td>
<td> 班級</td>
</tr>
<%While Not Rs.Eof%>
<tr align="center">
<td> <%=Rs("xm")%></td>
<td> <%=Rs("xh")%></td>
<td> <%=Rs("sex")%></td>
<td> <%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"> 課程列表</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"> 沒有添加課程</td>
</tr>
<%Else%>
<tr align="center">
<td> 課程</td>
<td> 班級</td>
<td> 學期</td>
<td> 類型</td>
<td> 學分</td>
</tr>
<%while not rs.eof%>
<tr align="center">
<td> <%=rs("kc")%></td>
<td> <%=rs("bj")%></td>
<td> <%=rs("xq")%></td>
<td> <%=rs("lx")%></td>
<td> <%=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 + -