Results 1 to 6 of 6
  1. #1
    Join Date
    Aug 2007
    Location
    Oakham England
    Posts
    499

    Cart Sessions Vs Cookies

    Hey

    Whats best to use for a shopping cart?

    SESSIONS

    or

    COOKIES


    Dan
    Streama - Your WordPress Friend
    http://www.streama.co.uk

  2. #2
    Join Date
    Jan 2006
    Location
    Athens, Greece
    Posts
    1,479
    Use sessions for everything and use cookie to save the cart contents, so when the user
    comes back the other day his bag will be ready for checkout!!!

  3. #3
    Join Date
    Aug 2007
    Location
    Oakham England
    Posts
    499
    ummm so set the cart items to cookies?

    Dan
    Streama - Your WordPress Friend
    http://www.streama.co.uk

  4. #4
    Join Date
    Jan 2006
    Location
    Athens, Greece
    Posts
    1,479
    Yes and session too... You will read the cookie only if the variable that holds the cart data
    does not exist... !isset($_SESSION['cart'])

  5. #5
    Join Date
    Apr 2011
    Posts
    34
    yep though remember when using cookies that users can hack them and change what they say in them. so you must design about this.
    for example you save all the item id numbers in the cookie
    when you call them back to your website
    first run the value though mysql_real_escape_string()(could change it too sql injection)
    then run
    run a loop to make sure the item number exsist in your dater base est

    other than thaht you are find though for any logins are data senstive stuff user sessions hope this helps

  6. #6
    cookies for only the cart content if you dont want problems later on

Similar Threads

  1. Sessions or Cookies?
    By Jeanco in forum Programming Discussion
    Replies: 4
    Last Post: 03-09-2006, 01:35 AM
  2. cookies/sessions across (sub)domains
    By PlanetWebHost in forum Programming Discussion
    Replies: 3
    Last Post: 09-11-2005, 10:48 AM
  3. sessions or cookies in php?
    By scott79 in forum Programming Discussion
    Replies: 16
    Last Post: 05-23-2004, 10:54 AM
  4. Poll: Sessions or Cookies?
    By Hatcher in forum Programming Discussion
    Replies: 26
    Last Post: 05-25-2003, 09:43 AM
  5. Sessions and Cookies
    By Xandra in forum Programming Discussion
    Replies: 10
    Last Post: 09-15-2002, 09:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •