📄 admin_user.asp
字号:
<!-- #include file="conn.asp" -->
<!-- #include file="inc/const.asp" -->
<!-- #include file="inc/function.asp" -->
<HTML><HEAD><TITLE>后台管理 </TITLE>
<META http-equiv=Content-Type content="text/html; charset=gb2312">
<LINK href="admin.css" type=text/css rel=stylesheet>
</HEAD>
<SCRIPT LANGUAGE=javascript>
<!--
function SelectAll() {
for (var i=0;i<document.selform.selUserID.length;i++) {
var e=document.selform.selUserID[i];
e.checked=!e.checked;
}
}
//-->
</script>
<BODY leftMargin=0 topMargin=0>
<!-- #include file="admin_header.asp" -->
<table width="100%" border="0" cellspacing="2">
<tr>
<td width="20%" align="center" valign="top" class="tdbgleft"><!-- #include file="Admin_Left.asp" --></td>
<td class="b1" valign="top">
<%
if not isnull(cUserName) and cUserName<>"" then
if chkMaster(cUserName) then
const MaxPerPage=25
dim totalPut
dim CurrentPage
dim TotalPages
'dim i,j
pubUserName=request("pubUserName")
if not isempty(request("page")) then
currentPage=cint(request("page"))
else
currentPage=1
end if
if not isempty(request("selUserID")) then
selUserID=request("selUserID")
if request("action")="删除" then
call delUser()
elseif request("action")="激活" then
call isActive()
elseif request("action")="锁定" then
call noActive()
else
response.write "无效参数!"
response.end
end if
end if
sub delUser()
conn.execute("delete from Admin_UserInfo where UserID in ("&selUserID&")")
end sub
sub isActive()
conn.execute("update Admin_UserInfo set isActive=true where UserID in ("&selUserID&")")
end sub
sub noActive()
conn.execute("update Admin_UserInfo set isActive=0 where UserID in ("&selUserID&")")
'response.write "无效参数!"
end sub
set rs=server.createobject("adodb.recordset") %>
<table width="100%" border=0 align="center" cellpadding=3 cellspacing=1 class="tableBorder">
<tr height=25>
<th height="25" colspan="9" class="tdbg1">用户管理</th>
</tr>
<tr align="center" class="tdbg2" height=25>
<td width="5%">ID</td>
<td width="8%">选择</td>
<td width="13%">用户名</td>
<td width="8%" nowrap>邮件</td>
<td width="17%" nowrap>注册时间</td>
<td width="17%" nowrap>用户级别</td>
<td nowrap>更新统计</td>
<td width="17%" nowrap>管理操作</td>
<td width="15%" nowrap>状态</td>
</tr>
<tr class="tdbg2">
<td colspan="9">
<%
if pubUserName<>"" then
sql="select * from Admin_UserInfo where UserName like '%"&trim(pubUserName)&"%' and CategoryName='"&CategoryName&"' order by UserID Desc"
else
sql="select * from Admin_UserInfo Where CategoryName='"&CategoryName&"' order by UserID Desc"
end if
rs.open sql,conn,1,1
if rs.eof and rs.bof then
response.write "<table><tr><td border=""0"" width=""100%"" height=""100%"" cellspacing=""1"" cellpadding=""0"" bgcolor=""#FFFFFF""><p align=""center"">没有或没有找到任何用户,<a href=""Admin_UserSetting.asp"">点此添加新用户<a></p></td></tr></table>"
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
end if
rs.close
set rs=nothing
sub showContent
dim i
i=0
%>
</td>
</tr>
<form name="selform" method="post" >
<% do while not rs.eof %>
<tr class="tdbg2">
<td height="25" align="center"><%=rs("UserID")%></td>
<td align="center"> <input type="checkbox" name="selUserID" id="selUserID" value="<%=rs("UserID")%>">
</td>
<td align="center"><%=rs("UserName")%></td>
<td align=center nowrap><a href="mailto:<%=rs("Email")%>"><img src="images/Email.gif" width="16" height="17" border="0"></a></td>
<td align=center nowrap><%=DateTimeFormat(rs("RegDate"),3)%></td>
<td align=center nowrap><%= UserClass(rs("UserClass")) %></td>
<td align=center nowrap>本日:<% set countRs=conn.execute("select count(softid) from SoftDown_SoftInfo where datediff('d',SoftTime,date())<1 and username='"&rs("UserName")&"'")
Response.Write("<a href=""Admin_Soft_List.asp?page=1&action=s&keyword=&selby=1&catalog=&DateTime="&date()-1&"&username="&rs("UserName")&"""><font color=red>"&countRs(0)&"</font></a>")
set countRs=nothing
%> 两日:<% set countRs=conn.execute("select count(softid) from SoftDown_SoftInfo where datediff('d',SoftTime,date())<2 and username='"&rs("UserName")&"'")
Response.Write("<a href=""Admin_Soft_List.asp?page=1&action=s&keyword=&selby=1&catalog=&DateTime="&date()-2&"&username="&rs("UserName")&"""><font color=red>"&countRs(0)&"</font></a>")
set countRs=nothing
%>
本月:<% set countRs=conn.execute("select count(softid) from SoftDown_SoftInfo where datediff('d',SoftTime,date())<"&day(Date())&" and username='"&rs("UserName")&"'")
Response.Write("<a href=""Admin_Soft_List.asp?page=1&action=s&keyword=&selby=1&catalog=&DateTime="&DateSerial(year(date), month(date), 1 - 1)&"&username="&rs("UserName")&"""><font color=red>"&countRs(0)&"</font></a>")
Response.Write(" 平均:"& round(countRs(0)/day(Date()),2) )
set countRs=nothing
%> </td>
<td align=center nowrap><a href="Admin_UserSetting.Asp?UserID=<%=rs("UserID")%>&action=edit" class="ArticleList">设置权限</a></td>
<td align=center nowrap>
<% if rs("isActive")=true then
response.write "正常"
else
response.write "<font color=red>锁定<font>"
end if %>
</td>
</tr>
<%
i=i+1
if i>=MaxPerPage then exit do
rs.movenext
loop
%>
<tr class="tdbg2">
<td colspan="9">管理操作:选择/反选
<input type="checkbox" name="checkbox" value="checkbox" onClick="javascript:SelectAll()">
<input onClick="{if(confirm('确定删除选定的用户吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=删除 name=action>
<input onClick="{if(confirm('确定激活选定的用户吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=激活 name=action>
<input onClick="{if(confirm('确定锁定选定的用户吗?')){this.document.selform.submit();return true;}return false;}" type=submit value=锁定 name=action>
<input type=button name="Submit" value="添加用户" onClick="self.location='Admin_UserSetting.asp'" >
</td>
</tr>
</form>
<tr class="tdbg2">
<td colspan="9">
<%
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&"?pubUserName="&pubUserName&"""><tr><td align=right> "
if CurrentPage<2 then
response.write "共"&totalnumber&"位用户 首页 上一页 "
else
response.write ""&totalnumber&"位 <a href="&filename&"?page=1&pubUserName="&pubUserName&">首页</a> "
response.write "<a href="&filename&"?page="&CurrentPage-1&"&pubUserName="&pubUserName&">上一页</a> "
end if
if n-currentpage<1 then
response.write "下一页 尾页"
else
response.write "<a href="&filename&"?page="&(CurrentPage+1)&"&pubUserName="&pubUserName&">"
response.write "下一页</a> <a href="&filename&"?page="&n&"&pubUserName="&pubUserName&">尾页</a>"
end if
response.write " 页次:<strong><font color=red>"&CurrentPage&"</font>/"&n&"</strong>页 "
response.write " <b>"&maxperpage&"</b>位用户/页 "
%>
转到:
<select name='select' 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
%>
</td>
</tr>
</table>
<%
else
msgtitle="用户管理"
msginfo="<li>操作错误,你不是系统管理员,没有权限进行此项操作!</li>"
call Sysmsg(msgtitle,msginfo)
end if
else
msgtitle="用户管理"
msginfo="<li>操作错误,你没有登录系统!<li><a href=""User.Asp"" >点此登录系统</a><li><a href=""./"" >返回频道首页</a></li>"
call Sysmsg(msgtitle,msginfo)
end if
%>
</td>
</tr>
</table>
<!-- #include file="admin_footer.asp" -->
</BODY></HTML>
<% CloseDatabase %>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -