📄 list_admin.asp
字号:
<!--#include file="check.asp"-->
<%
dim username
maxperpage=10
username = Request.Item ("username")
filename="list_admin.asp"
dim msearchword
msearchword=Request("search")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
link=""
%>
<%
dim rs
dim sql
dim BoardIDList
set rs=server.createobject("adodb.recordset")
if request("action")="del" then
boardIDlist=request("selBoard")
if boardIDlist="" then
response.write "<center>对不起,请选择要删除的管理员信息。</center>"
else
boardIDlist="("+boardIDlist+")"
sql="delete from admin where id in "&boardidlist
rs.open sql,conn,3,3
if err.number<>0 then
response.write "<p><center>删除管理员 信息失败,数据库不能操作:"&err.Description &"</center></p>"
err.clear
else
response.write "<p><center>删除管理员 信息成功。"&boardIDlist&"</center></p>"
end if
end if
end if
%>
<html>
<head>
<title>管理员列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<LINK href="css/style.css" rel=STYLESHEET
type=text/css>
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="661" border="0" cellspacing="4" cellpadding="0" align="center">
<tr>
<td height="9"> </td>
</tr>
<tr>
<td height="18"><font color="#FF0000">管理员列表(*)</font></td>
</tr>
</table>
<table width="661" border="0" cellspacing="4" cellpadding="0" align="center">
<tr>
<td>
<hr size="1">
</td>
</tr>
</table>
<form method="post" action="list_admin.asp" id=form1 name=form1>
<table width="665" border="0" cellspacing="4" cellpadding="0" align="center">
<tr>
<td width="192" height="6"> 根据管理员 查询:
<input type="text" name="username" size="15" maxlength="15">
</td>
<td width="148" height="6">
<input type="submit" name="Submit" value="提交">
<input type="submit" name="Submit2" value="重置">
</td>
</tr>
</table>
</form>
<table width="800" border="0" cellspacing="4" cellpadding="0" align="center">
<tr>
<td><%
dim totalPut
dim CurrentPage
dim TotalPages
dim i,j
sql="select * from admin where id<>''"
if username<>"" then
sql=sql & " and adminname = '"&username&"'"
link= link & "&username="&username&""
end if
sql= sql & " order by id desc;"
Set rs= Server.CreateObject("ADODB.Recordset")
'response.Write sql
'Response.End
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<p align='center'>还没有任何管理员 信息!</p>"
else
totalPut=rs.recordcount
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,"list_admin.asp"
showContent
showpage totalput,MaxPerPage,"list_admin.asp"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showpage totalput,MaxPerPage,"list_admin.asp"
showContent
showpage totalput,MaxPerPage,"list_admin.asp"
else
currentPage=1
showpage totalput,MaxPerPage,"list_admin.asp"
showContent
showpage totalput,MaxPerPage,"list_admin.asp"
end if
end if
rs.close
end if
set rs=nothing
%>
</td>
</tr>
</table>
<%
sub showContent
%>
<form method="POST" action="list_admin.asp?action=del" name="frmBoardDel">
<table width="80%" border="0" cellspacing="4" cellpadding="0" align="center">
<tr>
<td width="14%">ID</td>
<td width="34%">用户名</td>
<td width="24%">密码</td>
<td width="28%">修改用户/添加用户</td>
</tr>
<% dim i
i=0
%> <%
do while not rs.EOF
response.write "<tr>"
response.write"<td width=41><input type=checkbox name=selBoard value="&rs("id")&"></td>"
response.write"<td width=97>"&rs("adminname")&"</td>"
response.write"<td width=92>"&rs("adminpass")&"</td>"
response.write"<td width=183><a href=xiugai_pass.asp?adminid="&rs("id")&">修改管理员密码</a>/<a href=add_admin.asp>添加管理员</a></td>"
response.write"</tr>"
i=i+1
if i>=MaxPerPage then exit do
rs.MoveNext
loop
%>
</table>
<script>
function confirmDel(){
if (confirm("删除选择的管理员?")){
document.frmBoardDel.submit()
}
}
</script>
<div align="center"><center><p><input class="buttonface" type="button" onclick="confirmDel()" value="删 除" name="cmdDel"> </p>
<p>(删除管理员将同时删除所有该管理员的帖子)</p>
</center></div>
</form>
<%
end sub
%>
<table width="800" border="0" cellspacing="4" cellpadding="0" align="center">
<tr>
<td><%
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 "<div align=""center""><table border=0 cellpadding=0 cellspacing=0 width=""90%"" height=21><tr><td width=""43%"" height=21 valign=middle>"
Response.Write "<p align=""left"">|合计<font color=#008000><b>"&totalnumber&"</b>管理员 信息</td><td width=""57%"" height=21 valign=middle>"
Response.Write "<p align=right> 第<b>"¤tpage&"</b>页 | 共<font color=#008000><b>"&n&"</b></font>页 | "
if CurrentPage<2 then
response.write "<font color=#cecfce>第一页</a> "
response.write "前一页</a> "
else
response.write "<a href="&filename&"?page=1"&link&">第一页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&""&link&">前一页</a> "
end if
if n-currentpage<1 then
response.write "后一页</a> "
response.write "最后页</a> "
else
response.write "<a href="&filename&"?page="&CurrentPage+1&""&link&">"
response.write "后一页</a> "
response.write "<a href="&filename&"?page="&n&""&link&">最后页</a> "
end if
Response.Write "</td></tr></table></div>"
end function
set rs=nothing
%> </td>
</tr>
</table>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -