Is Log-in Tracking Possible?

Discussion in 'Web Design and Development' started by rhp2424, Aug 25, 2011.

  1. rhp2424 macrumors regular

    rhp2424

    Joined:
    Jul 23, 2008
    #1
    I am curious if it is possible to keep a SQL database of each log-in by a user along with the date and time and the log-in. If it is, would anybody mind pointing me in the direction of, or sharing a script to handle this? Ideally it would just have their username and the datetime stamp, along with the record id, of course. Also I'm hoping it will just be a function to add, or maybe a small include file perhaps?
    I have a website that won't be used very often, so it isn't a concern that this data will get to be too large. For my records, I'd just like to be able to keep track of when it is used. I created the site with PHP and MySQL, and any help would be more than greatly appreciated!

    Thanks!
     
  2. jsm4182 macrumors 6502

    Joined:
    Apr 3, 2006
    Location:
    Beacon, NY
    #2
    Of course its possible. All you would have to do is add another SQL query to the login script that records that information.

    Something like:

    Code:
    INSERT INTO logins (uid, time) VALUES ('$user', 'NOW()')
     
  3. rhp2424 thread starter macrumors regular

    rhp2424

    Joined:
    Jul 23, 2008
    #3
    I should have figured it was not only possible but something so easy. This is great, it worked like a charm! Thanks for the help jsm4182!
     

Share This Page