Can I at least read the session files for all sessions?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bob Stearns

    Can I at least read the session files for all sessions?

    Right now, I am attempting to see how many users are "signed on" to my
    system. Since this is, at best, rather tenuous in a WEB environment, I
    thought to read the active session variables and see how many sessions
    there were.
  • Berimor

    #2
    Re: Can I at least read the session files for all sessions?

    On Tue, 08 Nov 2005 09:34:02 +0200, Bob Stearns <rstearns1241@c harter.net>
    wrote:
    [color=blue]
    > Right now, I am attempting to see how many users are "signed on" to my
    > system. Since this is, at best, rather tenuous in a WEB environment, I
    > thought to read the active session variables and see how many sessions
    > there were.[/color]

    I'd propose to write timestamp to DB each time the registered user visit
    the site's pages. Then you define the default timeout and make querry -
    something like that :
    SELECT COUNT(username) FROM table_name WHERE last_logged >current_time -
    timeout
    think this is more simple.


    --
    ---
    Exact Meta Search | Major Search Engine

    Comment

    • Chung Leong

      #3
      Re: Can I at least read the session files for all sessions?

      That won't really work since the presence of a session file doesn't
      mean the session is active. Files for session that have expired stay in
      the folder under garbage collection occurs. By default, PHP garbage
      collects about once every 100 requests. When traffic is low (say, in
      the middle of the night), dead sessions could remain for a long time.

      As was suggested, it's probably easier to save the info in the database.

      Comment

      • Bob Stearns

        #4
        Re: Can I at least read the session files for all sessions?

        Chung Leong wrote:[color=blue]
        > That won't really work since the presence of a session file doesn't
        > mean the session is active. Files for session that have expired stay in
        > the folder under garbage collection occurs. By default, PHP garbage
        > collects about once every 100 requests. When traffic is low (say, in
        > the middle of the night), dead sessions could remain for a long time.
        >
        > As was suggested, it's probably easier to save the info in the database.
        >[/color]

        Thanks, I'll work on that.

        Comment

        • Bob Stearns

          #5
          Re: Can I at least read the session files for all sessions?

          Berimor wrote:
          [color=blue]
          > On Tue, 08 Nov 2005 09:34:02 +0200, Bob Stearns
          > <rstearns1241@c harter.net> wrote:
          >[color=green]
          >> Right now, I am attempting to see how many users are "signed on" to
          >> my system. Since this is, at best, rather tenuous in a WEB
          >> environment, I thought to read the active session variables and see
          >> how many sessions there were.[/color]
          >
          >
          > I'd propose to write timestamp to DB each time the registered user
          > visit the site's pages. Then you define the default timeout and make
          > querry - something like that :
          > SELECT COUNT(username) FROM table_name WHERE last_logged >current_time
          > - timeout
          > think this is more simple.
          >
          >[/color]
          Thanks, I'll work on that.

          Comment

          Working...