By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,521 Members | 1,460 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,521 IT Pros & Developers. It's quick & easy.

PHP Script Error Help Needed

P: n/a
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();

?>

Jul 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
On Sun, 17 Aug 2003 19:44:55 GMT, Ralph Freshour <ra***@primemail.com> wrote:
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)


The directory separator on Unix is /, not \.

Even when programming on Windows you're better off using /, since all the
Windows system calls accept it, and it doesn't conflict with \ as an escape
character.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 16 '05 #2

P: n/a
Yes, that was it - thanks Andy.

BTW - no one should be on this web site yet I get a count of 11 users
- got any ideas as to why?

Ralph

On Sun, 17 Aug 2003 20:47:01 +0100, Andy Hassall <an**@andyh.co.uk>
wrote:
On Sun, 17 Aug 2003 19:44:55 GMT, Ralph Freshour <ra***@primemail.com> wrote:
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)


The directory separator on Unix is /, not \.

Even when programming on Windows you're better off using /, since all the
Windows system calls accept it, and it doesn't conflict with \ as an escape
character.


Jul 16 '05 #3

P: n/a
I found out that the session files are kept around on my server (which
is hosted) and the files are automatically cleaned up (deleted) by PHP
and that I have no control over them - so this makes the script
worthless because when I fixed the slashes to forward and ran the
script I did a print on the sessoion_save_path() and saw about 40 to
50 files and no one was on the site!!! so this means I can't use that
method to determine who's online!!

does anyone have any other idea's???
On Sun, 17 Aug 2003 20:47:01 +0100, Andy Hassall <an**@andyh.co.uk>
wrote:
On Sun, 17 Aug 2003 19:44:55 GMT, Ralph Freshour <ra***@primemail.com> wrote:
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)


The directory separator on Unix is /, not \.

Even when programming on Windows you're better off using /, since all the
Windows system calls accept it, and it doesn't conflict with \ as an escape
character.


Jul 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.