November 30th, 2012, 01:38 PM
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?
November 30th, 2012, 02:06 PM
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.
November 30th, 2012, 07:00 PM
Are you changing domains after adding your first product? ie: transitioning from yoursite.com to www.yoursite.com or vice versa
December 1st, 2012, 04:23 AM
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.
Originally Posted by E-Oreo
Edited code and now it works.