📄 admin_user.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="Admin_ChkPass.asp"-->
<!--#include file="inc/md5.asp"-->
<!--#include file="inc/function.asp"-->
<%
const MaxPerPage=20
dim strFileName
dim totalPut,CurrentPage,TotalPages
dim rs, sql
dim UserID,UserSearch,Keyword,strField
dim Action,FoundErr,ErrMsg
dim tmpDays
keyword=trim(request("keyword"))
if keyword<>"" then
keyword=ReplaceBadChar(keyword)
end if
strField=trim(request("Field"))
UserSearch=trim(request("UserSearch"))
Action=trim(request("Action"))
UserID=trim(Request("UserID"))
ComeUrl=Request.ServerVariables("HTTP_REFERER")
if UserSearch="" then
UserSearch=0
else
UserSearch=Clng(UserSearch)
end if
strFileName="Admin_User.asp?UserSearch=" & UserSearch
if request("page")<>"" then
currentPage=cint(request("page"))
else
currentPage=1
end if
%>
<html>
<head>
<title>注册用户管理</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="Admin_STYLE.CSS" rel="stylesheet" type="text/css">
<SCRIPT language=javascript>
function unselectall()
{
if(document.myform.chkAll.checked){
document.myform.chkAll.checked = document.myform.chkAll.checked&0;
}
}
function CheckAll(form)
{
for (var i=0;i<form.elements.length;i++)
{
var e = form.elements[i];
if (e.Name != "chkAll")
e.checked = form.chkAll.checked;
}
}
</SCRIPT>
</head>
<body leftmargin="2" topmargin="0" marginwidth="0" marginheight="0" class="bgcolor">
<br>
<table width="98%" border="0" align="center" cellpadding="2" cellspacing="1" Class="border">
<tr class="topbg">
<td height="22" colspan=2 align=center><strong>注 册 用 户 管 理</strong></td>
</tr>
<form name="form1" action="admin_user.asp" method="get">
<tr class="tdbg">
<td width="100" height="30"><strong>快速查找用户:</strong></td>
<td width="687" height="30"><select size=1 name="UserSearch" onChange="javascript:submit()">
<option value="0">列出所有用户</option>
<option value="1">文章最多TOP100</option>
<option value="2">文章最少的100个用户</option>
<option value="3">VIP用户</option>
<option value="4">前台管理员</option>
<option value="5">推荐博客</option>
<option value="6">等待管理员认证的用户</option>
<option value="7">所有被锁住的用户</option>
</select>
<a href="admin_user.asp">用户管理首页</a> | <a href="admin_user.asp?Action=Add">添加新用户</a></td>
</tr>
</form>
</table>
<br>
<%
if Action="Add" then
call AddUser()
elseif Action="SaveAdd" then
call SaveAdd()
elseif Action="Modify" then
call Modify()
elseif Action="SaveModify" then
call SaveModify()
elseif Action="Del" then
call DelUser()
elseif Action="Lock" then
call LockUser()
elseif Action="UnLock" then
call UnLockUser()
elseif Action="Move" then
call MoveUser()
elseif Action="Update" then
call UpdateUser()
elseif Action="DoUpdate" then
call DoUpdate()
else
call main()
end if
if FoundErr=true then
call WriteErrMsg()
end if
call CloseConn()
sub main()
dim strGuide
strGuide="<table width='100%'><tr><td align='left'>您现在的位置:<a href='Admin_User.asp'>注册用户管理</a> >> "
select case UserSearch
case 0
sql="select * from [User] order by UserID desc"
strGuide=strGuide & "所有用户"
case 1
sql="select top 100 * from [user] order by logcount desc"
strGuide=strGuide & "发表日志最多的前100个用户"
case 2
sql="select top 100 * from [user] order by logcount"
strGuide=strGuide & "发表日志最少的100个用户"
case 3
sql="select * from [user] where userlevel=8 order by userid desc"
strGuide=strGuide & "所有VIP用户"
case 4
sql="select * from [user] where userlevel=9 order by userid desc"
strGuide=strGuide & "前台管理员"
case 5
sql="select * from [user] where userisbest='true' order by userid desc"
strGuide=strGuide & "推荐博客"
case 6
sql="select * from [user] where UserLevel=6 order by userID desc"
strGuide=strGuide & "等待管理认证证的用户"
case 7
sql="select * from [user] where LockUser ='true' order by userID desc"
strGuide=strGuide & "所有被锁住的用户"
case 10
if Keyword="" then
sql="select * from [user] order by userID desc"
strGuide=strGuide & "所有用户"
else
select case strField
case "UserID"
if IsNumeric(Keyword)=false then
FoundErr=true
ErrMsg=ErrMsg & "<br><li>用户ID必须是整数!</li>"
else
sql="select * from [user] where userID =" & Clng(Keyword)
strGuide=strGuide & "用户ID等于<font color=red> " & Clng(Keyword) & " </font>的用户"
end if
case "UserName"
sql="select * from [user] where userName like '%" & Keyword & "%' order by userID desc"
strGuide=strGuide & "用户名中含有“ <font color=red>" & Keyword & "</font> ”的用户"
end select
end if
case else
FoundErr=true
ErrMsg=ErrMsg & "<br><li>错误的参数!</li>"
end select
strGuide=strGuide & "</td><td align='right'>"
if FoundErr=true then exit sub
Set rs=Server.CreateObject("Adodb.RecordSet")
rs.Open sql,Conn,1,1
if rs.eof and rs.bof then
strGuide=strGuide & "共找到 <font color=red>0</font> 个用户</td></tr></table>"
response.write strGuide
else
totalPut=rs.recordcount
strGuide=strGuide & "共找到 <font color=red>" & totalPut & "</font> 个用户</td></tr></table>"
response.write strGuide
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
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
else
if (currentPage-1)*MaxPerPage<totalPut then
rs.move (currentPage-1)*MaxPerPage
dim bookmark
bookmark=rs.bookmark
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
else
currentPage=1
showContent
showpage strFileName,totalput,MaxPerPage,true,true,"个用户"
end if
end if
end if
rs.Close
set rs=Nothing
call ShowSearch()
end sub
sub showContent()
dim i
i=0
%>
<table width='98%' border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<form name="myform" method="Post" action="admin_user.asp" onsubmit="return confirm('确定要执行选定的操作吗?');">
<td>
<table width="100%" border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#FFFFFF" class="border">
<tr class="title">
<td width="30" align="center"><font color="#FFFFFF">选中</font></td>
<td width="30" align="center"><font color="#FFFFFF">ID</font></td>
<td width="80" height="22" align="center"><font color="#FFFFFF"> 用户名</font></td>
<td height="22" align="center"><font color="#FFFFFF">所属用户组</font></td>
<td height="22" align="center"><font color="#FFFFFF">最后登录IP</font></td>
<td align="center"><font color="#FFFFFF">最后登录时间</font></td>
<td width="60" height="22" align="center"><font color="#FFFFFF">登录次数</font></td>
<td width="40" height="22" align="center"><font color="#FFFFFF"> 状态</font></td>
<td width="120" height="22" align="center"><font color="#FFFFFF">
操作</font></td>
</tr>
<%do while not rs.EOF %>
<tr class="tdbg" onmouseout="this.style.backgroundColor=''" onmouseover="this.style.backgroundColor='#BFDFFF'">
<td width="30" align="center"><input name='UserID' type='checkbox' onclick="unselectall()" id="UserID" value='<%=cstr(rs("userID"))%>'></td>
<td width="30" align="center"><%=rs("userID")%></td>
<td width="80" align="center"><%
response.write "<a href='Admin_User.asp?Action=Modify&UserID=" & rs("userID") & "' title=""======== 用 户 信 息 ========" & vbcrlf & "性别:"
if rs("Sex")=1 then
response.write "男"
else
response.write "女"
end if
response.write vbcrlf & "信箱:" & rs("userEmail") & vbcrlf & "QQ:"
if rs("icq")<>"" then
response.write rs("icq")
else
response.write "未填"
end if
response.write vbcrlf & "MSN:"
if rs("Msn")<>"" then
response.write rs("Msn")
else
response.write "未填"
end if
response.write vbcrlf & "主页:"
if rs("Homepage")<>"" then
response.write rs("Homepage")
else
response.write "未填"
end if
response.write vbcrlf & "注册日期:" & rs("addDate")
response.write """>" & rs("userName") & "</a>"
%> </td>
<td align="center"> <%
select case rs("UserLevel")
case 6
response.write "<font color=green>等待管理员认证的用户</font>"
case 7
response.write "普通注册用户"
case 8
response.write "<font color=blue>VIP用户</font>"
case 9
response.write "<font color=blue>前台管理员</font>"
case else
response.write "<font color=red>异常用户</font>"
end select
%> </td>
<td align="center"> <%
if rs("LastLoginIP")<>"" then
response.write rs("LastLoginIP")
else
response.write " "
end if
%> </td>
<td align="center"> <%
if rs("LastLoginTime")<>"" then
response.write rs("LastLoginTime")
else
response.write " "
end if
%> </td>
<td width="60" align="center"> <%
if rs("LoginTimes")<>"" then
response.write rs("LoginTimes")
else
response.write "0"
end if
%> </td>
<td width="40" align="center"><%
if rs("LockUser")="true" then
response.write "<font color=red>已锁定</font>"
else
response.write "正常"
end if
%></td>
<td width="120" align="center"><%
response.write "<a href='Admin_User.asp?Action=Modify&UserID=" & rs("userID") & "'>修改</a> "
if rs("LockUser")="false" then
response.write "<a href='Admin_User.asp?Action=Lock&UserID=" & rs("userID") & "'>锁定</a> "
else
response.write "<a href='Admin_User.asp?Action=UnLock&UserID=" & rs("userID") & "'>解锁</a> "
end if
response.write "<a href='Admin_User.asp?Action=Del&UserID=" & rs("userID") & "' onClick='return confirm(""确定要删除此用户吗?"");'>删除</a> "
%> </td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="200" height="30"><input name="chkAll" type="checkbox" id="chkAll" onclick=CheckAll(this.form) value="checkbox">
选中本页显示的所有用户</td>
<td> <strong>操作:</strong>
<input name="Action" type="radio" value="Del" checked onClick="document.myform.UserLevel.disabled=true">删除
<input name="Action" type="radio" value="Lock" onClick="document.myform.UserLevel.disabled=true">锁定
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -