How to know is user still online or not ?

Discussion in 'PHP' started by ziya, Jun 28, 2007.

  1. #1
    Hey guys,

    I have a login page, and users logging it via that page. There are few pages on there, and on each one there is a link Exit. wich is logging out the user. If user clicks Exit then it is not problem , I get that user is offline now. But how can I determine is user still online or not if user just closes the explorer window ?

    Thank you ?
     
    ziya, Jun 28, 2007 IP
  2. syedwasi87

    syedwasi87 Active Member

    Messages:
    2,147
    Likes Received:
    59
    Best Answers:
    0
    Trophy Points:
    90
    #2
    what are u talking about..CMS or forums?
     
    syedwasi87, Jun 28, 2007 IP
  3. ziya

    ziya Well-Known Member

    Messages:
    1,971
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #3
    It is dating web site
     
    ziya, Jun 28, 2007 IP
  4. syedwasi87

    syedwasi87 Active Member

    Messages:
    2,147
    Likes Received:
    59
    Best Answers:
    0
    Trophy Points:
    90
    #4
    what are u using atm? php nuke or someother CMS?
     
    syedwasi87, Jun 28, 2007 IP
  5. ziya

    ziya Well-Known Member

    Messages:
    1,971
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #5
    I use Php nuke.
     
    ziya, Jun 28, 2007 IP
  6. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #6
    set a cookie with an expire time or use sessions.
     
    ansi, Jun 28, 2007 IP
  7. ziya

    ziya Well-Known Member

    Messages:
    1,971
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #7
    Sorry, But I want to show list of users who is online right now. That is why I am asking .
    I have table and there I keep users status , if user is online I flag it as online, when user clicks exit I flag it offline. But when user just closes the explorer , how can detect is user online or not ?
     
    ziya, Jun 29, 2007 IP
  8. ansi

    ansi Well-Known Member

    Messages:
    1,483
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    100
    #8
    so store a timestamp along with the information. then delete where timestamp < expire. as long as they stay active, keep updating the time stamp. otherwise if they're idle for over say 10 minutes or so, remove it and count the rows.
     
    ansi, Jun 29, 2007 IP
  9. ziya

    ziya Well-Known Member

    Messages:
    1,971
    Likes Received:
    28
    Best Answers:
    0
    Trophy Points:
    140
    #9
    Yay .. I think I'll give a try this. It sounds ok. Thanks man
     
    ziya, Jun 29, 2007 IP