generate log file(or track user)
Moderator: General Moderators
-
simran10101
- Forum Newbie
- Posts: 3
- Joined: Sat Aug 07, 2010 3:10 am
generate log file(or track user)
I need to create logs of each user for eg when user enter into session(after login) I want to track its each activity.(where he click) . plz send your valuable suggestions to perform this task .
Re: generate log file(or track user)
If you do NOT use codeigniter this is not as easy , BUT easy enough.
So what you have to do is create a database table called visitors
it would have the following fields
ID - primary key, unique key of INTEGER type.
user_id - this should be the user_id that you are storing inside the $_SESSION.
page_visited - of type VARCHAR 250 chars
time_visited - of type DATETIME
And on your each page in the header somewhere do this
Maybe also add an IP address field to that table and so forth.
Hope this makes sense.
So what you have to do is create a database table called visitors
it would have the following fields
ID - primary key, unique key of INTEGER type.
user_id - this should be the user_id that you are storing inside the $_SESSION.
page_visited - of type VARCHAR 250 chars
time_visited - of type DATETIME
And on your each page in the header somewhere do this
Code: Select all
if($_SESSION['user_id']){
//Now the user is logged in, so just insert all his actions in the database table you've just created.
mysql_query("INSERT INTO visitors (......................) VALUES (..................)");
}
Hope this makes sense.