View Full Version : Trace and log user actions...
This hack was requested by ossi69 and John Mac.
This is a pretty simple hack that allows you to track and document a user's
actions while they are logged into your board. Every click made by the user
makes a brand new entry in a log file. The log file entries include, username,
IP address, date and time, and the URL clicked on. The user actions are
documented even before the user has a chance to see the page he clicked on.
Templates affected by this hack: none
Tables affected by this hack: user
Files affected by this hack: global.php, admin/user.php
Execute the following query to create a new field in the user table:
alter table user add trace smallint(5) unsigned DEFAULT 0 NOT NULL;
You also need to create a brand new directory in your forums directory by
the name of tracelog. You need to make sure that your give the appropriate\
read/write permissions to this directory so that the http server on your
host can create files in there.
Here is a sample output:
Zed, 192.168.1.101 , 2003-04-28 18:31:30, /forums/index.php
Zed, 192.168.1.101 , 2003-04-28 18:31:36, /forums/forumdisplay.php?forumid=9
Zed, 192.168.1.101 , 2003-04-28 18:31:42, /forums/showthread.php?threadid=143901
Zed, 192.168.1.101 , 2003-04-28 18:31:51, /forums/rules.php
Zed, 192.168.1.101 , 2003-04-28 18:31:53, /forums/forumdisplay.php?forumid=9
Zed, 192.168.1.101 , 2003-04-28 18:32:07, /forums/showthread.php?threadid=143901
Zed, 192.168.1.101 , 2003-04-28 18:32:11, /forums/index.php
Zed, 192.168.1.101 , 2003-04-28 18:32:15, /forums/forumdisplay.php?forumid=103
Zed, 192.168.1.101 , 2003-04-28 18:32:28, /forums/showthread.php?threadid=225576
Zed, 192.168.1.101 , 2003-04-28 18:32:38, /forums/member.php?action=getinfo&userid=4112
Note:Go to this post (https://vborg.vbsupport.ru/showthread.php?postid=389026#post389026) to download the directory protection file for this hack.
Boofo
04-28-2003, 10:04 PM
Is this supposed to be unsigned?
alter table user add trace smallint(5) unsigned DEFAULT 0 NOT NULL;
Will this also add a line under each user's session so you can tell where one leaves off and one starts?
Unsigned is fine. The possible values for that field are 0 and 1.
Start times are when the user signs on for the first time. And the leaving time should be between the time of the last entry and the time for the cookie timeouts on your board. ;)
Boofo
04-28-2003, 10:23 PM
I see, thanks! ;)
Wouldn't it be better to have a line separate each users session though in case the log gets kind of long? Like this:
Zed, 192.168.1.101 , 2003-04-28 18:31:30, /forums/index.php
Zed, 192.168.1.101 , 2003-04-28 18:31:36, /forums/forumdisplay.php?forumid=9
Zed, 192.168.1.101 , 2003-04-28 18:31:42, /forums/showthread.php?threadid=143901
Zed, 192.168.1.101 , 2003-04-28 18:31:51, /forums/rules.php
Zed, 192.168.1.101 , 2003-04-28 18:31:53, /forums/forumdisplay.php?forumid=9
-------------------------------------------------------------------------
Boofo, 192.168.1.101 , 2003-04-28 18:32:07, /forums/showthread.php?threadid=143901
Boofo, 192.168.1.101 , 2003-04-28 18:32:11, /forums/index.php
Boofo, 192.168.1.101 , 2003-04-28 18:32:15, /forums/forumdisplay.php?forumid=103
-------------------------------------------------------------------------
Test, 192.168.1.101 , 2003-04-28 18:32:28, /forums/showthread.php?threadid=225576
Test, 192.168.1.101 , 2003-04-28 18:32:38, /forums/member.php?action=getinfo&userid=4112
Something like that? And will there be a way to prune the log?
This hack is activated by user participation on the board. TO do this you would have to take the last activity time by the user and compare it against the current time and if it is greater than your $cookietimeout then you would output a line separator.
As for the pruning, I figured the file entries can just be deleted. or edited manually. They really don't take up that much space to cause real concern. ;)
Boofo
04-28-2003, 10:38 PM
Wouldn't comparing the username do the job, too?
Today at 04:38 PM Boofo said this in Post #6 (https://vborg.vbsupport.ru/showthread.php?postid=388679#post388679)
Wouldn't comparing the username do the job, too?
Nope, it is per user. Each user gets his/her own file in the tracelog directory, i.e., username Zzed will have his entries be written to Zzed.log, and username Boofo will have his entries written to Boofo.log. ;)
Boofo
04-28-2003, 11:01 PM
I just got it installed and saw that. Sorry. ;)
It looks great! Can it be done by the time line like you mentioned before? Would make it easier on a big log. ;)
Also, is there a way to have it be read form the Admin CP instead of having to go FTP to read it?
I'll look into the line separator thing. ;)
You can view the file through your browser by going to http://myforum.com/forums/tracelog/Zzed.log
Or you can get a directlry listing by going to: http://myforum.com/forums/tracelog
Boofo
04-28-2003, 11:09 PM
Thanks, my friend. Great hack. I like it. ;)
How can I add the link in the user's admin cp profile so you can just click it and read it?
I'll get that code out along with the line separators. ;)
ossi69
04-28-2003, 11:27 PM
phenomenal Zzed. Many thanks again!
Today at 05:27 PM ossi69 said this in Post #12 (https://vborg.vbsupport.ru/showthread.php?postid=388700#post388700)
phenomenal Zzed. Many thanks again!
You're very welcome. Let me know how you like it. :)
vB-Host.com
04-29-2003, 12:14 AM
*clicks install* very nice... Could you add to the user log where they came from when the log file startes like another area of my site or a link to the external site they came from?
Today at 06:14 PM vB-Host.com said this in Post #14 (https://vborg.vbsupport.ru/showthread.php?postid=388710#post388710)
*clicks install* very nice... Could you add to the user log where they came from when the log file startes like another area of my site or a link to the external site they came from?
Thank you for your kind words. :)
You can modify the sprintf() statement and add another entry for $url to see their referring URL. ;) But the information will show up on every line along with the rest of the info.
Areku
04-29-2003, 08:35 AM
Are ALL users logged or only those you choose?
Boofo
04-29-2003, 09:29 AM
Only those you set to be traced from the Admin CP.
Areku
04-29-2003, 11:26 AM
Cool!
/me licks install!!!
John Mac
04-29-2003, 11:37 AM
Thanks Zzed,
Areku
04-29-2003, 11:39 AM
Today at 01:04 AM Zzed said this in Post #9 (https://vborg.vbsupport.ru/showthread.php?postid=388690#post388690)
I'll look into the line separator thing. ;)
You can view the file through your browser by going to http://myforum.com/forums/tracelog/Zzed.log
Or you can get a directlry listing by going to: http://myforum.com/forums/tracelog
So virtually ANYONE can see anyone else's activities by just entering someone's nick.log at tracelog subdir?
Any way to prevent this?
Robink
04-29-2003, 02:20 PM
Great!!
I can use this to keep an eye on some Mods too.... :D ;)
SmartGnome
04-29-2003, 06:06 PM
Hi Zzed, install is clicked :D
Anyone an idea how to protect the directory for unallowed previews ???
Great hack, will help me to find the ones I don't like
Greets
Thank you everyone for your kind words. :)
I am working on a solution for the protection of that directory.
Ok, for all of you who expressed your concern about the security and protection of that page, I created an index.php that allows only the Administrators to view the contents of that directory. Anyone else other than administrators will get the No Permission page. ;)
Drop the attached file in your tracelog directory and it will take care of everything. The output generated by the script is in table format that shows filename, size, last modified time and last accessed time.
Hope this helps. ;)
Areku
04-29-2003, 07:49 PM
U r00l! ;)
Tu Zzed!
Areku
04-29-2003, 08:00 PM
mmmm...errrr... any1 can still see them!
Today at 02:00 PM Areku said this in Post #26 (https://vborg.vbsupport.ru/showthread.php?postid=389039#post389039)
mmmm...errrr... any1 can still see them!
Nope, hit refresh on your browser. It is still sitting in your cache. ;)
Areku
04-29-2003, 08:07 PM
U rock!!! ;)
Today at 02:07 PM Areku said this in Post #28 (https://vborg.vbsupport.ru/showthread.php?postid=389048#post389048)
U rock!!! ;)
Thank you. You are too kind. https://vborg.vbsupport.ru/
a couple suggestions
you should change the log file to userid instead of username. names with odd chars will cause problems.
I just installed, but put the tracelog dir in the admin dir. everyone already has that protected.
nice idea. I look forward to any addons. soem of my members need a little watching.
Areku
04-29-2003, 09:52 PM
Nice point!
Is that as simple as adding admin/tracelog/ instead of tracelog/ on the first replacement? I guess that's more secure than the index.php file?
The userid thing may be a good point too...
(Ps. working on vb2.2.0 ;))
Hobbes
04-30-2003, 01:53 AM
/me clicks install...
it would be a wicked idea to have the logs viewable in the admin cp....like a link or something!!!
Katana Myronson
04-30-2003, 03:07 PM
Great hack! I'm going to install it right away! Thanks, Zzed this is just what i was looking for! :D
TheComputerGuy
04-30-2003, 07:56 PM
does this create a lot of queries
Today at 01:56 PM TheComputerGuy said this in Post #34 (https://vborg.vbsupport.ru/showthread.php?postid=389590#post389590)
does this create a lot of queries
There are no queries while a user is being traced. Information is written to a text file. The user information is already populated when the user esablished a session with the board, so there is no need for any further queries.
The only time there is a query is when you try to visit the contents of the tracelog directory.
Morgalis
05-01-2003, 09:22 PM
this was just what i was looking for!
thanks :)
Boofo
05-02-2003, 11:36 AM
04-28-03 at 07:04 PM Zzed said this in Post #9 (https://vborg.vbsupport.ru/showthread.php?postid=388690#post388690)
I'll look into the line separator thing. ;)
You can view the file through your browser by going to http://myforum.com/forums/tracelog/Zzed.log
Or you can get a directlry listing by going to: http://myforum.com/forums/tracelog
How's this coming along? And Mutt's idea about using the userid as the name of the file instead of the username is a good one, too. ;)
hi I'm new here and this is a really nice hack. I was wondering how to automatically track all users instead of having to go into each one and selecting 'track user'?
Today at 01:54 PM obs said this in Post #39 (https://vborg.vbsupport.ru/showthread.php?postid=390580#post390580)
hi I'm new here and this is a really nice hack. I was wondering how to automatically track all users instead of having to go into each one and selecting 'track user'?
Are you sure you want to do that? :confused:
If so then replace this:
if($bbuserinfo[trace] == 1) {
with this:
if(1) {
subu1
05-05-2003, 07:57 AM
hi very nice hack but i have a error in my global.php
Warning: Unable to access ./admin/config.php in /home/virtual/site1/fst/var/www/html/board/admin/global.php on line 116
on Line 116 is:
require('./admin/config.php');
what can i do, just i don't have permission to ACP Control,too
subu1
05-05-2003, 08:33 AM
ups, i must have forum/global.php, but now ich have this if i click on my link "No users found matching those criteria.
" ;)
ok i have 2.2.8 and on my ftp i gave tracelog 777
Hi, I need your help MAN I downloaded the trace hack but I could not get the logs .. all I got was this table from the index.php
I have done every thing
I alted user table
1-`trace` SMALLINT( 5 ) UNSIGNED DEFAULT '0' NOT NULL
2- I created a dirctoy tracelog and and changed the mode t0 777
3-made the changes to global.php and admin/user.php
4-and the only thing I got when acess the tracelog dirctory is
Filename Size Last Modified Last Accessed
. 4096 May 15, 2003, 18:09 May 15, 2003, 18:09
.. 4096 May 15, 2003, 16:44 May 15, 2003, 18:02
index.php 1082 May 15, 2003, 18:09 May 15, 2003, 18:09
when I type
forums/tracelog/username.log
I have this page is not found error
Can you help getting the user logs work with vb 2.3.0 becuse this hack would help me in a study I am condcuting .. thanks in advance
gwhooooey
05-18-2003, 04:07 PM
Execute the following query to create a new field in the user table:
alter table user add trace smallint(5) unsigned DEFAULT 0 NOT NULL;
I couldn't get that to work, any help?
zefman
05-25-2003, 07:31 AM
05-18-03 at 06:07 PM gwhooooey said this in Post #45 (https://vborg.vbsupport.ru/showthread.php?postid=396765#post396765)
Execute the following query to create a new field in the user table:
alter table user add trace smallint(5) unsigned DEFAULT 0 NOT NULL;
I couldn't get that to work, any help?
hello !
try this
alter table `user` add `trace` smallint(5) unsigned DEFAULT "0" NOT NULL;
great hack thanks :)
gwhooooey
05-25-2003, 09:51 AM
Thanks, that worked
paratek
06-02-2003, 07:55 PM
I have one glitch. If i am adding a user manually from the admin CP, the trace user option is there for me to select. If i edit a current user to try and select this particular user to trace, the option isn't there.
Any ideas?
You installed the hack in the wrong section. ;) The add user and edit user code look almost identical. ;)
The values for new users is set to 0 (No) by default.
Intex
06-03-2003, 12:02 PM
Nice hack. Works great !
/me clicks install.
WEForums
06-03-2003, 12:41 PM
Is it possible (I am almost positive it is) to track individual users selected by admins? I ask this because currently WEForums has 23,000+ members so it isn't exactly something I'd want to install. Additionally, hundreds sign up per day.
So how hard would it be?
Intex
06-03-2003, 01:16 PM
WEForums - by default nobody is traced. You select the users you want to trace in the AdminCP.
cYbercOsmOnauT
06-04-2003, 12:17 AM
Nice one!
/me clicks on install.
Sad that there is no function to show the logs via ACP. Anyways nice security hack!
WEForums
06-04-2003, 06:16 AM
Thanks, Intex.
I have installed this now...and while everything works...there is one exception. Once I clicked the "Show all traced users" log, I get ALL usernames who have registered. Sure, may not be a problem, you think...but considering it just froze up my PC because it was loading 23,100+ names...I don't think it's very good.
Showing records 1 to 23169 of 23169. Click username to view forum profile.
Strange though...anyone else having this problem? I don't think I did anything wrong, but I will check again...
Intex
06-04-2003, 07:02 AM
I'm personally not experiencing that particular problem, but then again I've got nowhere near that many members :).
WEForums
06-04-2003, 07:10 AM
Nope. Followed instructions perfectly.
Perhaps it is to do with the miserable hack or the country hack. I noticed in the DB query part there is two hacks there. Perhaps those are it?
Intex
06-04-2003, 07:38 AM
ZZed - is there any way you can include guests in the trace logs? The reason I ask is because I want to keep an eye on actions taken by people who aren't registered yet.
WEForums
06-04-2003, 08:35 AM
I fixed my problem.
I was tampering with the code and this seems to work. (Although not sure about the userid = part. Guess it stays blank...)
if($bbuserinfo['usergroupid']==1) {
if ($handle = fopen("tracelog/Guest.log", 'a')) {
$location=$DB_site->query_first("select location from session where userid = $bbuserinfo[userid] order by lastactivity
desc limit 1;");
$ztime = strftime("%Y-%m-%d %H:%M:%S", time());
$data = sprintf("%s, %-15s, %-19s, %s\n", Guest, $REMOTE_ADDR, $ztime, $location[location]);
fwrite($handle, $data);
fclose($handle);
}
}
Put that above
if($bbuserinfo[trace] == 1) {
I am going to assume tracking an entire group would be just like the above, right? Then just replace Guest with whatever name... Perhaps useful for tracking a group you are nearly going to ban.
quinte
06-28-2003, 12:44 PM
A lovely hack -
ALAS.....
Allthough everything seems to be intact - for one or other reason when editing a user's profile in the adminCP (tick the option to trace) - it will not save.
Clicking on the 'list users who are being traced' likewise indicates that there are none!
Any help on this problem will be appreciated - as it is a very useful hack indeed!
(Using VB 2.2.9)
Today at 06:44 AM quinte said this in Post #59 (https://vborg.vbsupport.ru/showthread.php?postid=413679#post413679)
A lovely hack -
ALAS.....
Allthough everything seems to be intact - for one or other reason when editing a user's profile in the adminCP (tick the option to trace) - it will not save.
Clicking on the 'list users who are being traced' likewise indicates that there are none!
Any help on this problem will be appreciated - as it is a very useful hack indeed!
(Using VB 2.2.9)
check your PM's. ;)
Hi. This hack was great. I installed it onto my live board pgamers.com . However I do have one question. Does this track clicks to the admin cp and mod cp also? Is it suppose to because so far it doesn't come up for me. If this isn't available can it please be inplemented :)
Yesterday at 09:46 PM hagi said this in Post #61 (https://vborg.vbsupport.ru/showthread.php?postid=414069#post414069)
Hi. This hack was great. I installed it onto my live board pgamers.com . However I do have one question. Does this track clicks to the admin cp and mod cp also? Is it suppose to because so far it doesn't come up for me. If this isn't available can it please be inplemented :)
The hack traces user actions within the board itself and not the mod/admin CP. The Admin CP is already logged by the software for all admins.
af1 racing
08-18-2003, 09:05 PM
06-04-03 at 09:38 AM Intex said this in Post #57 (https://vborg.vbsupport.ru/showthread.php?postid=404263#post404263)
ZZed - is there any way you can include guests in the trace logs? The reason I ask is because I want to keep an eye on actions taken by people who aren't registered yet.
I second this. I need to trace guests on my board by IP. Any chance you can modify this hack to include this option?
Thanks
Mu5icMan
01-14-2004, 12:41 PM
is it possible to trace who has clicked on an attachment, cause i've installed this hack but attachments aren't on the trace.
Alidar
01-29-2004, 08:39 PM
I love the concept!!! Will install tonight after work (on lunch break).
Got a new user using nick "Guest" (thought it was locked out by vB, guess not) and starting to think the username/pass being shared by multiple peps to get around site security.
THANKS!!!!
Dennis01
09-09-2004, 07:55 PM
Is something like this already availeble for vb3?
Imperial Fritz
12-03-2004, 01:57 AM
I would like to know the same...
rh2004
12-04-2004, 04:43 PM
Thanks :D for my one its great
Is something like this already availeble for vb3?
yeah i agree! it'd be a good idea
reverse1312
03-01-2006, 07:59 PM
Is someone willing to release a 3.5 version for this useful hack ?
MikeWarner
03-09-2006, 02:00 PM
Ditto - would like this for vb3.5 please. :)
berayiwu5
03-13-2006, 01:52 PM
Yes, I am willing to donate as well. Please someone make this available.
I'll look into porting this into a VB3.5 plugin. Feel free to send me a PM nudge if you don't hear from me in a while. :)
arcane1
08-27-2006, 03:50 PM
Counting clicks?
Is there a way to modify this so that after a certain number of clicks on the board a user is diverted to a page or another event occurs?
Ignicoccus
08-28-2006, 05:51 AM
Will there be a 3.5 / 3.6 Version of this mod ?
fxs158
09-01-2006, 03:02 AM
absolutelly would love to have an update for 3.6
Quarterbore
10-03-2006, 08:52 PM
I have a use for this as well now...
I would like to get data logged in a database table where I can tell it what to collect and when... for example, right now I am only interested in guests but other times I may be interested in groups (say staff) or individuals, or all members or all members and guests... or perhaps just bots...
I am going to code something for my immediate need but with 3.6 hooks this would be easy to use with 3.6!
fxs158
11-11-2006, 01:37 AM
Update as plugin would be awsome!
bluesteel
12-12-2006, 03:42 PM
absolutelly would love to have an update for 3.6
Me too!
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.