Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rhp2424

macrumors regular
Original poster
Jul 23, 2008
122
18
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!
 
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()')
 
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!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.