A McGraw Hill Book Plug-in PHP: 100 Power Solutions
By Robin Nixon (McGraw Hill 2010, ISBN 978-0071666596)

Home | About | Buy It | Download | Contact

Select Chapter: 1  2  3  4  5  6  7  8  9 10 11 12

Chapter 9: Plug-in 67 - Close Session

When a user has finished with your website it's a good idea to provide them with a logout button or link, with which they can close the current session in order to prevent another user on their PC coming back to it. With this plug-in you can not only close the session, but all associated data is also destroyed, leaving no potential security risk behind.

The Figure shows the result of first opening a session with PIPHP_OpenSession(), and then closing it again. After closing it, if you try to reload the example code you will not be able to open the session again as all its data was destroyed; your only option is to create a new one.