#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0

    Session ID changes


    I am writing a bespoke shopping cart and using php session_id() to track an order before the customer either logs in or creates an account. The idea is that it uses the session id to uniquely identify a person while they are browsing and adding products to the basket, then when they sign in it uses their generated user ID in place of the session ID

    My problem is, that as you order the first product, irrespective of what it is, the session ID changes. After than, no matter what you order, it stays the same, so should you order 20 products, the last 19 are the same session id, but the first is completely different. When you come to the checkout, the shopping basket is now missing the first product ordered.

    I have the session start command at the very top of each page, and session.auto_start is set to 1 in the php.ini file. There are NO characters before I start the session is started.

    Any ideas before I re-write the software?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Sep 2006
    Posts
    2,031
    Rep Power
    535
    I guess I would search all the script that comes with the bespoke shopping cart for session_id(), session_start(), and maybe other related functions.
  4. #3
  5. No Profile Picture
    Lost in code
    Devshed Supreme Being (6500+ posts)

    Join Date
    Dec 2004
    Posts
    8,317
    Rep Power
    7170
    Are you changing domains after adding your first product? ie: transitioning from yoursite.com to www.yoursite.com or vice versa
    PHP FAQ

    Originally Posted by Spad
    Ah USB, the only rectangular connector where you have to make 3 attempts before you get it the right way around
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2012
    Posts
    13
    Rep Power
    0
    Originally Posted by E-Oreo
    Are you changing domains after adding your first product? ie: transitioning from yoursite.com to www.yoursite.com or vice versa
    Ahh - thanks. I'd not specified www or http://www or anything like that, just relative pathing until I use the header command in PhP to redirect.

    Edited code and now it works.

    Thank you.

IMN logo majestic logo threadwatch logo seochat tools logo