pabtyf Posted May 9, 2008 Share Posted May 9, 2008 Hi, I'm having some major issues with sessions on a shopping web site. (Unfortunately I didn't code the whole thing, only the page with the error on:( ). The problem occurs when a user has been through the site and made a purchase, shopping bag info is stored in mysql using the session IDs as the cart ID. After the user goes through the checkout (HSBC integrated) and confirmation emails have been sent out, I have the following code: session_regenerate_id(); unset($_SESSION['cart_id']); unset($_SESSION['voucher_value']); unset($_SESSION['voucher_code']); which should reset the session ID but retain all the session data (right?). When I go through the site everything works as it should, tested in IE6 and 7, Firefox and Opera. The owner of the site goes through the same process, and when they go to place a second order, the contents of the cart are still there and the new order overwrites the previous order. For some reason for her the session ID is not regenerating. I've tested this locally on Xampp, and remotely on the live site but I cant reproduce the problem, (I wondered if it was due to the page being within https instead of http as the rest of the site is but it works for me.) Any help or advice appreciated, I've run out of ideas now... Thanks Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/ Share on other sites More sharing options...
DyslexicDog Posted May 9, 2008 Share Posted May 9, 2008 Sounds like they're caching it somehow, maybe the cookie isn't getting cleared properly? I've had problems in the past trying to clear session variables. maybe you should try to seed the session id regeneration somehow? On a side note are you testing to verify that the new session ID doesn't already exist in the database? Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-536612 Share on other sites More sharing options...
blackcell Posted May 9, 2008 Share Posted May 9, 2008 Isn't there a way to delete cookies if this is the case? I have read about it but am in no way proficient in doing so. But then again I don't know if you can pick and choose the cookies you need to delete? Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-536629 Share on other sites More sharing options...
pabtyf Posted May 9, 2008 Author Share Posted May 9, 2008 On a side note are you testing to verify that the new session ID doesn't already exist in the database? No I'm not checking it against the database, at least I don't think it is I didn't code the rest of the site. But I'm definately not doing it on this page. I can't understand how it is only causing problems with her (and it would have to be the owner of the site!!) Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-536641 Share on other sites More sharing options...
DyslexicDog Posted May 9, 2008 Share Posted May 9, 2008 Try using a session_destroy instead of session_regenerate_id(). Then use session_start(). Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-536753 Share on other sites More sharing options...
pabtyf Posted May 12, 2008 Author Share Posted May 12, 2008 I tried using session_destroy() first. That didn't work (for her) either. I'm thinking maybe her IE settings must be caching the page some how, or not allowing the session to be changed. ??? Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-538879 Share on other sites More sharing options...
DyslexicDog Posted May 12, 2008 Share Posted May 12, 2008 Have you tried add a no-cache meta tag to the html output? http://www.i18nguy.com/markup/metatags.html Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-539073 Share on other sites More sharing options...
revraz Posted May 12, 2008 Share Posted May 12, 2008 You have to use session_start() before you can use session_destroy() Try using a session_destroy instead of session_regenerate_id(). Then use session_start(). Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-539078 Share on other sites More sharing options...
DyslexicDog Posted May 12, 2008 Share Posted May 12, 2008 You have to use session_start() before you can use session_destroy() Try using a session_destroy instead of session_regenerate_id(). Then use session_start(). If he is using session_regenerate_id() then the session should already be started. Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-539129 Share on other sites More sharing options...
pabtyf Posted May 14, 2008 Author Share Posted May 14, 2008 I am using session_start(). I've found the problem now.. The problem was in the user not the code!. She was running both orders at the same time in 2 tabs in IE. That was why I couldn't replicate it! (pretty sure that is not normal shopper behaviour) Thanks for your suggestions anyway Link to comment https://forums.phpfreaks.com/topic/104827-strange-session-problem/#findComment-540868 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.