logoff user with php *urgent*

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Spam sucks

    logoff user with php *urgent*

    Hello,

    If somebody could help me with this one it would be very nice,

    the story:
    I need to check if a user is online or not at the moment i am doing a user
    logoff with javascript but this is not browser proof so it doesn't work all
    the time. or doing it with a for() statement that writes every 20 sec the
    last unix time to a database, this doesn't work because the for() statements
    stops executing the rest of the page so that doesn't work either

    the problem:
    i can only have one user online for a group, so i have to check if the first
    that logges in for a group is online or not, i have a check time of 1 minut
    so if a user logges off, a new user can login after a minut.

    the reason:
    so you think what is the problem put a logoff button on the screen and your
    finished, well that would be the answer if i wasn't developing a page for
    idiots that destroy the browser window by alt-f4 or the cross instead of the
    logoff button.

    so hope somebody hacked this problem before.

    Thanks in advance

    (sorry for the multi post)

    G


  • Tim Van Wassenhove

    #2
    Re: logoff user with php *urgent*

    In article <3f7bf275$0$587 10$e4fe514c@new s.xs4all.nl>, Spam sucks wrote:[color=blue]
    > Hello,
    >
    > If somebody could help me with this one it would be very nice,
    >
    > the story:
    > I need to check if a user is online or not at the moment i am doing a user
    > logoff with javascript but this is not browser proof so it doesn't work all
    > the time. or doing it with a for() statement that writes every 20 sec the
    > last unix time to a database, this doesn't work because the for() statements
    > stops executing the rest of the page so that doesn't work either
    >
    > the problem:
    > i can only have one user online for a group, so i have to check if the first
    > that logges in for a group is online or not, i have a check time of 1 minut
    > so if a user logges off, a new user can login after a minut.[/color]


    You can have function check_timeouts( ) and store_time() that are called
    everytime a page is requested.

    The store_time function only has to store the current_time.
    The check_timeouts function has to compare current_time with stored_time.
    If the difference for a user > 60, log the user out.

    --
    Visit my website at http://aardbei.madoka.be

    Comment

    • Nikolai Chuvakhin

      #3
      Re: logoff user with php *urgent*

      "Spam sucks" <nomail> wrote in message
      news:<3f7bf275$ 0$58710$e4fe514 c@news.xs4all.n l>...[color=blue]
      >
      > I need to check if a user is online or not at the moment[/color]

      You can't. All you can do is to figure out who accessed your
      site within the last X minutes, hours, or days.
      [color=blue]
      > so hope somebody hacked this problem before.[/color]

      Of course. You must assume that the user is offline, unless you
      have reasons to believe otherwise (e.g., a recent access to a page
      on your site with that user's credentials).

      Cheers,
      NC

      Comment

      Working...