Welcome Guest, Not a member yet? Register   Sign In
Community Auth

Hi All,

I'm using Community Auth within my CI project. When a user is on the website there's a session generated in the ci_sessions table. When they log in, a new session is generated preventing me from recovering their cart contents as it's stored against their previous session id. Is it normal behaviour to have a new session id after login? Should it not be persistent like the PHP session data?

Any help here would be greatly appreciated.

Thank you,

I would not depend on the session for cart data, you would be better off saving the
session cart data to a database table for cart_contents.

Then when they login you can just read the cart_contents for that users id and update
your session to reflect the cart contents.
What did you Try? What did you Get? What did you Expect?

Joined CodeIgniter Community 2009.  ( Skype: insitfx )

It’s considered best practice to rotate the session Id when logging in. So it’s not that you have a new session, it’s that it has a new Id.

You shuold store the card data with the user.id and not the session.id.

this way, once the user logged in again, you can grab the data from the cart table where user.id = x.

I hope that helps.

Theme © iAndrew 2016 - Forum software by © MyBB