PHP Script Error Help Needed

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ralph Freshour

    #1

    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(sessi on_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_IDL E_TIME",3);

    /* The Function Declaration */
    function getOnlineUsers( )
    {
    /* Open the directory where PHP stores its session files */
    if ( $directory_hand le = opendir( session_save_pa th() ) )
    {
    $count = 0;
    /* Start reading the files on by one */
    while ( false !== ( $file = readdir( $directory_hand le ) ) )
    {
    /*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(sessi on_save_path() . '\\' .
    $file) < MAX_IDLE_TIME * 60)
    {
    $count++;
    }
    }
    }
    closedir($direc tory_handle);
    return $count;
    }
    else
    {
    return false;
    }
    }

    print 'Number of members currently online: ' . getOnlineUsers( );

    ?>

  • Andy Hassall

    #2
    Re: PHP Script Error Help Needed

    On Sun, 17 Aug 2003 19:44:55 GMT, Ralph Freshour <ralph@primemai l.com> wrote:
    [color=blue]
    >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(sessi on_save_path() . '\\' . $file) <
    >MAX_IDLE_TIM E * 60)[/color]

    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 (andy@andyh.co. uk) icq(5747695) (http://www.andyh.co.uk)
    Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)

    Comment

    • Ralph Freshour

      #3
      Re: PHP Script Error Help Needed

      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 <andy@andyh.co. uk>
      wrote:
      [color=blue]
      >On Sun, 17 Aug 2003 19:44:55 GMT, Ralph Freshour <ralph@primemai l.com> wrote:
      >[color=green]
      >>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(sessi on_save_path() . '\\' . $file) <
      >>MAX_IDLE_TI ME * 60)[/color]
      >
      > 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.[/color]

      Comment

      • Ralph Freshour

        #4
        Re: PHP Script Error Help Needed

        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_p ath() 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 <andy@andyh.co. uk>
        wrote:
        [color=blue]
        >On Sun, 17 Aug 2003 19:44:55 GMT, Ralph Freshour <ralph@primemai l.com> wrote:
        >[color=green]
        >>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(sessi on_save_path() . '\\' . $file) <
        >>MAX_IDLE_TI ME * 60)[/color]
        >
        > 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.[/color]

        Comment

        Working...