473,385 Members | 1,317 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

PHP Script Error Help Needed

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
3 4298
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Paul Winkler | last post by:
This is driving me up the wall... any help would be MUCH appreciated. I have a module that I've whittled down into a 65-line script in an attempt to isolate the cause of the problem. (Real...
1
by: Les Juby | last post by:
A year or two back I needed a search script to scan thru HTML files on a client site. Usual sorta thing. A quick search turned up a neat script that provided great search results. It was fast,...
16
by: Fox | last post by:
I merged and modified these script which work perfectly fine as long as I use server.execute to access the VBS part (which is itself in another ASP file). When these I use a session variable to...
0
by: ZMan | last post by:
Scenario: This is about debugging server side scripts that make calls to middle-tier business DLLs. The server side scripts are legacy ASP 3.0 pages, and the DLLs are managed DLLs...
3
by: Tobius | last post by:
I want to be able to define a custom onerror event that detects an attempt to call a known function and load a file if it's not already loaded and re-call the function. The only problem is that any...
3
plumpnation
by: plumpnation | last post by:
Warning: mail(): SMTP server response: 550 Requested action not taken: mailbox unavailable or not local in..... This is the error message. The history of this situation is this: We took a...
2
by: Nosferatum | last post by:
This script is meant to limit access by sessions, using username and password from mysql db and redirect users after login according to a given value belonging to each user in the db (10,20,30,40)....
5
by: This | last post by:
I have a pretty basic emailing script that sends a relatively small number (150) of html emails. The emails are compiled, personalised from a mysql db subscribers list, and sent using mail() -...
6
by: morph.1989 | last post by:
Hi, I can't get this script to work. I've used this exact script on other places and it works, but now i get this error. <codeWarning: mysql_fetch_array(): supplied argument is not a valid...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.