Abaij
Abaij

Reputation: 873

How to keep session unchanged in codeigniter?

I'm trying to create a shopping cart by storing the cart in a table in a database, instead of using the built-in CI cart class. I use sessionID to identify one visitor from another. But I found that the sessionID is changing for a period of time, even the visitor doesn't close the browser.

Is this a normal behavior of CI to renew the sessionID for a short period of time? Is there a way to make it unchanged until the visitor close the browser?

Thank you at advance.

Upvotes: 2

Views: 1696

Answers (2)

Phil Palmieri
Phil Palmieri

Reputation: 313

Also, make sure in your config file you have cookie_prefix set.. see bottom of: http://ellislab.com/codeigniter/user_guide/libraries/sessions.html

Upvotes: 3

Lotus
Lotus

Reputation: 2656

If your session is contstantly being reset using the CI Session library, make sure the cookie domain is set to something like:

$config['cookie_domain']    = '.mysite.com'; // the . is for a wildcard subdomain

Upvotes: 0

Related Questions