son Posted December 29, 2009 Share Posted December 29, 2009 I noticed that Firefox sometimes still holds data in cart when I open the browser one day later. Would session data not automatically be destroyed when the browser is closed? Is there a way to remedy the situation?Son Link to comment Share on other sites More sharing options...
Redroest Posted December 29, 2009 Share Posted December 29, 2009 Session data will be deleted on browserclose. firefox uses a algorithm that remembers websites and puts in text like passwords and emails when it comes up to the same website and form.You have to use cookies to solve this problem. You can read more about it on the W3schools website. Link to comment Share on other sites More sharing options...
justsomeguy Posted December 29, 2009 Share Posted December 29, 2009 It won't automatically restart the session, even if it still has the session cookie PHP has already deleted the session data on the server (unless you've set the session expire time way past the default). If it's finding information then you're probably already using a cookie, and it's finding the cookie you set. It doesn't matter if the browser still has the session cookie if it's already been deleted on the server though. Link to comment Share on other sites More sharing options...
son Posted January 4, 2010 Author Share Posted January 4, 2010 It won't automatically restart the session, even if it still has the session cookie PHP has already deleted the session data on the server (unless you've set the session expire time way past the default). If it's finding information then you're probably already using a cookie, and it's finding the cookie you set. It doesn't matter if the browser still has the session cookie if it's already been deleted on the server though.I start each page with:ob_start();// initialize a sessionsession_start(); and create sessioin data for cart with: $_SESSION['cart'][$id]['qty'] = $qty2 as an example for quantity of shopping cart and $_SESSION['user_id'] = $row['user_id']; for user area. When cart contents get send, session data is unset viaunset($_SESSION['cart']);and when user logs out, session data is unset viaunset($_SESSION['user_id']);I do not use cookies....Son Link to comment Share on other sites More sharing options...
justsomeguy Posted January 4, 2010 Share Posted January 4, 2010 If you unset the session then the server should not be restoring any state information. Make sure you aren't seeing a cached copy of the page. Link to comment Share on other sites More sharing options...
son Posted January 5, 2010 Author Share Posted January 5, 2010 If you unset the session then the server should not be restoring any state information. Make sure you aren't seeing a cached copy of the page.As you are saying it. This might be the problem. SOme time ago had massive issues with cached pages. Even when hard-clearing the cache in Firefox and after even re-starting I still looked at cached pages... Would it be best to insert something at top of php page to prevent caching? What would you do?Son Link to comment Share on other sites More sharing options...
justsomeguy Posted January 5, 2010 Share Posted January 5, 2010 You can send some headers if you want to tell the browser not to cache the page: header("Expires: Tue, 03 Jul 2001 06:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache"); Link to comment Share on other sites More sharing options...
son Posted January 11, 2010 Author Share Posted January 11, 2010 You can send some headers if you want to tell the browser not to cache the page: header("Expires: Tue, 03 Jul 2001 06:00:00 GMT"); header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0"); header("Cache-Control: post-check=0, pre-check=0", false); header("Pragma: no-cache");Thanks for feedback...Son Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.