Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2004-07-18 17:40:45

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

HowTo: Remove hits from your current IP from the logs

If you set site preferences to “Log all hits” you will also see your own hits being tracked.

If you want to automatically remove all recorded hits from your current IP, than you have to add two small lines in the file:

/textpattern/include/txp_log

Find the following piece of code (it should be right at the top):

<code> function log_list() { pagetop(gTxt('visitor_logs')); extract(get_prefs()); global $txpac;</code>

AFTER it, ADD the following two lines:

<code> $ip = @gethostbyaddr($_SERVER['REMOTE_ADDR']);
safe_delete("txp_log", "`host` LIKE '$ip' AND `time` > date_sub(now(),interval 1 day)");
</code>

Ok, code should be displaying correct, now

This will Delete the hits from your current IP from the current day.

Last edited by Sencer (2004-07-18 17:53:03)

Offline

#2 2004-07-18 17:43:41

Damelon
Member
From: Lyon, France
Registered: 2004-05-11
Posts: 47
Website

Re: HowTo: Remove hits from your current IP from the logs

Cool. Maybe you can answer this one step further. If we have a fixed IP (or in the case of a group, IPs) is there a way to hard code the IPs to not log?

Offline

#3 2004-07-18 17:58:50

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: HowTo: Remove hits from your current IP from the logs

Hi Damelon,

The logging is done in the file:

textpattern/publish/log.php

FIND (right at the top):

<code>$out['ip'] = @gethostbyaddr($_SERVER['REMOTE_ADDR']);</code>

AFTER, ADD

<code>if ($out[‘ip’] == ‘resolvedhost.ofmyip.com’) return;</code>

I think. Haven’t tested it.

Last edited by Sencer (2004-07-18 17:59:07)

Offline

#4 2004-07-18 18:09:27

Damelon
Member
From: Lyon, France
Registered: 2004-05-11
Posts: 47
Website

Re: HowTo: Remove hits from your current IP from the logs

It seems to work fine, thank you ! Is it possible to add multiple domains doing this? If so, how ?

BTW. Providing this doesn’t turn out to be a figment of my imagination, this is very, very handy.

Offline

#5 2004-07-18 18:13:17

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: HowTo: Remove hits from your current IP from the logs

<code>if (in_array($out[‘ip’], array( ‘ipname1.com’,‘ipname2.com’,‘ipname3.com’)) return;</code>

Offline

#6 2004-07-18 18:16:14

Damelon
Member
From: Lyon, France
Registered: 2004-05-11
Posts: 47
Website

Re: HowTo: Remove hits from your current IP from the logs

Thanks again Sencer, that’s the ticket.

Offline

#7 2004-07-20 18:43:30

JeffClark
Member
From: Stillwater, OK
Registered: 2004-07-11
Posts: 27
Website

Re: HowTo: Remove hits from your current IP from the logs

Oh this is good stuff! Very nice hack.


Proof that any idiot can have a website: www.vacantcanvas.com

Offline

#8 2004-08-26 13:07:42

Sencer
Archived Developer
From: cgn, de
Registered: 2004-03-23
Posts: 1,803
Website

Re: HowTo: Remove hits from your current IP from the logs

You must have made something wrong while editing.

Replace the file with the original file from a the clean g1.19 distribution.

Offline

#9 2005-02-13 12:58:59

puthupa
Member
From: ny
Registered: 2004-10-07
Posts: 27
Website

Re: HowTo: Remove hits from your current IP from the logs

sencer,

really cool hack – just what i was looking for. so basically, as long as i log in during a day, my ip for that day will not appear? this is great!

much thanks!

arp


arp laszlo
www.inkwire.net

Offline

#10 2005-08-24 20:44:41

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

Sencer wrote:

The logging is done in the file:

textpattern/publish/log.php

FIND (right at the top):

<code>$out['ip'] = @gethostbyaddr($_SERVER['REMOTE_ADDR']);</code>

AFTER, ADD

<code>if ($out[‘ip’] == ‘resolvedhost.ofmyip.com’) return;</code>

I think. Haven’t tested it.

and

if (in_array($out['ip'], array( 'ipname1.com','ipname2.com','ipname3.com')) return;

Log.php seems to have changed in the meantime. I can’t find this exact line of code. Can someone tell me how to do this now?

Offline

#11 2005-08-24 21:49:34

Andrew
Plugin Author
Registered: 2004-02-23
Posts: 730

Re: HowTo: Remove hits from your current IP from the logs

I believe that adding that line right before or after the line (42) if($out['uri'] == 'favicon.ico') return; would do it.

Offline

#12 2005-08-25 06:25:48

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: HowTo: Remove hits from your current IP from the logs

There is no such line in log.php?

Offline

Board footer

Powered by FluxBB