* @copyright 2004 http://www.php-tools.net
* @license LGPL
**/
// load error handler
include_once './_error.php';
// include factory/loader
include_once '../patSession.php';
// most easy way to create a session object
$sess =& patSession::singleton( 'ham' );
if( isset( $_REQUEST['restart'] ) && $_REQUEST['restart'] == 'force' ) {
$sess->restart();
}
// see wheter the started session is new
if( $sess->isNew() ) {
echo 'Hurray! A new session was born! :-)
';
}
else {
echo 'Continue session...
';
}
if( !isset( $sess['counter'] ) ) {
$sess['counter'] = 0;
}
$sess['counter'] = $sess['counter'] + 1;
echo 'My personal Counter: ' . $sess['counter'] . '
';
echo '
Access as properties
';
echo 'State: ' . $sess->state . '
';
echo 'Id: ' . $sess->id . '
';
echo 'Name: ' . $sess->name . '
';
echo 'SID: ' . $sess->SID . '
';
// get query string
echo '
';
$queryString = $sess->getSID();
echo '- Continue this session
';
echo '- Start over (make sure, that you don\'t send cookies!)
';
echo '- Restart with cookies (This will destroy the session as well!)
';
?>