开发者

Multiple users on one account: session data

开发者 https://www.devze.com 2023-02-28 13:48 出处:网络
I figure that this should be possible, as it is a requirement asked by my supervisor. There are a few types of acco开发者_如何学Cunts, one of them is a \'company\' account which should allow anyone in

I figure that this should be possible, as it is a requirement asked by my supervisor. There are a few types of acco开发者_如何学Cunts, one of them is a 'company' account which should allow anyone in the company who has these credentials to log in at the same time.

Now my question is, how do I store temporary data like: (this is fictive) shopping carts, keeping track of wizards,... I suppose that I'll have to store this in the database? What would be my best option. Link it to the unique session id?


Yes, you can store sessions in your database if you like. A nice way to do it, is by creating a sessions like table that stores states. Therefore, if you have a cart, you can have a cart table that represents what products the cart has and replay that after a user logs back in.


Session information isn't based on your account-system but on the system of the visitor (cookie). Unless you want all information to be shared across all users logged in on the company account (which I doubt) you shouldn't have to store any of the information in the database.

To store the data you can simply keep using session (as I suppose you already do for the 'normal' account.

0

精彩评论

暂无评论...
验证码 换一张
取 消