Aciddiz
Aciddiz

Reputation: 636

How to manage two or more session with PHP?

how to manage two or more session in a single project? i have two or more different session to manage for example the login of a user and some action that the user is doing in the site and when user has finished to do the specific action that specific session will be destroyed or unsetted, without logout the user.

Upvotes: 0

Views: 44

Answers (1)

ceejayoz
ceejayoz

Reputation: 179994

A session can contain more than one value. Store the login as something like $_SESSION['user'] = 123 and your action as a different value, like $_SESSION['current_action'] = 'posting to stack overflow'.

Then, you can do $_SESSION['current_action'] = null to clear it out without destroying the session itself and all the other important data in it.

Upvotes: 2

Related Questions