📄 listuser.asp
字号:
<!--#INCLUDE FILE="checklogin1.asp" -->
<!--#INCLUDE FILE="theme.asp" -->
<html><head>
<meta NAME=GENERATOR Content="Microsoft FrontPage 4.0" CHARSET=GB2312>
<title><%=version%>--用户管理</title>
<link rel="stylesheet" type="text/css" href="include/site.css">
<body alink=#333333 vlink=#333333 link=#333333 topmargin=0 bgcolor=<%=bodycolor%>>
<br><br>
<%
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
dim idlist
dim search_user
dim sql
MaxAnnouncePerPage=15
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
%>
<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>
<%=session("name")%></b>进入管理页面</font>
</td>
</tr>
<tr bgcolor=<%=tablebodycolor2%>>
<td width="100%" valign=top>
<font color="<%=TableContentColor%>">
<div align="center"><center>
<form name="searchuser" method="POST" action="ListUser.asp?action=search_user">
<font color="<%=AlertFontColor%>">点击用户名进行相应操作</font>, 查找用户: <input type="text" name="search_user" size="13"> <input type="submit" value="查询" name="searchuser">
</form>
</div>
<%
action=request("action")
search_user=trim(request("search_user"))
if action="search_user" then
response.write "关键字:<font color=red>"&search_user&"</font>"
sql="select userid,u_id,locked,workshop from [user] where userid like '%"&search_user&"%' and isadmin<>3 order by u_id desc"
else
sql="select userid,u_id,locked,workshop from [user] where isadmin<>3 order by u_id desc"
'response.write("执行了她。")
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,"ListUser.asp"
else
if (currentPage-1)*MaxAnnouncePerPage<totalPut then
rs.move (currentPage-1)*MaxAnnouncePerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage totalput,MaxAnnouncePerPage,"ListUser.asp"
else
currentPage=1
showContent
showpage totalput,MaxAnnouncePerPage,"ListUser.asp"
end if
end if
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%
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&search_user="&request("search_user")&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&search_user="&request("search_user")&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&search_user="&request("search_user")&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&search_user="&request("search_user")&">尾页</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 [user] where u_id="&cstr(id)
set rs=conn.execute(sql)
username=rs("userid")
set rs=nothing
sql="delete from [favourite] where Ower='"&username&"'"
conn.execute(sql)
sql="delete from [user] where userid='"&username&"'"
conn.execute(sql)
'注册人数减一
sql="update [config] set users=users-1"
conn.execute(sql)
End sub
sub showContent
dim i
i=0
%>
<form name="del_user" method="POST" action="ListUser.asp">
<div align="center"><center>
<table border="0" cellspacing="0" width="100%" cellpadding="0">
<tr>
<td width="100" align="center" bgcolor="<%=Tabletitlecolor%>" height="25">
<font color="<%=TableContentColor%>"><strong>ID号</strong></font></td>
<td width="50" align="left" bgcolor="<%=Tabletitlecolor%>"> <font color="<%=TableContentColor%>"><strong>用户名</strong></font></td>
<td width="100" align="left" bgcolor="<%=Tabletitlecolor%>"><strong>工作单位</strong></td>
<td width="100" align="right" bgcolor="<%=Tabletitlecolor%>"><input type='submit' value="删除" name="submit"></td>
</tr>
<%do while not rs.eof%>
<tr>
<td height="25" width="100" align="center"> <font color="<%=TableContentColor%>"><%=rs("u_id")%></font></td>
<td width="150" align="left"> <font color="<%=TableContentColor%>"><a href="ManageUser.asp?name=<%=htmlencode(rs("userid"))%>"><%=htmlencode(rs("userid"))%></a></font></td>
<td width="100" align="left"><%=cstr(rs("workshop"))%> </td>
<td width="100" align="right"><input type='checkbox' name='selAnnounce' value='<%=cstr(rs("u_id"))%>' <%if rs("locked")=true then%>checked<%end if%>></td>
</tr>
<%
i=i+1
if i>=MaxAnnouncePerPage then exit do
rs.movenext
loop
%>
</table>
</center></div>
</form>
<%
end sub
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -