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
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
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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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