digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
Here is an example of decoding all the session files (limited to 10 here). Comments explain what each block does.
<?php
session_start();
// what is handling the sessions
$session_type = ini_get('session.save_handler');
// with files, session data files will be in session.save_path directory
if ($session_type == 'files')
{
// directory where session files are in
$session_path = ini_get('session.save_path');
// get the files in session directory
$files = glob($session_path . '/sess_*');
/*
* Iterate over each file and decode sessions
*/
$i = 0;
foreach ($files as $file)
{
echo 'Decoding session data in ' . $file . '';
// file contains session data, get it
$encoded_session = file_get_contents($file);
// unset the current session
$_SESSION = array();
// decode the file data into $_SESSION
session_decode($encoded_session);
// lets look at the data
echo '<pre>' . print_r($_SESSION, 1) . '</pre>';
// limit to 10 files
$i++;
if ($i == 10) break;
}
}
// for other session handlers we have to look elsewhere (such as db etc.)
else
{
}
?>
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101
digital-ether
Nearly a Posting Virtuoso
1,293 posts since Sep 2005
Reputation Points: 461
Solved Threads: 101