?? admin_user.asp
字號:
<!--#include file="conn.asp"-->
<!--#include file="admin_error.asp"-->
<!--#include file="md5.asp"-->
<title><%=sitename%>-后臺管理</title>
<%
if master="" then
errinfo="<li>管理員沒有登陸,請先 <a href='admin_login.asp'>登陸</a><br>"
call errweb()
else
%>
<table width="<%=width%>" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="20%" align="center" height="400" valign="top"><%call menu()%></td>
<td width="80%" valign="top">
<%
select case request("action")
case "edit"
call edit()
case "perform"
call perform()
case else
call main()
end select
sub main()
%>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="100%" height="25">顯示:<a href="?order=1">降序</a> <a href="?order=2">升序</a> <a href="?order=3">男降序</a> <a href="?order=4">男升序</a> <a href="?order=5">女降序</a> <a href="?order=6">女升序</a></td>
</tr>
<tr>
<td width="100%">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="15%" align="center" height="30">用戶</td>
<td width="10%" align="center" height="30">性別</td>
<td width="15%" align="center" height="30">生日</td>
<td width="30%" align="center" height="30">郵箱</td>
<td width="15%" align="center" height="30">注冊</td>
<td width="15%" align="center" height="30">登陸</td>
</tr>
<%
dim sql,i,totaluser,page,pages,order,orderlist
order=request("order")
select case order
case "","1"
orderlist=" order by id desc "
case "2"
orderlist=" order by id asc "
case "3"
orderlist=" where sex='男' order by id desc "
case "4"
orderlist=" where sex='男' order by id asc "
case "5"
orderlist=" where sex='女' order by id desc "
case "6"
orderlist=" where sex='女' order by id asc "
end select
set rs= Server.CreateObject("ADODB.Recordset")
sql="select id,user,sex,birthday,email,regdate,logindate from user "&orderlist&""
rs.open sql,conn,1,1
if rs.eof and rs.bof then
page=1
pages=1
totaluser=0
response.write"<tr><td colspan='6'>數據庫中沒有注冊用戶</td></tr>"
else
totaluser=rs.recordcount '總的人數
rs.pagesize=50 '每頁顯示的條數
pages=rs.pagecount '總的找到頁數
page=request("page") '當前頁
if page="" then
page=1
elseif page<1 then
page=1
end if
page=cint(page)
if page>pages then page=pages
rs.absolutepage=page
do while not rs.eof and i<rs.pagesize
i=i+1
%>
<tr>
<td width="15%" align="center" height="30"><a href="?action=edit&order=<%=order%>&page=<%=page%>&id=<%=rs("id")%>"><%=rs("user")%></a></td>
<td width="10%" align="center" height="30"><%=rs("sex")%></td>
<td width="15%" align="center" height="30"><%=rs("birthday")%></td>
<td width="30%" align="center" height="30"><%=rs("email")%></td>
<td width="15%" align="center" height="30"><%=rs("regdate")%></td>
<td width="15%" align="center" height="30"><%=rs("logindate")%></td>
</tr>
<%
rs.movenext
loop
end if
set rs=nothing
%>
</table>
</td>
</tr>
<tr>
<td width="100%">
<%
if pages>1 then
response.write"<table align='center' cellspacing='0' cellpadding='0' border='0' width='100%'>"&_
"<form method='POST' action='?order="&order&"'><tr><td height='20' width='50%'>共<font color='red'>"&totaluser&"</font>人 <font color='red'>"&pages&"</font>頁 第<font color='red'>"&page&"</font>頁 "
response.write" <input type='text' name='page' size='5' maxlength='4'> <input type='submit' value='GO' name='B1'></td></form><td align='right' width='50%' height='20'>"
if page>1 then
response.write"<a href='?order="&order&"&page=1'>首頁</a> "&_
"<a href='?order="&order&"&page="&page-1&"'>上一頁</a> "
else
response.write"首頁 上一頁 "
end if
if page<pages then
response.write"<a href='?order="&order&"&page="&page+1&"'>下一頁</a> "&_
"<a href='?order="&order&"&page="&pages&"'>尾頁</a>"
else
response.write"下一頁 尾頁"
end if
response.write"</td></tr></table>"
end if
%>
</td>
</tr>
</table>
<%
end sub
sub edit()
dim rs_class,rs_list
set rs=conn.execute("select user from user where id="&request("id")&"")
%>
<form method="POST" action="?action=perform&order=<%=request("order")%>&page=<%=request("page")%>&id=<%=request("id")%>">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" align="center" height="30">帳 號</td>
<td width="50%" align="center" height="30"> <%=rs("user")%></td>
</tr>
<tr>
<td width="50%" align="center" height="30">密 碼</td>
<td width="50%" align="center" height="30"><input type="password" name="password" size="20"></td>
</tr>
<tr>
<td width="50%" align="center" height="30">重復密碼</td>
<td width="50%" align="center" height="30"><input type="password" name="password1" size="20"></td>
</tr>
<tr>
<td width="50%" align="center" height="30"><font color="#FF0000">刪 除</font></td>
<td width="50%" align="center" height="30"><input type="checkbox" name="delete" value="1"></td>
</tr>
<tr>
<td width="50%" align="center" height="30">分 類 數</td>
<td width="50%" align="center" height="30">
<%
set rs_class=conn.execute("select count(id) from address_class where user='"&rs("user")&"'")
response.write rs_class(0)
set rs_class=nothing
%>
</td>
</tr>
<tr>
<td width="50%" align="center" height="30">聯系人數</td>
<td width="50%" align="center" height="30">
<%
set rs_list=conn.execute("select count(id) from address_list where user='"&rs("user")&"'")
response.write rs_list(0)
set rs_list=nothing
%>
</td>
</tr>
<tr>
<td width="100%" colspan="2" align="center" height="80"><input type="submit" value="執 行" name="B1">
<input type="button" value="返 回" name="B2" onclick="javascript:history.go(-1)">
<p>(若選中 <font color="#FF0000">刪除</font> 復選框,則該帳號對應的用戶及分類及通訊錄聯系人將都被刪除)</p>
</td>
</tr>
</table>
</form>
<%
set rs=nothing
end sub
sub perform()
dim password,password1,delete
password=request.form("password")
password1=request.form("password1")
delete=request.form("delete")
'刪除
if delete="1" then
conn.execute("delete address_list.* from address_list,user where address_list.user=user.user and user.id="&request("id")&"")
conn.execute("delete address_class.* from address_class,user where address_class.user=user.user and user.id="&request("id")&"")
conn.execute("delete * from user where user.id="&request("id")&"")
success="<li>你所選擇的用戶及其所有分類和通訊錄聯系人已被刪除<br><li><a href='?order="&request("order")&"&page="&request("page")&"'>返回用戶管理列表</a><br>"
call successweb()
else
if password="" or password1="" then
founderr=true
errinfo="<li>新密碼不能為空<br>"
elseif password<>password1 then
founderr=true
errinfo="<li>兩次密碼輸入必須一致<br>"
elseif len(password)>20 then
founderr=true
errinfo="<li>密碼只能在20個字符以內<br>"
end if
if founderr then
call errweb()
else
conn.execute("update user set password='"&md5(password)&"' where id="&request("id")&"")
success="<li>你成功修改了該用戶的密碼<br><li><a href='?order="&request("order")&"&page="&request("page")&"'>返回用戶管理列表</a><br>"
call successweb()
end if
end if
end sub
%></td>
</tr>
</table>
<%
end if
conn.close
set conn=nothing
%>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -