📄 admin_user.asp
字号:
<!--#include file="head.asp"-->
<!--#include file="AdminSession.asp"-->
<br><br>
<%
Select Case Request("method")
Case 1
Call DelUser()
End Select
dim totalPut
dim CurrentPage
dim maxperpage
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
maxperpage=10
%>
<table width="95%" border="0" align="center" cellpadding="6" cellspacing="1" bgcolor="#0099CC">
<tr bgcolor="e9effe">
<td height="30" colspan="5" align="center"><b>用
户 信 息 管 理</b> </td>
</tr>
<tr valign="middle" bgcolor="e9effe">
<td height="25" align="center">ID</td>
<td height="25" align="center">操作</td>
<td height="25" align="center">用户名</td>
<td height="25" align="center">最后登陆时间</td>
<td height="25" align="center">最后登陆IP</td>
</tr>
<tr valign="middle" bgcolor="e9effe">
<td height="25" colspan="5" align="center">
<%
set rs=server.createobject("adodb.recordset")
Sql = "Select id,username,flag,lastlogin,lastloginip from admin order by id desc"
rs.open sql,conn,1,1
if rs.eof and rs.bof then
Response.Write "还没有用户信息。"
else
totalPut=rs.recordcount
if currentpage<1 then
currentpage=1
end if
if (currentpage-1)*MaxPerPage>totalput then
if (totalPut mod MaxPerPage)=0 then
currentpage= totalPut \ MaxPerPage
else
currentpage= totalPut \ MaxPerPage + 1
end if
end if
if currentPage=1 then
'showpage totalput,MaxPerPage,"Admin_User.asp"
showContent
showpage totalput,MaxPerPage,"Admin_User.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
'showpage totalput,MaxPerPage,"Admin_User.asp"
showContent
showpage totalput,MaxPerPage,"Admin_User.asp"
else
currentPage=1
'showpage totalput,MaxPerPage,"Admin_User.asp"
showContent
showpage totalput,MaxPerPage,"Admin_User.asp"
end if
end if
rs.close
set rs = nothing
end if
sub showContent
dim i
i=0
%> </td>
</tr>
<form action="" name="form1" method="post">
<%do while not rs.eof%>
<tr valign="middle" bgcolor="e9effe">
<td height="25" align="center"><%=rs(0)%></td>
<td height="25" align="center"><input type="checkbox" name="userid" value="<%=rs(0)%>"></td>
<td height="25" align="center"><%=(rs(1))%></td>
<td height="25" align="center"><%if isnull(rs(3)) then response.Write("此用户还未登陆过") else response.Write rs(3) end if%></td>
<td height="25" align="center"><%if isnull(rs(4)) then response.Write("此用户还未登陆过") else response.Write rs(4) end if%></td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr valign="middle" bgcolor="e9effe">
<td height="25" colspan="5"> 管理操作:全部选择
<input type="checkbox" name="chkall" onClick="javascript:CheckAll(this.form)">
<input onClick="{if(confirm('确定删除选定的用户吗?')){this.document.form1.submit();return true;}return false;}" type=submit value=删除 name=action class="tbutton">
<input type="hidden" name="method" value="1">
<input type="button" name="button" value="添加用户" class="tbutton" onClick="self.location='Admin_addUser.asp'"></td>
</tr>
</form>
<tr valign="middle" bgcolor="e9effe">
<td height="25" colspan="5" align="center">
<%
end sub
function showpage(totalnumber,maxperpage,filename)
dim n
if totalnumber mod maxperpage=0 then
n= totalnumber \ maxperpage
else
n= totalnumber \ maxperpage+1
end if
response.write "<table cellspacing=1 width='100%' border=0 colspan='4' ><form method=Post action="""&filename&"""><tr><td align=right> "
if CurrentPage<2 then
response.write "共<b><font color=red>"&totalnumber&"</font></b>位用户 首页 上一页 "
else
response.write "共<b><font color=red>"&totalnumber&"</font>位用户 <a href="&filename&"?page=1>首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&">"
response.write "下一页</a> <a href="&filename&"?page="&n&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>位用户/页 "
%>
转到:
<select name='page' size='1' style="font-size: 9pt" onChange='javascript:submit()'>
<%for i = 1 to n%>
<option value='<%=i%>' <%if CurrentPage=cint(i) then%> selected <%end if%>>第<%=i%>页</option>
<%next%>
</select> <%
response.write "</td></tr></FORM></table>"
end function
Sub DelUser()
if Request("userid") = "" then
Response.write "<script>alert(""请选择要删除的用户。"");location.href=""admin_user.asp"";</script>"
Response.end
end if
userid = Request("userid")
conn.execute("Delete from admin where id in ("& userid &")")
Response.Write("<script>alert(""删除成功"");location.href=""admin_user.asp"";</script>")
Response.End()
End Sub
%>
</td>
</tr>
</table>
<SCRIPT language=javascript>
var menu=new Array(["系统用户管理"]);
drawMenu(menu);
setFrameActive();
</SCRIPT>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -