I got the following function from one of the PHP websites and I'm
getting the following error:
Warning: fileatime(): Stat failed for /tmp\lost+found (errno=2 - No
such file or directory) in
/home/rfresh/public_html/whosonline_form.php on line 93
This is line 93 in the function below:
if (time()- fileatime(session_save_path() . '\\' . $file) <
MAX_IDLE_TIME * 60)
I don't udnerstand the error and therefore what I need to do to
correct it
<?php
/* How long the maximum amount of time the session can be inactive. */
define("MAX_IDLE_TIME",3);
/* The Function Declaration */
function getOnlineUsers()
{
/* Open the directory where PHP stores its session files */
if ( $directory_handle = opendir( session_save_path() ) )
{
$count = 0;
/* Start reading the files on by one */
while ( false !== ( $file = readdir( $directory_handle ) ) )
{
/*Check if it is a valid session file */
if ($file != '.' && $file != '..')
{
/* Check to see if the session has not been idle for
more than 60 minutes */
if (time()- fileatime(session_save_path() . '\\' .
$file) < MAX_IDLE_TIME * 60)
{
$count++;
}
}
}
closedir($directory_handle);
return $count;
}
else
{
return false;
}
}
print 'Number of members currently online: ' . getOnlineUsers();
?>