Reputation: 4424
Recently I got an implementation of a shopping cart that needs a fix.
The shopping cart object is stored in a $_SESSION['cart']
. Now there is a problem when the browser is closed, the cart is lost, because sessions do not remain active after the browser is closed.
The way to fix this is to store the cart object in a cookie with longer lifetime instead of a session.
My question to you is if you know a quick fix, or do I really have to go though all the source files and replace the sessions with cookies?
Upvotes: 0
Views: 1433
Reputation: 73
I'm not sure you'll be able to store that sort of data in a cookie without using serialize() and maybe base64_encode() & base64_decode. Something to bear in mind prehaps.
Upvotes: 1
Reputation: 1196
The session is identified by cookie usually and by default that cookie is removed after browser is closed. So if you need to make session which will last long (or forever) you should adjust parameter session.cookie-lifetime
of PHP engine.
Here are the docs on that.
Upvotes: 4
Reputation: 24549
I think you are going to have to do all the edits. Luckily, there is a handy search and replace tool (for Linux) called Regexxer which provides a graphical interface for doing search and replace in multiple files.
Upvotes: 1