Ending a session

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
alanmdunsmuir
Forum Newbie
Posts: 1
Joined: Thu Feb 04, 2010 3:46 am

Ending a session

Post by alanmdunsmuir »

I am using session control in PHP, but am having difficulty closing a session properly.

If I include session_destroy(); within a PHP module, I cannot access $_SESSION variables within that module. If I omit session_destroy();, I leave the session open, with the security problems this implies.

How do I get over this?
pbs
Forum Contributor
Posts: 230
Joined: Fri Nov 07, 2008 5:31 am
Location: Nashik, India
Contact:

Re: Ending a session

Post by pbs »

You can use session_unregister(), if you want to destroy session of some specific variable, which will not destroy all your session variables. As you are using session_destroy(), it destroy all sessions.
Post Reply