⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 userlist.asp

📁 971音乐站全站程序
💻 ASP
字号:
<%PageName="UserList"%>
<!--#include file="function.asp"-->
<%CheckAdmin3%>
<!--#include file="conn.asp"-->
<%
if not isempty(request("page")) then
	currentPage=cint(request("page"))
else
	currentPage=1
end if


If request("action")="save" Then
	dim loginday,user_rs,DelName
	loginday=Cint(request.form("loginday"))
	set user_rs=conn.execute("select UserName,logintime from [user]")
		Do while not user_rs.eof
			If datediff("d",user_rs(1),now()) >= loginday Then
				DelName=DelName&",'"&user_rs(0)&"'"
			End If
			user_rs.movenext
		Loop
		
	user_rs.close
	set user_rs=nothing
	
	If instr(DelName,",")=1 and DelName<>"" Then
		DelName=mid(DelName,2)
	End If

	If DelName<>"" Then
		conn.execute("delete * from [user] where UserName in ("&DelName&")")
		conn.execute("delete * from [Box] where UserName in ("&DelName&")")
	End If
End If
%>
<!--#include file="top.asp"-->
<div align="center">
<center>
<table border="0" width="86%" cellspacing="1" cellpadding="1">
 <tr>
<td align=center valign=top>
<%
set rs=server.createobject("adodb.recordset")
sql="select * from [user] order by id desc" 
rs.open sql,conn,1,1
if rs.eof and rs.bof then 
	response.write "<p align='center'>暂时没有用户注册</p>" 
else 
	MaxPerPage=20
	PageUrl="Userlist.asp"
	totalPut=rs.recordcount 
	if currentpage<1 then currentpage=1
	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,PageUrl
		showContent 
		showpage totalput,MaxPerPage,PageUrl
	else 
		if (currentPage-1)*MaxPerPage<totalPut then 
			rs.move  (currentPage-1)*MaxPerPage 
			dim bookmark 
			bookmark=rs.bookmark 
			showpage totalput,MaxPerPage,PageUrl
			showContent 
			showpage totalput,MaxPerPage,PageUrl
		else 
			currentPage=1 
			showpage totalput,MaxPerPage,PageUrl
			showContent 
			showpage totalput,MaxPerPage,PageUrl
		end if 
	end if 
end if 
rs.close 
			
sub showContent 
i=0 
%>
            <table border="1" width="100%" cellspacing="0" cellpadding="0" class="TableLine" bordercolor="#A4CEE4" bordercolordark="#FFFFFF">
              <tr>
                <td width="13%" height=25 align=center bgcolor="#96C5DE"><font color="white">ID</font></td>
                <td width="50%" height=25 align=center bgcolor="#96C5DE"><font color="white">用户名</font></td>
                <td width="13%" height=25 align=center bgcolor="#96C5DE"><font color="white">修改</font></td>
                <td width="13%" height=25 align=center bgcolor="#96C5DE"><font color="white">锁定</font></td>
                <td width="13%" height=25 align=center bgcolor="#96C5DE"><font color="white">删除</font></td>
              </tr>
<%
do while not rs.eof
	i=i+1
%>
              <tr>
                <td height="22" align=center><%=rs("id")%> </td>
                <td align=center><a href="UserModify.asp?id=<%=rs("id")%>"><%=rs("UserName")%></a></td>
                <td align=center><input type=button name=edit value=修改 onclick="javascript:window.open('UserModify.asp?id=<%=rs("id")%>','_self','')"></td>
                <td align=center><input type=button name=lock value=<%if rs("lockuser")=false then%>"锁定"<%else%>"开锁"<%end if%> onclick="javascript:window.open('UserSave.asp?id=<%=rs("id")%>&act=lock','_self','')"></td>
                <td align=center><input type=button name=del value=删除 onclick="javascript:window.open('UserDel.asp?id=<%=rs("id")%>','_self','')"></td>
              </tr>
<%
	if i>=MaxPerPage then exit do
rs.movenext
loop
%>
            </table>
<%
end sub 

function showpage(totalnumber,maxperpage,filename)
if totalnumber mod maxperpage=0 then
	n= totalnumber \ maxperpage
else
	n= totalnumber \ maxperpage+1
end if
%>
<form method=Post action="<%=filename%>?classid=<%=classid%>&Nclassid=<%=Nclassid%>">
  <center>共<font color="red"><b><%=totalnumber%></b></font>个用户     
<%if CurrentPage<2 then%>
  &nbsp;首页 上一页&nbsp;     
<%else%>
  &nbsp<a href="<%=filename%>?page=1&classid=<%=classid%>&Nclassid=<%=Nclassid%>">首页</a>&nbsp;     
  <a href="<%=filename%>?page=<%=CurrentPage-1%>&classid=<%=classid%>&Nclassid=<%=Nclassid%>">上一页</a>&nbsp;     
<%
end if
if n-currentpage<1 then
%>
  下一页 末页     
<%else%>
  <a href="<%=filename%>?page=<%=CurrentPage+1%>&classid=<%=classid%>&Nclassid=<%=Nclassid%>">下一页</a>     
  <a href="<%=filename%>?page=<%=n%>&classid=<%=classid%>&Nclassid=<%=Nclassid%>">末页</a>     
<%end if%>     
  &nbsp;页次:<strong><font color="red"><%=CurrentPage%>/<%=n%></font></strong>页     
  转到:<select name="page" size="1" onchange="javascript:submit()">
<%for i = 1 to n%>                
  <option value="<%=i%>" <%if cint(CurrentPage)=cint(i) then%> selected <%end if%>>第<%=i%>页</option>   
<%next%>   
  </select>             
</form>        
<%end function%>
</center>
    </td>
  </tr>
  </table>
<br><br>
<form method="POST" action="userlist.asp?action=save">
<table border="1" width="321" cellspacing="0" cellpadding="0" class="TableLine" bordercolor="#A4CEE4" bordercolordark="#FFFFFF">
  <tr>
    <td width="315" align=center bgcolor="#96C5DE" colspan="2" height="23"><font color="#FFFFFF">批量删除用户</font></td>
  </tr>
  <tr>
    <td width="223" align=center>&nbsp;删除<input name="loginday" size=4 value="30">天未访问用户</td>
    <td width="92" align=center>&nbsp; <input type="submit" value=" 删 除 " name="B1"></td> 
  </tr>
</table>
</form>
<br>
</div>
<%
set rs=nothing
conn.close
set conn=nothing%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -