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

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. dim selectm,selectkey,selectid
  8. selectkey=trim(request(trim("selectkey")))
  9. selectm=trim(request("selectm"))
  10. if selectkey="" then
  11. selectkey=request.QueryString("selectkey")
  12. end if
  13. if selectm="" then
  14. selectm=request.QueryString("selectm")
  15. end if
  16. selectid=request("selectid")
  17. if selectid<>"" then
  18. if session("rank")>1 then
  19. call Msgbox("对不起,您的权限不够!","Back","None")
  20. response.End
  21. end if
  22. conn.execute "delete from product where id in ("&selectid&")"
  23. response.Redirect "mpro.asp"
  24. response.End
  25. end if
  26. %>
  27. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  28. <html>
  29. <head>
  30. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  31. <title>406网络书店</title>
  32. <link href="../style.css" rel="stylesheet" type="text/css">
  33. </head>
  34. <body>
  35. <!--#include file="head.htm"-->
  36. <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  37.   <tr>
  38.     <td width="219" align="left" valign="top"><br>
  39.       <!--#include file="menu.htm"-->
  40.         <br></td><td width="561" align="left" valign="top">
  41.       <br>      <table border="0" cellpadding="0" cellspacing="0">
  42.         <tr>
  43.           <td><img src="../images/w.gif" width="18" height="18"></td>
  44.           <td style="color:#415373">商品查看与修改</td>
  45.         </tr>
  46.       </table>      <script language=javascript>
  47. function test()
  48. {
  49.   if(!confirm('确认删除吗?')) return false;
  50. }
  51. function mm()
  52. {
  53.    var a = document.getElementsByTagName("input");
  54.    if(a[0].checked==true){
  55.    for (var i=0; i<a.length; i++)
  56.       if (a[i].type == "checkbox") a[i].checked = false;
  57.    }
  58.    else
  59.    {
  60.    for (var i=0; i<a.length; i++)
  61.       if (a[i].type == "checkbox") a[i].checked = true;
  62.    }
  63. }
  64.       </script>      <br>      <%
  65. Const MaxPerPage=20 
  66.     dim totalPut   
  67.     dim CurrentPage
  68.     dim TotalPages
  69.     dim j
  70.     dim sql
  71.      if Not isempty(request("page")) then
  72.        currentPage=Cint(request("page"))
  73.     else
  74.        currentPage=1
  75.     end if 
  76. set rs=server.CreateObject("adodb.recordset")
  77. select case selectm
  78. case ""
  79.             rs.open "select id,name,adddate,mark,author from product order by adddate desc",conn,1,1
  80.     case "0"
  81. response.write "<center>请返回选择您要查询的方式!<br><br><a href=javascript:history.go(-1)>点击返回上一页</a></center>"
  82. response.End
  83. case "name"
  84. rs.open "select id,name,adddate,mark,author from product where name like '%"&selectkey&"%' order by adddate desc",conn,1,1
  85. case "zuozhe"
  86. rs.open "select id,name,adddate,mark,author from product where makein like '%"&selectkey&"%' order by adddate desc",conn,1,1
  87. case "chubanshe"
  88. rs.open "select id,name,adddate,mark,author from product where mark like '%"&selectkey&"%' order by adddate desc",conn,1,1
  89.   end select
  90.     if err.number<>0 then
  91. response.write "数据库中无数据"
  92. end if
  93.    if rs.eof And rs.bof then
  94.         Response.Write "<p align='center' class='contents'> 数据库中无数据!</p>"
  95.     else
  96.    totalPut=rs.recordcount
  97.        if currentpage<1 then
  98.            currentpage=1
  99.        end if
  100.        if (currentpage-1)*MaxPerPage>totalput then
  101.     if (totalPut mod MaxPerPage)=0 then
  102.       currentpage= totalPut  MaxPerPage
  103.     else
  104.        currentpage= totalPut  MaxPerPage + 1
  105.     end if
  106.        end if
  107.         if currentPage=1 then
  108.              showContent
  109.              showpage totalput,MaxPerPage,"mpro.asp"
  110.         else
  111.            if (currentPage-1)*MaxPerPage<totalPut then
  112.              rs.move  (currentPage-1)*MaxPerPage
  113.              dim bookmark
  114.              bookmark=rs.bookmark
  115.              showContent
  116.               showpage totalput,MaxPerPage,"mpro.asp"
  117.          else
  118.          currentPage=1
  119.             showContent
  120.             showpage totalput,MaxPerPage,"mpro.asp"
  121.        end if
  122.     end if
  123.         end if
  124.     sub showContent
  125.         dim i
  126.     i=0%>      <br>      <form name="form2" method="post" action="">
  127.         <table width="100%" border="0" align="center" cellpadding="1" cellspacing="1">
  128.           <tr bgcolor="#FFFFFF" align="center" height="20">
  129.             <td height="20" bgcolor="#FFFFFF">书名</td>
  130.             <td height="20">作者</td>
  131.             <td height="20">出版社</td>
  132.             <td height="20">加入时间</td>
  133.             <td>选择</td>
  134.           </tr>
  135.           <%
  136.   do while not rs.eof%>
  137.           <tr bgcolor="#FFFFFF" align="center">
  138.             <td align="left">&nbsp;<a href=epro.asp?id=<%=rs("id")%>>
  139.               <% if len(trim(rs("name")))>20 then
  140. response.write left(trim(rs("name")),18)&"..."
  141. else
  142. response.write trim(rs("name"))
  143. end if%>
  144.             </a></td>
  145.             <td align="left">              <% if len(trim(rs("author")))>20 then
  146. response.write left(trim(rs("author")),18)&"..."
  147. else
  148. response.write trim(rs("author"))
  149. end if%>            </td>
  150.             <td align="left">&nbsp;
  151.                 <%if len(trim(rs("mark")))>30 then
  152. response.write left(trim(rs("mark")),28)&"..."
  153. else 
  154. response.write trim(rs("mark"))
  155. end if%>
  156.             </td>
  157.             <td nowrap><%=rs("adddate")%></td>
  158.             <td align="center"><input name="selectid" type="checkbox" id="selectid" value="<%=rs("id")%>"></td>
  159.           </tr>
  160.           <%i=i+1
  161. if i>=MaxPerPage then Exit Do
  162. rs.movenext
  163.   loop
  164.   rs.close
  165.   set rs=nothing%>
  166.           <tr bgcolor="#FFFFFF">
  167.             <td height="30" colspan="5" align="right">全选
  168.                 <input type="checkbox" name="checkbox2" value="Check All" onClick="mm()">
  169. &nbsp;
  170.       <input type="submit" name="Submit" value="删 除" onClick="return test();">
  171. &nbsp;&nbsp; </td>
  172.           </tr>
  173.         </table>
  174.       </form>      <%  
  175. End Sub   
  176.   
  177. Function showpage(totalnumber,maxperpage,filename)  
  178.    Dim n
  179.   
  180. If totalnumber Mod maxperpage=0 Then  
  181. n= totalnumber  maxperpage  
  182. Else
  183. n= totalnumber  maxperpage+1  
  184. End If
  185. Response.Write "<form method=Post action="&filename&"?selectm="&selectm&"&selectkey="&selectkey&" >"  
  186. Response.Write "<p align='center' class='contents'> "  
  187. If CurrentPage<2 Then  
  188. Response.Write "<font class='contents'>首页 上一页</font> "  
  189. Else  
  190. Response.Write "<a href="&filename&"?page=1&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>首页</a> "  
  191. Response.Write "<a href="&filename&"?page="&CurrentPage-1&"&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>上一页</a> "  
  192. End If
  193. If n-currentpage<1 Then  
  194. Response.Write "<font class='contents'>下一页 尾页</font>"  
  195. Else  
  196. Response.Write "<a href="&filename&"?page="&(CurrentPage+1)&"&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>"  
  197. Response.Write "下一页</a> <a href="&filename&"?page="&n&"&selectm="&selectm&"&selectkey="&selectkey&" class='contents'>尾页</a>"  
  198. End If  
  199. Response.Write "<font class='contents'> 页次:</font><font class='contents'>"&CurrentPage&"</font><font class='contents'>/"&n&"页</font> "  
  200. Response.Write "<font class='contents'> 共有"&totalnumber&"种商品 " 
  201. Response.Write "<font class='contents'>转到第:</font><input type='text' name='page' size=2 maxlength=10 class=smallInput value="&currentpage&">页"  
  202. Response.Write "&nbsp;<input type='submit'  class='contents' value='跳转' name='cndok' ></form>"  
  203. End Function  
  204. %>      <br>      <table border="0" align="center" cellpadding="0" cellspacing="0">
  205.         <tr>
  206.           <td><img src="../images/w.gif" width="18" height="18"></td>
  207.           <td style="color:#415373">商品查找</td>
  208.         </tr>
  209.       </table>      <form name="form1" method="post" action="">
  210.         <table border="0" align="center" cellpadding="3" cellspacing="3">
  211.           <tr bgcolor="#FFFFFF" align="center">
  212.             <td>
  213.               <input name="selectkey" type="text" id="selectkey2" onFocus="this.value=''" value="请输入关健字">
  214.             </td>
  215.             <td>
  216.               <select name="selectm" id="select">
  217.                 <OPTION VALUE="name">按商品名称</OPTION>
  218.                 <OPTION VALUE="zuozhe">按商品序号</OPTION>
  219.                 <OPTION VALUE="chubanshe">按商品内容</OPTION>
  220.               </select>
  221.             </td>
  222.             <td><input type="submit" name="Submit2" value="查 询"></td>
  223.           </tr>
  224.         </table>
  225.       </form>      <br>      <br>
  226.       </td>
  227.   </tr>
  228. </table>
  229. <!--#include file="foot.htm"-->
  230. </body>
  231. </html>