1

I figure that this should be possible, as it is a requirement asked by my supervisor. There are a few types of accounts, 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?

toomuchcs
  • 1,344
  • 8
  • 20
  • 25

2 Answers2

0

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.

Spyros
  • 46,820
  • 25
  • 86
  • 129
-1

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.

Wesley van Opdorp
  • 14,888
  • 4
  • 41
  • 59
  • 1
    Actually, the first statement is wrong. If sessions were based on the client, that would be very very bad for security :) Sessions are generated from the server. Also, a session is not persistent as a db is, so it expires. That is why a db is sometimes needed. – Spyros Apr 26 '11 at 09:03
  • 1
    each session is unique and cannot be shared across "all users" – Peter Apr 26 '11 at 16:48