1 (edited by elbekko 2006-04-16 17:52)

Topic: Log Forum Activity 1.2

##
##
##        Mod title:  Log Forum Activity
##
##      Mod version:  1.2
##   Works on PunBB:  Should work on every version
##     Release date:  2006-04-16
##           Author:  El Bekko (elbekko@gmail.com)
##
##      Description:  Allows you to log all visiting users
##              to a text file. To spare your server,
##              it logs only every 10 seconds.
##
##     Difference with  
## previous version:  Now saves into DB with option to download in txt form
##
##   Affected files:  include/common.php
##                    
##       Affects DB:  Yes
##
##            Notes:  May give a huge server load on large forums
##
##       DISCLAIMER:  Please note that "mods" are not officially supported by
##                    PunBB. Installation of this modification is done at your
##                    own risk. Backup your forum database and any and all
##                    applicable files before proceeding.
##
##

Download

Re: Log Forum Activity 1.2

I'm confused: why not just use a database table? hmm

Re: Log Forum Activity 1.2

i get an error when i try to clear the log.txt error warning unlink(./log.txt )permission denied  /home/...../ ap_log.php  on line 32

log.txt set to 666 then i tried 777

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

4

Re: Log Forum Activity 1.2

Well, it's no Mint.

Re: Log Forum Activity 1.2

Smartys: it was on request of quaker wink

6

Re: Log Forum Activity 1.2

Reading the entire log file into memory and exploding it into an array every single time any page is called is a lot harder on the server than logging more often then every 10 seconds.

Re: Log Forum Activity 1.2

True... I think I'll just remake it to use the DB and you can just output in a file on command.

Re: Log Forum Activity 1.2

Almost done, and I must say it sure looks alot better now ^^

Re: Log Forum Activity 1.2

sweet!

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Log Forum Activity 1.2

Any difference in speed with this???

11

Re: Log Forum Activity 1.2

not really except when loading the log file.. gess but i have not used the new db one. i still got the old txt version..

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Log Forum Activity 1.2

Thanks for quick reply...

Will test it on my forum... Can always take it away if I get complaints. wink

13

Re: Log Forum Activity 1.2

lol true!

My stuff or my style might sux, but atleast I'm willing to help when I can.
Don't be stupid and help ! We are the stupid one's !!!

Re: Log Forum Activity 1.2

Thank you for your very nice mods.
Could you establish the possibility of logger IP with the times of connection of the users?
And maybe add the possibility to set the log interval from the admin CP.

Regards.

Re: Log Forum Activity 1.2

falconflyz wrote:

Could you establish the possibility of logger IP with the times of connection of the users?

I thought IP was logged together with a timestamp...

And maybe add the possibility to set the log interval from the admin CP.

Hrmm, would be quite hard with the way the mod is currently made, as it logs whenever a use makes a call to common.php (which is on every page view).
I'll look into it though, but I can't assure anything =/

Re: Log Forum Activity 1.2

elbekko wrote:
falconflyz wrote:

Could you establish the possibility of logger IP with the times of connection of the users?

I thought IP was logged together with a timestamp...

Only the last IP is saved!

Re: Log Forum Activity 1.2

Hrmm... it would definately increase your DB load tongue

Re: Log Forum Activity 1.2

I know. A little more double in comparison with the original mod. That's why I had thought of reducing the frequency of log every 30 seconds in place of every 10 seconds.

Re: Log Forum Activity 1.2

I'd have to take a look at the code again, but I guess it can't be too hard.

Re: Log Forum Activity 1.2

It is a pity: to have the IP logs by user can to be very useful.
I also thought of a suggestion to reduce the length of logs. When a new time is recorded, why not to prove if precedent was recorded in fixed interval (?10 seconds). If it is case: delete the previous recording and replace it with the new one; otherwise added a symbol (or other sign) to point out that it is a first new value. So we would have for every member the list of beginning and end of connections and the file log would be hard reduced.

Regards

Re: Log Forum Activity 1.2

You could try something like this (for the timeout):

// Add user to log
$log_res = $db->query("SELECT id, time FROM ".$db->prefix."log WHERE name='".$pun_user['username']."'");
$log_row = $db->fetch_assoc($log_res);
if(($log_row['time'] > time()-10))
{
    if($log_row['id']) // Timeout of 10 seconds
    {
        $log_time = $log_row['time'] . ", " . time();
        $db->query("UPDATE ".$db->prefix."log SET `time` = '".$log_time."', `ip` = '".$_SERVER['REMOTE_ADDR']."' WHERE id=".$log_row['id']);
    }
    else
        $db->query("INSERT INTO ".$db->prefix."log (`ip`, `name`, `time`) VALUES ('".$_SERVER['REMOTE_ADDR']."', '".$pun_user['username']."', '".time()."')");
}

Re: Log Forum Activity 1.2

elbekko wrote:

I'd have to take a look at the code again, but I guess it can't be too hard.

Hi elbekko
It interests me if you had the modification of code for log of IP. I tried to change it, but unsuccessfully.
Thank you for your modification " for the timeout ". Excuse me for not having answered earlier, I had left of message aside.

Regards

Re: Log Forum Activity 1.2

You'd have to make an extra table and insert the IP together with a username and a timestamp into it.

Re: Log Forum Activity 1.2

Thank you! I try to do something, but until now my weak knowledge did not allow me yet to arrive at a good result.

Re: Log Forum Activity 1.2

would it be possible to post a sample of the output file?