This is what I used to use ASP last year to write a shopping cart main body, has passed the test, running well, hoping to give the benefit of the enthusiasts of the ASP. (program .....)

Source: Internet
Author: User
Tags date end setcookie domain domain name
Fans | program | Shopping cart <%@ language=vbscript%>
<%Response.Expires=0%>
<%
' Write Cookie
' Response.Write request.cookies ("Warebuycount")
Sub Setcookie (Aname,warenum,warename,price,warecount,pricelow)
Response.Cookies (Aname). Domain=application ("Wareurl") ' Wareurl represent domain name
Response.Cookies (Aname). Expires=date () +30 ' cookie expiration date
Response.Cookies (aname). Path= "/"
Response.Cookies (Aname). Secure = FALSE
Response.Cookies (Aname) ("Warenum") =warenum ' commodity number
Response.Cookies (Aname) ("Warename") =warename ' product name
Response.Cookies (Aname) ("Price") =price ' prices
Response.Cookies (Aname) ("Warecount") =warecount ' quantity purchased
Response.Cookies (Aname) ("Pricelow") =pricelow ' member Price
End Sub

Sub SetCount (Warebuycount) ' is used to calculate the types of goods purchased by customers
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

' Write 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") ' The item number returned from GET, of course, this product must also exist in your commodity list
Warename=request.querystring ("Warename") ' The name of the product returned from get
Price=request.querystring ("price") ' Prices
Warecount=request.querystring ("Warecount") ' Purchase quantity
Pricelow=request.querystring ("Pricelow") ' Member price
' 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)



Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.