CBL RememberMe 20060116 review

Download
by rbytes.net on

By using the library, you can continue using the good old $_SESSION variable, while adding the "remember me" funcitionality to your w

License: LGPL (GNU Lesser General Public License)
File size: 1K
Developer: Cybozu Labs, Inc.
0 stars award from rbytes.net

By using the library, you can continue using the good old $_SESSION variable, while adding the "remember me" funcitionality to your web application.

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();

What's New in This Release:
The 'remember' function now refers to the $this->default_remember variable when a new user connects.

CBL RememberMe 20060116 keywords