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

Jsp/Servlet

开发平台:

Java

  1. <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
  2. <%
  3. %><!--#include file="manage/inc/config.asp"--> 
  4. <!--#include file="inc/conn.asp"--> 
  5. <%
  6. dim iaction,iid
  7. iaction=request.QueryString("action")
  8. iid=request.QueryString("id")
  9. if iaction="add" then
  10. if request.cookies(cookieName)("username")="" then 
  11. call MsgBox("你没有登陆!","None","None")
  12. else
  13. set rs=server.CreateObject("adodb.recordset")
  14. rs.open "select id,username from orders where username='"&trim(request.cookies(cookieName)("username"))&"' and id="&iid&" and state=6",conn,1,1
  15. if not rs.eof and not rs.bof then
  16. call MsgBox("对不起,此商品已存在于您的购物车中,请不要重复添加!","None","None")
  17. rs.close
  18. else
  19. rs.close
  20. rs.open "select id,username,state,paid from orders",conn,1,3
  21. rs.addnew
  22. rs("id")=iid
  23. rs("username")=trim(request.cookies(cookieName)("username"))
  24. rs("state")=6
  25. rs("paid")=0
  26. rs.update
  27. rs.close
  28. call MsgBox("商品成功添加到你的购物篮!","None","None")
  29. end if
  30. set rs=nothing
  31. end if
  32. end if
  33. dim iCarRs,iPrice,pNum
  34. set iCarRs=server.CreateObject("adodb.recordset")
  35. if request.cookies(cookieName)("username")="" then 
  36. iPrice=0
  37. pNum=0
  38. else
  39. iCarRs.open "select count(*) as co,sum(product.vipprice) as vipsum,sum(product.price2) as psum from product inner join orders on product.id=orders.id where orders.username='"&request.cookies(cookieName)("username")&"' and orders.state=6",conn,1,1
  40. if(request.cookies(cookieName)("vip")) then
  41. iPrice=iCarRs("vipsum")
  42. else
  43. iPrice=ICarRs("psum")
  44. end if
  45. pNum=iCarRs("co")
  46. if pNum=0 then iPrice=0
  47. iCarRs.close
  48. end if
  49. iCarRs.open "select top 10 orders.id,product.name from product inner join orders on product.id=orders.id where orders.username='"&request.cookies(cookieName)("username")&"' and orders.state=6",conn,1,1 
  50. %>
  51. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  52. <html>
  53. <head>
  54. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  55. <title>购物篮</title>
  56. <link href="style.css" rel="stylesheet" type="text/css">
  57. </head>
  58. <body>
  59. <table width="200" border="0" cellspacing="0" cellpadding="0">
  60. <%
  61. if request.cookies(cookieName)("username")="" then 
  62. %>
  63.   <tr align="center">
  64.     <td height="47">你还没有登陆<br><br>
  65.         <a href="login.asp" target="_parent">点击这里登陆</a><br><br>
  66. <a href="forget.asp" target="_parent">忘记密码</a></td>
  67.   </tr>
  68.     <tr align="center" valign="middle">
  69.     <td><img src="images/cart_empty.gif" width="82" height="54"></td>
  70.   </tr>
  71. <%
  72. else 
  73. if iCarRs.recordcount=0 then
  74. %>
  75.   <tr align="center">
  76.     <td height="47">
  77. <%
  78. set rs=server.CreateObject("adodb.recordset")
  79. rs.open "select product.price2,product.vipprice,product.price1,orders.productnum from product inner join orders on product.id=orders.id where orders.state=1 and orders.username='"&trim(request.cookies(cookieName)("username"))&"' ",conn,1,1
  80. dim shop,username
  81. set shop=server.CreateObject("adodb.recordset")
  82. shop.Open "select distinct(goods) from orders where username='"&request.cookies(cookieName)("username")&"' and state=1 ",conn,1,1
  83. if  request.cookies(cookieName)("vip") = "True" then 
  84. if shop.recordcount=0 then
  85. response.write "欢迎"&request.cookies(cookieName)("username")&"光临您已经是VIP用户<br>您目前还没有未处理订单<br>共计:0.00元"
  86. else
  87. dim shopjiage
  88. do while not rs.eof
  89. shopjiage=round(shopjiage+rs("vipprice")*rs("productnum"),2)
  90. rs.movenext
  91. loop
  92. response.write "欢迎"&request.cookies(cookieName)("username")&"光临您已经是VIP用户<br>您目前有"&shop.recordcount&"笔未处理订单<br>共计:"&shopjiage&"元(除邮费)"
  93. end if
  94. else
  95. if shop.recordcount=0 then
  96. response.write "欢迎"&request.cookies(cookieName)("username")&"光临您还是普通用户<br>您目前还没有未处理订单<br>共计:0.00元"
  97. else
  98. do while not rs.eof
  99. shopjiage=round(shopjiage+rs("price2")*rs("productnum"),2)
  100. rs.movenext
  101. loop
  102. response.write "欢迎"&request.cookies(cookieName)("username")&"光临您还是普通用户<br>您目前有"&shop.recordcount&"笔未处理订单<br>共计:"&shopjiage&"元(除邮费)"
  103. end if
  104. end if
  105. shop.Close
  106. set shop=nothing
  107. rs.close
  108. set rs=nothing
  109. %>
  110. </td>
  111.   </tr>
  112. <%
  113. else 
  114. dim ci
  115. do while not iCarRs.eof
  116. ci=ci+1
  117. %>
  118.   <tr align="left">
  119.     <td style="PADDING-LEFT: 22px;"><%=ci%>.<a href="vpro.asp?id=<%=iCarRs("id")%>" target="_blank"><%=strvalue(iCarRs("name"),22)%></a></td>
  120.   </tr>
  121.   <% 
  122.   iCarRs.movenext
  123.   loop
  124.   end if %>
  125.   <% end if 
  126.   iCarRs.close
  127.   set iCarRs=nothing
  128. %>
  129.   <tr align="center">
  130.     <td><img src="images/lineleft.gif" width="167" height="1"></td>
  131.   </tr>
  132.   <tr>
  133.     <td align="center"><br>共有<%=pNum%>种商品|合计<%=iPrice%>元</td>
  134.   </tr>
  135.   <tr>
  136.     <td align="center">&nbsp;</td>
  137.   </tr>
  138. </table>
  139. </body>
  140. </html>