SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast AimyThomas's Avatar
    Join Date
    Sep 2011
    1 Post(s)
    0 Thread(s)

    How to Get Login time history in PHP?


    Need a perfect user data base solution for my ecommerce website. I want to track whole activity of my end user until the user logout

    Thanks in Advance

  2. #2
    . shoooo... silver trophy logic_earth's Avatar
    Join Date
    Oct 2005
    8 Post(s)
    0 Thread(s)
    Alright...and what is the question or problem you are having? Or are you wanting to use us as free labor once more? I would think judging by the link in your signature, that you would have the ability to develop such a system. :s
    Logic without the fatal effects.
    All code snippets are licensed under WTFPL.

  3. #3
    Hosting Team Leader silver trophybronze trophy
    cpradio's Avatar
    Join Date
    Jun 2002
    152 Post(s)
    0 Thread(s)
    This is very similar to providing a Who's Online component to a website, which consists of the following:

    First you have to have a MySQL table, lets call it Sessions (or whatever you want to call it; with at least a session_id column and a last_activity_date column, you can add additional columns)
    Next you INSERT a record into this table storing the session id of the user session_id() and a date/time stamp (using MySQL function NOW()).
    As the browse your site you update that record's last_activity_date column.
    At the same time, you have either a cronjob running or a second query run on every page that queries the Sessions table checking for a date/time stamp that is more than X minutes ago.
    Example: session_id 123456 last_activity_date reports 2012-10-04 11:00:00 and it is now 2012-10-04 11:15:00, so 15 minutes have passed with no interaction.
    Now do whatever you wanted to do with those records.
    Be sure to congratulate Patche on earning July's Member of the Month
    Go ahead and blame me, I still won't lose any sleep over it
    My Blog | My Technical Notes


Posting Permissions

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