<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#incl
ude file="manage/inc/config.asp"-->
<!--#include file="inc/conn.asp"-->
<!--#include file="inc/chk.asp"-->
<%
dim id,username,action
action=request.QueryString("action")
username=trim(request.cookies(cookieName)("username"))
id=request.QueryString("id")
set rs=server.CreateObject("adodb.recordset")
select case action
case "del"
conn.execute "delete from orders where actionid="&request.QueryString("actionid")
response.redirect "car.asp"
case "add"
rs.open "select id,username from orders where username='"&username&"' and id="&id&" and state=6",conn,1,1
if not rs.eof and not rs.bof then
call MsgBox("对不起,此商品已存在于您的购物车中,不可以重复添加!","Close","None")
response.end
rs.close
else
rs.close
rs.open "select id,username,state,paid from orders",conn,1,3
rs.addnew
rs("id")=id
rs("username")=username
rs("state")=6
rs("paid")=0
rs.update
rs.close
set rs=nothing
call MsgBox("商品成功添加到你的购物篮!","Close","None")
response.end
end if
end select
rs.open "select orders.actionid,orders.id,product.name,product.price1,product.price2,product.discount 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">