├── README.md └── Session.class.php /README.md: -------------------------------------------------------------------------------- 1 | # phpsessionmanager 2 | Automatically exported from code.google.com/p/phpsessionmanager 3 | 4 | 5 | This project contains the code from [this blog post](http://carsonified.com/blog/dev/how-to-create-bulletproof-sessions/) on [Carsonified](http://carsonified.com/blog Carsonified). 6 | 7 | *Updated 9/24/09* 8 | 9 | ## Usage 10 | 11 | Starting the session is a simple call to the "sessionStart" static function. 12 | 13 | ```php 14 | // Creates a basic session. 15 | SessionManager::sessionStart('InstallationName'); 16 | 17 | // Creates a session thats ends when the browser closes and is only accessible at www.site.com/myBlog/ 18 | SessionManager::sessionStart('Blog_myBlog', 0, '/myBlog/', 'www.site.com'); 19 | 20 | // Creates a session thats ends when the browser closes and is only accessible at https://accounts.bank.com/ 21 | SessionManager::sessionStart('Accounts_Bank', 0, '/', 'accounts.bank.com', true); 22 | ``` 23 | 24 | You can manually set a session id to regenerate using the regenerateSession function. This is useful for when you change authentication states (the user logs in or out) as it also invalidates the old session. 25 | 26 | ```php 27 | // Regenerate the session. 28 | SessionManager:: regenerateSession(); 29 | ``` 30 | 31 | ## Features 32 | 33 | * Protects against fixation attacks by regenerating the ID periodically. 34 | * Prevents session run conditions caused by rapid concurrent connections (such as when Ajax is in use). 35 | * Locks a session to a user agent and ip address to prevent theft. 36 | * Supports users behind proxies by identifying proxy headers in requests. 37 | * Handles edge cases such as AOL's proxy network and IE8's user-agent changes. 38 | -------------------------------------------------------------------------------- /Session.class.php: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/tedivm/phpsessionmanager/8c1d1fcf8be45f4e2c907da89ec217190aebf298/Session.class.php --------------------------------------------------------------------------------