I'm implementing a switch user function for an application, but I'm
having some trouble copying the session and I'm thinking there might be
a better way for this.
Currently my thinking is that when you switch a user, copy the current
users session and store it in a temporary variable. Log in the new user
and copy the temporary variable (with the old session) into a session
variable. Upon logout, check for this session variable and if present,
I have all this working, but I can't copy the whole session (using the
variable "session"), but I have to copy each element of the session
instead. Obviously this does not work since if I add something else to
the session, I would have to modify this.
Another solution would be to setup a new session and just store and id
of the old session that I could just load back upon log out, but I'm
not quite sure of the implementation steps of this approach. Maybe
there is a good resource somewhere where I can find some good
information about how to manipulate session information and how it