CBL RememberMe
CBL RememberMe is a tiny library that adds the "remember me" functionality to PHP session handling.
By using the library, you can continue using the good old $_SESSION variable, while adding the "remember me" funcitionality to your web application.

- Development Status: Beta
- Intended Audience: Developers
- License: GNU Lesser General Public License (LGPL2.1orlater)
- Programming Language: JavaScript, PHP
- Topic: CGI Tools/Libraries
- Translations: English, Japanese
- User Interface: Web-based
Download
- cbl_rememberme.phps (source code)
Latest News
- CBL RememberMe (20060116) Released (January 16, 2006)
- CBL RememberMe (20051212) Released (December 12, 2005)
Setup
In order to use CBL RememberMe, runtime configuration variable session.cookie_lifetime should be set in php.ini. Below example sets the lifetime to one week. The lifetime can alternatively be set at runtime by calling session_set_cookie_params.
session.cookie_lifetime = 604800 # in php.ini, set expiration to 7 days
Usage
Construct the RememberMe object with two parameters; name of the cookie to be used for handling state, and, a boolean flag indicating whether or not the "remember me" functionality should be turned on by default.
To turn on / to turn off the "remember me" functionality, call setRemember function.
When clearing session information (i.e. resetting the $_SESSION object), a special variable $_SESSION['__cbl_rememberme'] should be preserved. For this purpose, you can use the clear function.
/* construct the rememberme object */
$gRememberMe = new CBL_RememberMe('rememberme', true);
/* don't remember me */
$gRememberMe->setRemember(false);
/* remember me */
$gRememberMe->setRemember(true);
/* clear session info (replacement for $_SESSION = array()) */
$gRememberMe->clear();
Related Information
For more information, see the author's weblog.
