Skip to content

Instantly share code, notes, and snippets.

@AmauryCarrade
Created July 2, 2012 21:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AmauryCarrade/3035929 to your computer and use it in GitHub Desktop.
Save AmauryCarrade/3035929 to your computer and use it in GitHub Desktop.
Session management in AL
<?php
// Session management
# Get session for an easier access
$session = $_SESSION[$settings['session']];
$datetime = new \Datetime();
# Saving current page in session history
$session['history'][] = array(
'page' => $dump->url,
'time' => $datetime
);
# Visit duration
$session['duration'] = abs($datetime->getTimestamp() - $session['history'][0]['time']->getTimestamp());
# Save the session
$_SESSION[$settings['session']] = $session;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment