class.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. dim action,categoryid
  14. categoryid=request.QueryString("id")
  15. action=request.querystring("action")
  16. select case action
  17. case "add" 
  18. set rs=server.CreateObject("adodb.recordset")
  19. rs.open "select * from category",conn,1,3
  20. rs.AddNew
  21. rs("category")=trim(request("category2"))
  22. rs("categoryorder")=int(request("categoryorder2"))
  23. rs("first")=int(request("first2"))
  24. rs.Update
  25. rs.Close
  26. set rs=nothing
  27. response.Redirect "class.asp"
  28. case "edit"
  29. set rs=server.CreateObject("adodb.recordset")
  30. rs.open "select * from category where categoryid="&categoryid,conn,1,3
  31. rs("category")=trim(request("category"))
  32. rs("categoryorder")=int(request("categoryorder"))
  33. rs("first")=int(request("first"))
  34. rs.Update
  35. rs.Close
  36. set rs=nothing
  37. response.Redirect "class.asp"
  38. case "del"
  39. conn.execute ("delete from category where categoryid="&categoryid)
  40. conn.execute ("delete from sorts where categoryid="&categoryid)
  41. conn.execute ("delete from product where categoryid="&categoryid)
  42. response.Redirect "class.asp"
  43. end select
  44. %>
  45. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  46. <html>
  47. <head>
  48. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  49. <title>406网络书店</title>
  50. <link href="../style.css" rel="stylesheet" type="text/css">
  51. </head>
  52. <body>
  53. <!--#include file="head.htm"-->
  54. <table width="780" border="0" align="center" cellpadding="0" cellspacing="0">
  55.   <tr>
  56.     <td width="219" align="left" valign="top"><br>
  57.       <!--#include file="menu.htm"-->
  58.         <br></td><td width="561" align="left" valign="top">
  59.       <br>      <table border="0" cellpadding="0" cellspacing="0">
  60.         <tr>
  61.           <td><img src="../images/w.gif" width="18" height="18"></td>
  62.           <td style="color:#415373">商品大类管理</td>
  63.         </tr>
  64.       </table>      <br>      <table width="100%" border="0" align="center" cellpadding="0" cellspacing="1">
  65.         <tr align="center" bgcolor="#FFFFFF" height="20">
  66.           <td width="30%">分类名称</td>
  67.           <td width="20%"> 分类排序</td>
  68.           <td width="20%">一级分类</td>
  69.           <td width="30%">确定操作</td>
  70.         </tr>
  71.         <%set rs=server.CreateObject("adodb.recordset")
  72.   rs.Open "select * from category order by categoryorder",conn,1,1
  73.   dim follows
  74.   if rs.EOF and rs.BOF then
  75.   response.Write "<div align=center><font color=red>还没有分类</font></center>"
  76.   follows=0
  77.   else
  78.   do while not rs.EOF
  79.   %>
  80.         <form name="form2" method="post" action="class.asp?action=edit&id=<%=int(rs("categoryid"))%>">
  81.           <tr bgcolor="#FFFFFF" align="center">
  82.             <td><input name="category" type="text" id="category3" size="12" value="<%=trim(rs("category"))%>"></td>
  83.             <td><input name="categoryorder" type="text" id="categoryorder" size="4" value="<%=int(rs("categoryorder"))%>"></td>
  84.             <td><input name="first" type=checkbox value="1">
  85.                 <%if rs("first")=1 then
  86.                 response.Write "<font color=red>一级</font>"
  87.                 else
  88.                 response.Write "二级"
  89.                 end if%>
  90.             </td>
  91.             <td><input type="submit" name="Submit" value="修改">
  92. &nbsp; <a href="class.asp?id=<%=int(rs("categoryid"))%>&action=del" onClick="return confirm('您确定进行删除操作吗?')"><font color=red>删除</font></a> </td>
  93.           </tr>
  94.         </form>
  95.         <%rs.MoveNext
  96.           loop
  97.           follows=rs.RecordCount
  98.           end if%>
  99.       </table>      <br>      <table border="0" cellpadding="0" cellspacing="0">
  100.         <tr>
  101.           <td><img src="../images/w.gif" width="18" height="18"></td>
  102.           <td style="color:#415373">添加商品大类</td>
  103.         </tr>
  104.       </table>      <font color="#FFFFFF">操作注意事项及说明</font><br>      <table width="100%" border="0" align="center" cellpadding="2" cellspacing="2">
  105.         <tr align="center" bgcolor="#FFFFFF" height="20">
  106.           <td width="30%"> 分类名称</td>
  107.           <td width="20%">分类排序</td>
  108.           <td width="20%">一级分类</td>
  109.           <td width="30%">确定操作</td>
  110.         </tr>
  111.         <form name="form1" method="post" action="class.asp?action=add">
  112.           <tr align="center" bgcolor="#FFFFFF">
  113.             <td><input name="category2" type="text" id="category22" size="12"></td>
  114.             <td><input name="categoryorder2" type="text" id="categoryorder22" size="4" value="<%=follows+1%>"></td>
  115.             <td><input name="first2" type="checkbox" id="first22" value="1"></td>
  116.             <td><input type="submit" name="Submit3" value="添加" onClick="return checkpro()">
  117.             <script language="JavaScript">
  118. <!--
  119. function checkpro()
  120. {
  121.     if(checkspace(document.form1.category2.value)) {
  122. document.form1.category2.focus();
  123.     alert("请输入分类名!");
  124. return false;
  125.   }
  126.     if(checkspace(document.form1.categoryorder2.value)) {
  127. document.form1.categoryorder2.focus();
  128.     alert("请输入分类排序!");
  129. return false;
  130.   }
  131.  
  132. }
  133. function checkspace(checkstr) {
  134.   var str = '';
  135.   for(i = 0; i < checkstr.length; i++) {
  136.     str = str + ' ';
  137.   }
  138.   return (str == checkstr);
  139. }
  140. function regInput(obj, reg, inputStr)
  141. {
  142. var docSel = document.selection.createRange()
  143. if (docSel.parentElement().tagName != "INPUT") return false
  144. oSel = docSel.duplicate()
  145. oSel.text = ""
  146. var srcRange = obj.createTextRange()
  147. oSel.setEndPoint("StartToStart", srcRange)
  148. var str = oSel.text + inputStr + srcRange.text.substr(oSel.text.length)
  149. return reg.test(str)
  150. }
  151. //-->
  152.                           
  153.               
  154. </script></td>
  155.           </tr>
  156.         </form>
  157.       </table>      <br>      <table border="0" cellpadding="0" cellspacing="0">
  158.         <tr>
  159.           <td><img src="../images/w.gif" width="18" height="18"></td>
  160.           <td style="color:#415373">操作注意事项及说明</td>
  161.         </tr>
  162.       </table>      <br>      <table width="80%" border="0" align="center" cellpadding="5" cellspacing="0">
  163.         <tr>
  164.           <td height="20"><font color="#FF0000">·请注意分类名称不要含有非法字符。<br>
  165.       ·增加一级分类后,此分类将会被列出到首页的栏目导航<br>
  166.       ·进行删除操作的同时,会删除此大类下包含的所有小分类和商品。</font></td>
  167.         </tr>
  168.       </table>      <br>
  169.       </td>
  170.   </tr>
  171. </table>
  172. <!--#include file="foot.htm"-->
  173. </body>
  174. </html>