Page 1 of 1

Ending a session

Posted: Thu Feb 04, 2010 3:55 am
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?

Re: Ending a session

Posted: Thu Feb 04, 2010 3:59 am
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.