Jump to content

session legnth


M.O.S. Studios

Recommended Posts

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?

Link to comment
https://forums.phpfreaks.com/topic/126165-session-legnth/
Share on other sites

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...

Link to comment
https://forums.phpfreaks.com/topic/126165-session-legnth/#findComment-652431
Share on other sites

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

Link to comment
https://forums.phpfreaks.com/topic/126165-session-legnth/#findComment-652496
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.