📄 icar.asp
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="nimda/config.asp"-->
<!--#include file="edulcni/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 %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<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><%
if request.cookies(cookieName)("UserName")="" then %>
<p align="center" style="margin-top: 4px; margin-bottom: 4px">你还没有登陆</p>
<p align="center" style="margin-top: 4px; margin-bottom: 4px">点击这里<a target="_parent" href="reg.asp">免费注册</a></p>
<p align="center" style="margin-top: 4px; margin-bottom: 4px">或<a href="login.asp" target="_parent">直接登陆</a></p>
<p align="center" style="margin-top: 4px; margin-bottom: 4px"><a href="forget.asp" target="_parent">忘记密码</a></p><%
else
if iCarRs.recordcount=0 then
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 "<p align='center' style='margin-top: 4px; margin-bottom: 4px'>欢迎"&request.cookies(cookieName)("UserName")&"光临<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您已经是VIP用户<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您目前还没有未处理订单<p align='center' style='margin-top: 4px; margin-bottom: 4px'>共计:0.00元"
else
dim shopjiage
do while not rs.eof
shopjiage=round(shopjiage+rs("vipprice")*rs("productnum"),2)
rs.movenext
loop
response.write "<p align='center' style='margin-top: 4px; margin-bottom: 4px'>欢迎"&request.cookies(cookieName)("UserName")&"光临<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您已经是VIP用户<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您目前有"&shop.recordcount&"笔未处理订单<p align='center' style='margin-top: 4px; margin-bottom: 4px'>共计:"&shopjiage&"元(除邮费)"
end if
else
if shop.recordcount=0 then
response.write "<p align='center' style='margin-top: 4px; margin-bottom: 4px'>欢迎"&request.cookies(cookieName)("UserName")&"光临<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您还是普通用户<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您目前还没有未处理订单<p align='center' style='margin-top: 4px; margin-bottom: 4px'>共计:0.00元"
else
do while not rs.eof
shopjiage=round(shopjiage+rs("price2")*rs("productnum"),2)
rs.movenext
loop
response.write "<p align='center' style='margin-top: 4px; margin-bottom: 4px'>欢迎"&request.cookies(cookieName)("UserName")&"光临<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您还是普通用户<p align='center' style='margin-top: 4px; margin-bottom: 4px'>您目前有"&shop.recordcount&"笔未处理订单<p align='center' style='margin-top: 4px; margin-bottom: 4px'>共计:"&shopjiage&"元(除邮费)"
end if
end if
shop.Close
set shop=nothing
rs.close
set rs=nothing
else
dim ci
do while not iCarRs.eof
ci=ci+1%>
<p align='center' style='margin-top: 4px; margin-bottom: 4px'><%=ci%>.<a href="vpro.asp?id=<%=iCarRs("id")%>" target="_blank"><%=strvalue(iCarRs("name"),22)%></a></p>
<%
iCarRs.movenext
loop
end if %>
<% end if
iCarRs.close
set iCarRs=nothing
%>
<p align='center' style='margin-top: 4px; margin-bottom: 4px'>....................</p>
<p align='center' style='margin-top: 4px; margin-bottom: 4px'>共有<%=pNum%>种商品|合计<%=iPrice%>元</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -