<?
require ("sessionLister.php");
$sl = new sessionLister();
// Example 1
//----------
// Count sessions younger than 1 hour
$recentCount = 0;
foreach( $sl->getSessions() as $sessName => $sessData )
{
if ($sessData["age"]<3600)
$recentCount++;
}
echo $recentCount." sessions accessed within the last hour<br><br>";
// Example 2
//----------
// Display all the sessions and its data
echo $sl->getSessionsCount()." sessions available<br><br>";
foreach( $sl->getSessions() as $sessName => $sessData )
{
echo "<hr>Session ".$sessName." :<br>";
echo " Rawdata = ".$sessData["raw"]."<br>";
echo " creation date = ".date( "d/m/Y H:i:s",$sessData["creation"])."<br>";
echo " last modif date = ".date( "d/m/Y H:i:s",$sessData["modification"])."<br>";
echo " age = ".round($sessData["age"]/3600/24,1)." days<br>";
}
?>
|