M.O.S. Studios Posted September 28, 2008 Share Posted September 28, 2008 Hey guys I built a shopping cart that stores info in session data until it receives confirmation from the payment application. the payment application returns with a session id number and a payment result, My question is how can a session be recalled after the window is closed. and also if I add this code to the script session_cache_expire(2880); session_start(); will it guarantee the session data will be stored for two days(2880 min)? Or is there a possiblity it will delete it befor hand? Quote Link to comment https://forums.phpfreaks.com/topic/126165-session-legnth/ Share on other sites More sharing options...
PFMaBiSmAd Posted September 28, 2008 Share Posted September 28, 2008 Please read this on the session_cache_expire page - http://www.php.net/manual/en/function.session-cache-expire.php#81265 A session will exist as long as the browser provides a valid session id and the corresponding session data file exists on the server. The session handling section in the php manual describes how you could extend the length of a session or even cause it to persist between browser sessions, so I won't bother to repeat that information here. Shopping cart items should be stored in a database anyways and especially after the point in time that someone has committed to purchasing them and has gone through the trouble of entering payment information. Just store the order using a "status" column that indicates what state the order is at. Do you really want someone to loose everything if they accidentally - exit their browser, trip over a power cord, loose their Internet connection... Quote Link to comment https://forums.phpfreaks.com/topic/126165-session-legnth/#findComment-652431 Share on other sites More sharing options...
M.O.S. Studios Posted September 28, 2008 Author Share Posted September 28, 2008 All the information is stored in a mysql db. how ever all the information held in the shopping cart is stored in session data. the payment application works in the back gourd, once the person commits to buy all info is transferred to a mysql data base. so if i use the command Im going to look at that site and figure it out, unless some knows if session_cache_expire(2880); session_start(); will garntee the session data for 48 hours Quote Link to comment https://forums.phpfreaks.com/topic/126165-session-legnth/#findComment-652496 Share on other sites More sharing options...
CroNiX Posted September 29, 2008 Share Posted September 29, 2008 No it won't guarantee it. If someone closes their browser and opens it again, it will assign a new session. Quote Link to comment https://forums.phpfreaks.com/topic/126165-session-legnth/#findComment-652627 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.