quser.asp
上传用户:syzzy1975
上传日期:2022-07-17
资源大小:670k
文件大小:7k
源码类别:

Jsp/Servlet

开发平台:

Java

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <%
  3. %><!--#include file="inc/config.asp"-->
  4. <!--#include file="inc/conn.asp"--> 
  5. <!--#include file="inc/chk.asp"--> 
  6. <%
  7. if session("rank")>1 then
  8. call Msgbox("对不起,您的权限不够!","Back","None")
  9. response.End
  10. end if
  11. %>
  12. <%
  13. if NOT isempty(request("DelQuserSubmit")) then
  14. dim userid
  15. userid=request.QueryString("id")
  16. if userid="" then userid=request("userid")
  17. conn.execute "delete from [user] where userid in ("&userid&")"
  18. conn.execute "delete from orders where userid in ("&userid&")"
  19. response.Redirect "quser.asp"
  20. end if
  21. %>
  22. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  23. <html>
  24. <head>
  25. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  26. <title>406网络书店</title>
  27. <link href="../style.css" rel="stylesheet" type="text/css">
  28. </head>
  29. <body>
  30. <!--#include file="head.htm"-->
  31. <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  32.   <tr>
  33.     <td width="219" align="left" valign="top"><br>
  34.       <!--#include file="menu.htm"-->
  35.         <br></td><td width="561" align="left" valign="top">
  36.       <br>      <table border="0" cellpadding="0" cellspacing="0">
  37.         <tr>
  38.           <td><img src="../images/w.gif" width="18" height="18"></td>
  39.           <td style="color:#415373">前台用户管理</td>
  40.         </tr>
  41.       </table>      <br>      <%
  42. Const MaxPerPage=20 
  43. dim totalPut,CurrentPage,TotalPages,j
  44. if Not isempty(request("page")) then
  45.      currentPage=Cint(request("page"))
  46.     else
  47.      currentPage=1
  48.     end if 
  49. dim namekey,checkbox,vipuser
  50. checkbox=request("checkbox")
  51. namekey=request("namekey")
  52. if namekey="" then namekey=request.QueryString("namekey")
  53. if checkbox="" then checkbox=request.querystring("checkbox")
  54. set rs=server.CreateObject("adodb.recordset")
  55. if namekey="" then
  56. rs.open "select username,userid,realname,vip,score,loginnum,adddate from [user] order by adddate desc",conn,1,1
  57. else
  58. if checkbox=1 then
  59. rs.open "select username,userid,realname,vip,score,loginnum,adddate from [user] where username like '%"&namekey&"%' order by adddate desc",conn,1,1
  60. else
  61. rs.open "select username,userid,realname,vip,score,loginnum,adddate from [user] where username='"&namekey&"' order by adddate desc",conn,1,1
  62. end if
  63. end if
  64. if err.number<>0 then
  65. response.write "数据库中无数据"
  66. end if
  67.    if rs.eof And rs.bof then
  68.      Response.Write "<p align='center' class='contents'> 对不起,没有此用户!</p>"
  69.     else
  70. totalPut=rs.recordcount
  71.     if currentpage<1 then
  72.      currentpage=1
  73.     end if
  74.     if (currentpage-1)*MaxPerPage>totalput then
  75. if (totalPut mod MaxPerPage)=0 then
  76. currentpage= totalPut  MaxPerPage
  77.     else
  78.      currentpage= totalPut  MaxPerPage + 1
  79.     end if
  80. end if
  81. if currentPage=1 then
  82. showContent
  83.         showpage totalput,MaxPerPage,"quser.asp"
  84. else
  85.      if (currentPage-1)*MaxPerPage<totalPut then
  86.          rs.move  (currentPage-1)*MaxPerPage
  87.             dim bookmark
  88.             bookmark=rs.bookmark
  89.             showContent
  90.             showpage totalput,MaxPerPage,"quser.asp"
  91.         else
  92.      currentPage=1
  93.          showContent
  94.          showpage totalput,MaxPerPage,"quser.asp"
  95.     end if
  96. end if
  97. end if
  98. sub showContent
  99. dim i
  100. i=0
  101. %>      <form name="form1" method="post" action="">
  102.         <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
  103.           <tr height="20">
  104.             <td WIDTH="15%" align="center">用户名</td>
  105.             <td WIDTH="15%" align="center">真实姓名</td>
  106.             <td WIDTH="20%" align="center">注册时间</td>
  107.             <td WIDTH="10%" align="center">会员级别</td>
  108.             <td WIDTH="10%" align="center">积分</td>
  109.             <td WIDTH="10%" align="center"> 登录次数</td>
  110.             <td WIDTH="10%" align="center">选 择</td>
  111.           </tr>
  112.           <%do while not rs.eof
  113.   if rs("vip") = true then
  114.     vipuser="VIP会员"
  115.   else
  116.     vipuser="普通会员"
  117.   end if
  118.   %>
  119.           <tr align="center" height="20">
  120.             <td align="center"><a href=equser.asp?id=<%=rs("userid")%>><%=trim(rs("username"))%></a></td>
  121.             <td><%=trim(rs("realname"))%></td>
  122.             <td><%=rs("adddate")%></td>
  123.             <td><%=vipuser %></td>
  124.             <td><%=rs("score")%></td>
  125.             <td> <%=rs("loginnum")%>次</td>
  126.             <td>
  127.               <input name="userid" type="checkbox" id="userid" value="<%=rs("userid")%>" ></td>
  128.           </tr>
  129.           <%i=i+1
  130. if i>=MaxPerPage then Exit Do
  131. rs.movenext
  132.   loop%>
  133.         </table>
  134.         <br>
  135.         <br>
  136.         <div align="center">
  137.           <input name="DelQuserSubmit" type="submit" id="DelQuserSubmit" onClick="return confirm('您确定要这样操作吗?')" value="删除所选用户">
  138.   全选
  139.   <input type="checkbox" name="checkbox2" value="Check All" onClick="mm()">
  140.         </div>
  141.       </form>      <%  
  142. End Sub   
  143.   
  144. Function showpage(totalnumber,maxperpage,filename)  
  145.    Dim n
  146.   
  147. If totalnumber Mod maxperpage=0 Then  
  148. n= totalnumber  maxperpage  
  149. Else
  150. n= totalnumber  maxperpage+1  
  151. End If
  152. Response.Write "<form method=Post action="&filename&"?checkbox="&checkbox&"&namekey="&namekey&">"  
  153. Response.Write "<p align='center' class='contents'> "  
  154. If CurrentPage<2 Then  
  155. Response.Write "<font class='contents'>首页 上一页</font> "  
  156. Else  
  157. Response.Write "<a href="&filename&"?page=1&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>首页</a> "  
  158. Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>上一页</a> "  
  159. End If
  160. If n-currentpage<1 Then  
  161. Response.Write "<font class='contents'>下一页 尾页</font>"  
  162. Else  
  163. Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>"  
  164. Response.Write "下一页</a> <a href="&filename&"?page="&n&"&checkbox="&checkbox&"&namekey="&namekey&" class='contents'>尾页</a>"  
  165. End If  
  166. Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
  167. Response.Write "<font class='contents'> 共有"&totalnumber&"名注册用户 " 
  168. Response.Write "<font class='contents'>转到:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">"  
  169. Response.Write "&nbsp;<input type='submit'  class='contents' value='GO' name='cndok'></form>"  
  170. End Function  
  171. %>      <table border="0" align="left" cellpadding="0" cellspacing="0">
  172.         <tr>
  173.           <td><img src="../images/w.gif" width="18" height="18"></td>
  174.           <td style="color:#415373">搜索用户</td>
  175.         </tr>
  176.       </table>      <br>      <br>      <br>      <form name="form3" method="post" action="quser.asp?action=select">
  177.         <table width="90%" border="0" align="center" cellpadding="0" cellspacing="0">
  178.           <tr>
  179.             <td align="center">按用户名查找:
  180.                 <input name="namekey" type="text" id="namekey4" size="12">
  181. &nbsp;
  182.       <input name="checkbox" type="checkbox" id="checkbox4" value="1" checked>
  183.       模糊查询
  184.       <input type="submit" name="Submit2" value="查 询"></td>
  185.           </tr>
  186.         </table>
  187.       </form>            <br>      <br>
  188.       </td>
  189.   </tr>
  190. </table>
  191. <!--#include file="foot.htm"-->
  192. </body>
  193. </html>