• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Community Auth

#1
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,
nyl2k8
Reply

#2
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 )
Reply

#3
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.
Reply

#4
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.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.