Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
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
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
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
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
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
Re: HowTo: Remove hits from your current IP from the logs
Thanks again Sencer, that’s the ticket.
Offline
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
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
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