Log of when user was logged in with MySQL/PHP -


I have a site that I am developing and it has a table that collects logs of all user activity. I am saving the login ... and once a user is logged into an AJAX call (every minute), then an update date for that user adds a new record to the log table on time. Printing and when a user logs in I literacy and wants resonates also be disabled with the code.

What do I have to print:

  • User logged in to [Timestamp]
  • User 2 [ Timestamp]
  • User logged on 3 [timestamp]
  • User 2 [timestamp]

    log table field id, user, datetime

    Any help would be appreciated!

    As far as I know it is only a very effective way to use PHP and MySQL Not what you can do, such as "SELECT * FROM users where the Eicester & lt;" . $ OneMinuteFromNow .

    To make it a little more efficient, you can add the result of this query to another table that creates entries for the log in / out actions. This way you can filter the given users as a result in the previous function.

    If you want to move forward from PHP, then you can set a chronboze to run every minute or so, which checks for which more than one minute is idle, thus being offline The code in cronbose can then put an entry in the MySQL table, to show off user logging.

Comments