爱好者|程序|购物车
<%@ Language=VBScript %>
<%Response.Expires=0%>
<%
'写入COOKIE
'Response.Write Request.Cookies("warebuycount")
sub setcookie(Aname,warenum,warename,price,warecount,pricelow)
Response.Cookies(Aname).domain=application("wareurl") 'wareurl代表域名
Response.Cookies(Aname).expires=date()+30 'COOKIE过期日期
Response.Cookies(Aname).path="/"
Response.Cookies(Aname).Secure = FALSE
Response.Cookies(Aname)("warenum")=warenum '商品编号
Response.Cookies(Aname)("warename")=warename '商品名称
Response.Cookies(Aname)("price")=price '价格
Response.Cookies(Aname)("warecount")=warecount '购买的数量
Response.Cookies(Aname)("pricelow")=pricelow '会员价格
end sub
sub setcount(warebuycount) '用于计算客户购买的商品种类
Response.Cookies("warebuycount").domain=application("wareurl")
Response.Cookies("warebuycount").expires=date()+30
Response.Cookies("warebuycount").path="/"
Response.Cookies("warebuycount").secure=false
Response.Cookies("warebuycount")=warebuycount
end sub
'写入COOKIES
sub setcookies(warenum,warename,price,warecount,pricelow,warebuycount)
setcookie "warenum"+Cstr(warebuycount),warenum,warename,price,warecount,pricelow
end sub
sub delcookies(delwarenum)
warebuycount=Request("warebuycount")-1
while Cint(delwarenum)<=Cint(warebuycount)
setcookies Request.Cookies("warenum"+Cstr(delwarenum+1))("warenum"),Request.Cookies("warenum"+Cstr(delwarenum+1))("warename"),Request.Cookies("warenum"+Cstr(delwarenum+1))("price"),Request.Cookies("warenum"+Cstr(delwarenum+1))("warecount"),Request.Cookies("warenum"+Cstr(delwarenum+1))("pricelow"),delwarenum
delwarenum=delwarenum+1
wend
setcount warebuycount
end sub
warenum=Request.QueryString("warenum") '从GET返回的商品编号,当然,这个商品也一定要存在于你的商品表中
warename=Request.QueryString("warename") '从GET返回的商品名称
price=Request.querystring("price") '价格
warecount=Request.QueryString("warecount") '购买数量
pricelow=Request.QueryString("pricelow") '会员价格
'setcount 4
warebuycount=Request.Cookies("warebuycount")
'Response.Write warebuycount
if Request.ServerVariables("REQUEST_METHOD")="POST" then
dum=request("del")
dim delnum
delnum=split(dum,",")
T1=1
warebuycount=Request.Cookies("warebuycount")
while T1<=Cint(warebuycount)
tm=request("warenum"+Cstr(T1))
rm="warenum"+Cstr(T1)
nomodi=false
if tm="" then
tm=0
end if
if instr(1,Cstr(tm),".") or tm=0 then
nomodi=true
else
setcookies Request.Cookies("warenum"+Cstr(T1))("warenum"),Request.Cookies("warenum"+Cstr(T1))("warename"),Request.Cookies("warenum"+Cstr(T1))("price"),tm,Request.Cookies("warenum"+Cstr(T1))("pricelow"),T1
end if
T1=T1+1
wend
if dum<>"" then
Cwarenum=0
while Cwarenum<=ubound(delnum)