%if request.cookies("timesshop")("username")="" then
Response.Write ""
Conn.Close
Set Conn = Nothing
response.End()
end if
%>
我的购物车
<%
dim id,username,action
action=FormatSQL(SafeRequest("action",0))
id=SafeRequest("id",1)
username=trim(request.cookies("timesshop")("username"))
if request("kind")="" then
goodkind=0
else
select case request("kind")
'case 1
'goodkind=1 '赠品
case 2
goodkind=3 '特价商品
case else
goodkind=0
end select
end if
select case action
case "del"
conn.execute "delete from orders where actionid="&FormatSQL(SafeRequest("actionid",1))
if SafeRequest("ll",1)=22 then
response.redirect "profile.asp?action=addtocart"
else
response.redirect "bag.asp"
end if
response.End
case "add"
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from tproduct where id="&id&" ",conn,1,1
if request.cookies("timesshop")("vip")=0 then
strcontent="普通会员"
iprice=rs("tpricenet")
elseif request.cookies("timesshop")("vip")=1 then
strcontent="一钻会员"
iprice=rs("tprice1")
elseif request.cookies("timesshop")("vip")=2 then
strcontent="二钻会员"
iprice=rs("tprice2")
elseif request.cookies("timesshop")("vip")=3 then
strcontent="三钻会员"
iprice=rs("tprice3")
elseif request.cookies("timesshop")("vip")=4 then
strcontent="四钻会员"
iprice=rs("tprice4")
end if
rs.close
set rs=nothing
set rs=server.CreateObject("adodb.recordset")
rs.open "select id,username from orders where username='"&username&"' and id="&id&" and state=0",conn,1,1
if not rs.eof and not rs.bof then
response.write ""
response.end
rs.close
set rs=nothing
else
rs.close
rs.open "select id,username,state,jiage,kind from orders",conn,1,3
rs.addnew
rs("id")=id
rs("username")=username
rs("state")=0 '标注为购物车内商品,1为订单内商品
rs("jiage")=iprice
rs("kind")=goodkind '标示商品性质,是赠品还是特价
rs.update
rs.close
response.Redirect "bag.asp"
set rs=nothing
end if
end select%>