Created
March 12, 2015 20:55
-
-
Save dammyammy/14fd8a69cc6df945819f to your computer and use it in GitHub Desktop.
Usage Of Session Handler Class
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $session = new SecureSessionHandler('cheese'); | |
| ini_set('session.save_handler', 'files'); | |
| session_set_save_handler($session, true); | |
| session_save_path(__DIR__ . '/sessions'); | |
| $session->start(); | |
| if ( ! $session->isValid(5)) { | |
| $session->destroy(); | |
| } | |
| $session->put('hello.world', 'bonjour'); | |
| echo $session->get('hello.world'); // bonjour |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How do you reuse the $session object across pages?
i.e. what if I create a new session in a
login.phppage, then I redirect tosecure.phpand want to check whether the session is still valid?