CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2006
    Posts
    352

    User presence monitoring

    Hello

    I'm using PHP&MySQL

    So when user login, time is recorded in DB.
    When he push log out button, time is recorded in DB.

    When he turns off his computer, or close browser, logout field holds NULL value (Log out NOT pushed).
    How to fight that issue?

    PeeJavery told me that it can be solved through Ajax only.

  2. #2
    Join Date
    Jan 2006
    Posts
    352

    Re: User presence monitoring

    What?

    No reply?

    AJAX seems to be quite unpopular... LOL!


    Ipsens

  3. #3
    Join Date
    Mar 2000
    Location
    Vancouver, BC, Canada
    Posts
    278

    Re: User presence monitoring

    I'm not sure if you can do this with PHP, but here's what you 'could' do if it were java - perhaps PHP has something similar to this:

    when a user logs in, add their information to a list stored globally (in java this could be in a singleton. with .net you can simply store this in the Server object). every time someone hits the server with a link or button click, it resets a time stamp. run a thread that checks for 'dead users' every couple of minute - if the time stamp is stale (has exceeded the max time allotted for a live session -eg: past 20 minutes) stamp them as 'logged out' in the database. if they were logged in and created a session, that session would have expired at 20 minutes (default setting) anyways and they'd have had to relogin.
    David Meikle
    Quantum Unit Solutions, LLC
    www.quantumunit.com

  4. #4
    Join Date
    Aug 2005
    Location
    Milwaukee, WI
    Posts
    55

    Re: User presence monitoring

    My product, also written in php is similar. What you need to do is, rather than just stamp a time for login/logout, is create a session object on server side. I have a simple process, written in c, that monitors those sessions and does numerous things. One of its functions is to end the session when the timeout value has been reached.

    Good luck!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured