📄 sysadm_user.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="const.asp" -->
<!--#include file=char.asp-->
<!--#include file=checkuser.asp-->
<html><head>
<meta NAME=GENERATOR Content="Microsoft FrontPage 4.0" CHARSET=GB2312>
<title><%=SchoolmateName%>--管理页面</title>
<link rel="stylesheet" type="text/css" href="txl.css">
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<br>
<%
if issystemadmin(0)=false or session("adminlogin")<>"OK" then
Errmsg=Errmsg+"<br>"+"<li>本页面为管理员专用,请<a href=sysadm_index.asp target=_top>登陆</a>后进入。"
call Error(errmsg)
else
%>
<table cellpadding=0 cellspacing=0 border=0 width=<%=tablewidth%> bgcolor=<%=tablebordercolor%> align=center>
<tr>
<td>
<table cellpadding=3 cellspacing=1 border=0 width=100%>
<tr bgcolor='<%=Tabletitlecolor%>'>
<td><font color="<%=TablefontColor%>">欢迎<b>
<%=membername%></b>进入管理页面</font>
</td>
</tr>
<tr bgcolor=<%=tablebodycolor2%>>
<td width="100%" valign=top>
<font color="<%=TableContentColor%>">
<%
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim idlist
dim title
dim sql
dim rs
MaxAnnouncePerPage=20
title=request("txtitle")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
if not isempty(request("selAnnounce")) then
idlist=request("selAnnounce")
if instr(idlist,",")>0 then
dim idarr
idArr=split(idlist)
dim id
for i = 0 to ubound(idarr)
id=clng(idarr(i))
call deleteannounce(id)
next
else
call deleteannounce(clng(idlist))
end if
end if
%>
<div align="center"><center>
<form name="searchuser" method="POST" action="sysadm_user.asp">
<font color="<%=AlertFontColor%>">点击用户名进行相应操作</font>, 查找用户: <input type="text" name="txtitle" size="13"><input type="submit" value="查询" name="title">
</form>
<form method=Post action="sysadm_user.asp">
<div align="center">
<%
if title<>"" then
sql="select userid,studid,locked from [student] where userid like '%"&trim(title)&"%' and isadmin<>3 order by userid desc"
else
sql="select userid,studid,locked from [student] where isadmin<>3 order by userid desc"
end if
Set rs= Server.CreateObject("ADODB.Recordset")
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'> 还 没 有 任 何 用 户 </p>"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
MaxAnnouncePerpage=Clng(MaxAnnouncePerpage)
if (currentpage-1)*MaxAnnouncePerPage>totalput then
if (totalPut mod MaxAnnouncePerPage)=0 then
currentpage= totalPut \ MaxAnnouncePerPage
else
currentpage= totalPut \ MaxAnnouncePerPage + 1
end if
end if
if currentPage=1 then
showContent
showpage totalput,MaxAnnouncePerPage,"sysadm_user.asp"
else
if (currentPage-1)*MaxAnnouncePerPage<totalPut then
rs.move (currentPage-1)*MaxAnnouncePerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxAnnouncePerPage,"sysadm_user.asp"
else
currentPage=1
showContent
showpage totalput,MaxAnnouncePerPage,"sysadm_user.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
sub showContent
dim i
i=0
%>
<div align="center"><center>
<table border="0" cellspacing="0" width="100%" cellpadding="0">
<tr>
<td width="46" align="center" bgcolor="<%=Tabletitlecolor%>" height="20">
<font color="<%=TableContentColor%>"><strong>ID号</strong></font></td>
<td width="300" align="center" bgcolor="<%=Tabletitlecolor%>">
<font color="<%=TableContentColor%>"><strong>用户名</strong></font></td>
<td width="168" align="right" bgcolor="<%=Tabletitlecolor%>"><input type='submit' value="删除" name="submit"> <%if regflag=1 then%><input type='submit' value="批准" name="submit"><%end if%></td>
</tr>
<%do while not rs.eof%>
<tr>
<td height="23" width="46">
<font color="<%=TableContentColor%>"><p align="center"><%=rs("studid")%></font></td>
<td width="300">
<font color="<%=TableContentColor%>"><p align="center"><a href="sysadm_modiuser.asp?name=<%=htmlencode(rs("userid"))%>"><%=htmlencode(rs("userid"))%></a></font></td>
<td width="168" align=right><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("studid"))%>' <%if regflag=1 then%><%if rs("locked")=true then%>checked<%end if%><%end if%>></td>
</tr>
<%
i=i+1
if i>=MaxAnnouncePerPage then exit do
rs.movenext
loop
%>
</table>
</center></div>
<%
end sub
function showpage(totalnumber,MaxAnnouncePerPage,filename)
dim n
if totalnumber mod MaxAnnouncePerPage=0 then
n= totalnumber \ MaxAnnouncePerPage
else
n= totalnumber \ MaxAnnouncePerPage+1
end if
response.write "<p align='center'> "
if CurrentPage<2 then
response.write "首页 上一页 "
else
response.write "<a href="&filename&"?page=1&txtitle="&request("txtitle")&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&txtitle="&request("txtitle")&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&txtitle="&request("txtitle")&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&txtitle="&request("txtitle")&">尾页</a>"
end if
response.write " 页次:</font><strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write " 共<b>"&totalnumber&"</b>个用户 <b>"&MaxAnnouncePerPage&"</b>个用户/页 "
end function
sub deleteannounce(id)
dim rs,sql
sql="select userid from [student] where studid="&cstr(id)
set rs=conn.execute(sql)
username=rs(0)
sql="delete from [classboard] where name='"&username&"'"
conn.execute(sql)
sql="delete from [append] where collector='"&username&"'"
conn.execute(sql)
sql="delete from [teacher] where collector='"&username&"'"
conn.execute(sql)
sql="delete from [friend] where F_username='"&username&"'"
conn.execute(sql)
rem delete user message
sql="delete from [message] where sender='"&username&"' and issend=0"
conn.execute(sql)
sql="delete from [message] where sender='"&username&"' and delR=2 or incept='"&username&"' and delS=2"
conn.execute(sql)
sql="update [message] set delR=2 where incept='"&username&"'"
conn.execute(sql)
sql="update [message] set delS=2 where sender='"&username&"'"
conn.execute(sql)
rem ==================
rem delete user bbs
rem ==================
sql="select filename from [photo] where name='"&username&"'"
set rs=conn.execute(sql)
set fso = CreateObject("Scripting.FileSystemObject")
do until rs.eof
photofile=PhotoPath&rs(0)
filepath=server.mappath(photofile)
if fso.FileExits(filepath)=true then
Set file = fso.GetFile(filepath)
file.delete
end if
rs.movenext
loop
set file=nothing
set fso=nothing
sql="delete from [photo] where name='"&username&"'"
conn.execute(sql)
sql="select classid from [student] where userid='"&username&"'"
set rs=conn.execute(sql)
studclass=rs(0)
set rs=nothing
sql="update [class] set studcount=studcount-1 where classid="&studclass
conn.execute(sql)
sql="update [class] set admin='' where admin='"&username&"' and classid="&studclass
conn.execute(sql)
sql="delete from [student] where userid='"&username&"'"
conn.execute(sql)
End sub
%></font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%end if%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -