* @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['foo'] = 'bar';
$sess['pat'] = 'dog';
}
$sess['counter'] = $sess['counter'] + 1;
echo 'My personal Counter: ' . $sess['counter'] . '
';
// use iterator
foreach( $sess as $key => $value ) {
echo $key . ' => ' . $value . '
';
}
// get query string
echo '
';
$queryString = $sess->getQueryString();
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!)
';
?>