PHP Classes

BPT_SessionManager: Manage user access sessions

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 52%Total: 735 All time: 4,547 This week: 455Up
Version License PHP version Categories
bpt_sessionmanager 0.2GNU Lesser Genera...5.0PHP 5, User Management
Description 

Author

This class can be used to manage user access sessions.

It provides a singleton interface to access user access data. It can:

- Get the session identifier
- Check whether a session variable is registered
- Register a session variable
- Retrieve the value of a session variable
- Clear all session variables
- Destroy the session
- Set and check the protection mode, which can make the class redirect the browser to another URL when it is set.

Picture of khamel
Name: khamel <contact>
Classes: 2 packages by
Country: Italy Italy
Age: 40
All time rank: 223586 in Italy Italy
Week rank: 178 Up7 in Italy Italy Up

Details

*** Use case *** Using this class is very simple, after you have included it, you have to call only $smngr = SessionManager::get_instance(); to obtain a SessionManager instance and automatically start a new session. If you want to verify if session starts correctly you can use this method $smngr->is_started(); You can manipulate registered variables using this method $smngr->var_is_registered("foo"); $smngr->register_var("foo","foo"); $smngr->get_var("foo"); $smngr->unregister_var("foo"); to clear all variables, just call $smngr->clear(); *** Protection Mode *** Protection mode is an easy way to ensure that some code run only after a condition is verified, for example a page that require a valid login. In this case, if user has submitted a valid login information you can use $smngr->start_protection() Now, in all pages that require a valid login, call $smngr->is_protected() to verify the condition. you can pass a url (e.g. "http://www.google.it") as parameter to is_protected() function if you want to force url redirection in case of test fail.

  Files folder image Files (2)  
File Role Description
Plain text file BPT_SessionManager.class.php Class Main class file
Accessible without login Plain text file README.txt Doc. README

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 0%
Total:735
This week:0
All time:4,547
This week:455Up
 User Ratings  
 
 All time
Utility:83%StarStarStarStarStar
Consistency:66%StarStarStarStar
Documentation:41%StarStarStar
Examples:-
Tests:-
Videos:-
Overall:52%StarStarStar
Rank:2409