Recording User logins/logoffs
Moderator: General Moderators
Recording User logins/logoffs
I have a small club website with login using an sql server hosted on a remote host. I want to be able to record whish users login when. Are there any solutions in php code that will write data to eg a text file on the server?
Re: Recording User logins/logoffs
Not only is it too trivial to bother writing a "tutorial" about, what you do can vary so much that there isn't really a cut-and-paste answer.
You have something that logs people in, right? Do you know how to open and write to a file?
Do you know about concurrency? File locking?
Any reason it should be a file and not a database? Do you care about a detailed list or do you just want to know the last-logged-in time?
You have something that logs people in, right? Do you know how to open and write to a file?
Do you know about concurrency? File locking?
Any reason it should be a file and not a database? Do you care about a detailed list or do you just want to know the last-logged-in time?
-
jazzercising011
- Forum Newbie
- Posts: 9
- Joined: Tue Sep 14, 2010 4:47 am
Re: Recording User logins/logoffs
Yeah what that guy said, it varies too much to write a tutorial on. What I would do is on the login success page have it append their username and the date to a text file.
this should definitely help you along though:
http://www.tizag.com/phpT/fileappend.php
this should definitely help you along though:
http://www.tizag.com/phpT/fileappend.php
Re: Recording User logins/logoffs
Thank you. Hope I find it trivial!! I can probably open and write to a txt log file. I will try, thanks.. Can't use another dbase - we are a charitable club - all our cash goes to charitable causes and not for running the club - and are limited by the host provided to 1 database under our contract...;
Re: Recording User logins/logoffs
It doesn't need to be a new database, you could simply add a table to your existing database to record logon/logoff events.
There are pros and cons to holidng in a table vs a text file - personally I would probably go with the database table approach as you could then construct queries and reports against the data much easier that with a text file. Text files can also be picky about being accessed and written to by two different processes simultaneously unless you initiate some form of file locking.
There are pros and cons to holidng in a table vs a text file - personally I would probably go with the database table approach as you could then construct queries and reports against the data much easier that with a text file. Text files can also be picky about being accessed and written to by two different processes simultaneously unless you initiate some form of file locking.
Re: Recording User logins/logoffs
thank you. That's helpful. I'll give it a go!