How to check member is online or not?

Discussion in 'PHP' started by hoangthienphuc, Aug 27, 2007.

  1. hoangthienphuc

    hoangthienphuc New Member

    Joined:
    Mar 15, 2007
    Messages:
    17
    Likes Received:
    0
    Trophy Points:
    0
    I am trying to build a statictis utility in my CMS website. This utility will list of user_member (register) in the systems is online or not and it get IP address of that member pc and display information about their visited history ( They has visited other pages before enter my pages ).
    I tried to solve this problem for a long time but it's still not effective. How to do that? Please help me. Thanks for any response.
     
  2. jwshepherd

    jwshepherd New Member

    Joined:
    Aug 13, 2007
    Messages:
    135
    Likes Received:
    0
    Trophy Points:
    0
    Occupation:
    VP Technology Corporation
    Location:
    Texas
    Home Page:
    http://www.officialhackers.com
    using session variables is the easiest way for the first part but adding the extra information may require another database table
    TABLE tbl_online
    user | active | ip | referer

    In the login.php page add a line to insert a record containing the userid, a 1,the ip, http_referer
    in the logoff page update the table active from 1 to a 0 (inactive)

    use select * from tbl_online where active <>0;
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    People may not log off but close the browser and so a cron job should update the database for non existing sessions.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice