<% ' SHOPPING CART COOKIE LIBRARY ' BRANDON McLAMB ' IDESIGNS (c) 2000 dim ID ID = Request.QueryString("ID") ' This function determines if an item is in the cart Function IsInCart(ID) ' Declare the variables dim item ' If the cookie exists, determine if the product is in the cart If (Request.Cookies("CART").HasKeys) Then IsInCart=False For Each item In Split(Request.Cookies("CART")("ITEMS"),",") If cInt(item)=cInt(ID) Then IsInCart=True Exit For End If Next ' Else, if the cookie does not exist, it cannot be in the cart Else IsInCart=False End If End Function ' If the item is not already in the cart, then add it If NOT(IsInCart(ID)) Then ' If there are more than 1 items in the cart, apend this item If (Len(Request.Cookies("CART")("ITEMS"))>0) Then Response.Cookies("CART")("ITEMS") = Request.Cookies("CART")("ITEMS") & "," & ID ' Else, just set the items equal to this item Else Response.Cookies("CART")("ITEMS") = ID End If End If response.redirect("./default.asp") %>