Created
July 2, 2012 21:48
-
-
Save AmauryCarrade/3035929 to your computer and use it in GitHub Desktop.
Session management in AL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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