* @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;
}
// recieve the session counter
echo 'My personal Counter: ' . $sess['counter'] . '
';
// unfortunatly post/pre increment/decrement syntax does not work
// e.g. $sess['counter']++
$sess['counter'] = $sess['counter'] + 1;
if( $sess['counter'] > 10 ) {
echo 'Oh my gosh! Counter is bigger than 10! Reset counter!
';
unset( $sess['counter'] );
}
// 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!)
';
?>