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

📄 icar.asp

📁 一个网上销售电器的超市购物系统
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
%><!--#include file="manage/inc/config.asp"--> 
<!--#include file="inc/conn.asp"--> 

<%
dim iaction,iid
iaction=request.QueryString("action")
iid=request.QueryString("id")

if iaction="add" then
	if request.cookies(cookieName)("username")="" then 
		call MsgBox("你没有登陆!","None","None")
	else

		set rs=server.CreateObject("adodb.recordset")
		rs.open "select id,username from orders where username='"&trim(request.cookies(cookieName)("username"))&"' and id="&iid&" and state=6",conn,1,1
		if not rs.eof and not rs.bof then
    	call MsgBox("对不起,此商品已存在于您的购物车中,不可以重复添加!","None","None")
			'rs.close
		else
			rs.close
			rs.open "select id,username,state,paid from orders",conn,1,3
			rs.addnew
			rs("id")=iid
			rs("username")=trim(request.cookies(cookieName)("username"))
			rs("state")=6
			rs("paid")=0
			rs.update
			rs.close
			call MsgBox("商品成功添加到你的购物篮!","None","None")
		end if
		set rs=nothing
	end if
end if


dim iCarRs,iPrice,pNum
set iCarRs=server.CreateObject("adodb.recordset")
if request.cookies(cookieName)("username")="" then 
	iPrice=0
	pNum=0
else
	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
	if(request.cookies(cookieName)("vip")) then
		iPrice=iCarRs("vipsum")
	else
		iPrice=ICarRs("psum")
	end if
	pNum=iCarRs("co")
	if pNum=0 then iPrice=0
	iCarRs.close
end if

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 
%>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>购物篮</title>
<link href="style.css" rel="stylesheet" type="text/css">
</head>

<body>
<table width="206" border="0" cellspacing="0" cellpadding="0">
  <%
if request.cookies(cookieName)("username")="" then 
%>
  <tr align="center"> 
    <td height="47" bgcolor="#DAF8ED"><p>&nbsp;</p>
      <p>你还没有登陆<br>
        <br>
        <a href="login.asp" target="_parent">点击这里登陆</a><br>
        <br>
        <a href="forget.asp" target="_parent">忘记密码</a></p></td>
  </tr>
  <tr align="center" valign="middle"> 
    <td bgcolor="#DAF8ED"><img src="images/cart_empty.gif" width="82" height="54"></td>
  </tr>
  <%
else 
if iCarRs.recordcount=0 then
%>
  <tr align="center"> 
    <td height="47" bgcolor="#DAF8ED"> 
      <%
set rs=server.CreateObject("adodb.recordset")
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
dim shop,username

set shop=server.CreateObject("adodb.recordset")

shop.Open "select distinct(goods) from orders where username='"&request.cookies(cookieName)("username")&"' and state=1 ",conn,1,1
if  request.cookies(cookieName)("vip") = "True" then 

	if shop.recordcount=0 then
		response.write "欢迎"&request.cookies(cookieName)("username")&"光临您已经是VIP用户<br>您目前还没有未处理订单<br>共计:0.00元"
	else
		dim shopjiage
		do while not rs.eof
			shopjiage=round(shopjiage+rs("vipprice")*rs("productnum"),2)
			rs.movenext
		loop
		response.write "欢迎"&request.cookies(cookieName)("username")&"光临您已经是VIP用户<br>您目前有"&shop.recordcount&"笔未处理订单<br>共计:"&shopjiage&"元(除邮费)"
	end if
else
	if shop.recordcount=0 then
		response.write "欢迎"&request.cookies(cookieName)("username")&"光临您还是普通用户<br>您目前还没有未处理订单<br>共计:0.00元"
	else
		do while not rs.eof
			shopjiage=round(shopjiage+rs("price2")*rs("productnum"),2)
			rs.movenext
		loop
	response.write "欢迎"&request.cookies(cookieName)("username")&"光临您还是普通用户<br>您目前有"&shop.recordcount&"笔未处理订单<br>共计:"&shopjiage&"元(除邮费)"
	end if
end if

shop.Close
set shop=nothing
rs.close
set rs=nothing
%>
    </td>
  </tr>
  <%
else 
dim ci
do while not iCarRs.eof
ci=ci+1
%>
  <tr align="left"> 
    <td bgcolor="#DAF8ED" style="PADDING-LEFT: 22px;"><%=ci%>.<a href="vpro.asp?id=<%=iCarRs("id")%>" target="_blank"><%=strvalue(iCarRs("name"),22)%></a></td>
  </tr>
  <% 
			  iCarRs.movenext
			  loop
			  end if %>
  <% end if 
  iCarRs.close
  set iCarRs=nothing
				

				%>
  <tr align="center"> 
    <td bgcolor="#DAF8ED"><img src="images/lineleft.gif" width="167" height="1"></td>
  </tr>
  <tr> 
    <td align="center" bgcolor="#DAF8ED"><br>
      共有<%=pNum%>种商品|合计<%=iPrice%>元</td>
  </tr>
  <tr> 
    <td height="35" align="center" bgcolor="#DAF8ED">&nbsp;</td>
  </tr>
</table>
</body>
</html>

⌨️ 快捷键说明

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