Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2005-08-29 21:22:55

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

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

Where are you putting it? I think this file (log.php) has changed since Sencer posted this so that may make a difference.

Offline

#32 2005-08-29 21:26:11

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

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

mary, $ip is always the same value as $out['ip'], so your example will now only record a hit if it is on the list, rather than the opposite. The code I posted above works… did you try it out?

Offline

#33 2005-08-29 21:29:58

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

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

Not in the reposted code.

What you posted is just what Sencer posted, and then it has to be that exact string.

Last edited by Mary (2005-08-29 21:33:42)

Offline

#34 2005-08-29 21:31:16

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

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

I’ve put it where Andrew originally said to put it.
This is the function as it is now:

<pre>
// ——————————————————————————————- function logit($r=’‘) { global $siteurl, $prefs; $mydomain = str_replace(‘www.’,’‘,preg_quote($siteurl,”/”)); $out[‘uri’] = $_SERVER[‘REQUEST_URI’]; $out[‘ref’] = clean_url(str_replace(“http://”,”“,serverset(‘HTTP_REFERER’))); $host = $ip = $_SERVER[‘REMOTE_ADDR’];

if (!empty($prefs[‘use_dns’])) { // A crude rDNS cache if ($h = safe_field(‘host’, ‘txp_log’, “ip=’”.doSlash($ip).”’ limit 1”)) { $host = $h; } else { // Double-check the rDNS $host = gethostbyaddr($_SERVER['REMOTE_ADDR']); if ($host != $ip and gethostbyname($host) != $ip) $host = $ip; } } $out[‘ip’] = $ip; $out[‘host’] = $host; $out[‘status’] = 200; // FIXME $out[‘method’] = $_SERVER[‘REQUEST_METHOD’]; if (preg_match(“/^[^\.]*\.?$mydomain/i”, $out[‘ref’])) $out[‘ref’] = “”;

$ignore = array( ‘googlebot.com’, ‘inktomisearch.com’, ‘ask.com’ );

foreach ($ignore as $ip) { if (stristr($ip, $out[‘ip’])) { return; } } if ($r==‘refer’) { if (trim($out[‘ref’]) != “”) { insert_logit($out); } } else insert_logit($out); }

// ——————————————————————————————-</pre>

Offline

#35 2005-08-29 21:38:21

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

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

I’ll just wait until you two agree about it, okay? ;)

Offline

#36 2005-08-29 21:40:13

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

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

Oh wait I see what’s going on here. $ip is getting overwritten. let me regroup. Gah… I’m not getting much correct today.

Offline

#37 2005-08-29 21:41:39

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

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

> doggiez said

I’ll just wait until you two agree about it, okay? ;)

mary, you and me. meet at the flagpole. after school.

Offline

#38 2005-08-29 22:00:54

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

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

I give. mary – your example (and what doggiez just posted) should work.

Offline

#39 2005-08-29 22:15:40

Mary
Sock Enthusiast
Registered: 2004-06-27
Posts: 6,236

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

I win, yay! Gives Andrew a nugie, then runs off before he can do it back.

“I’m not getting much correct today.”

Want to join the club of which I am an active member?

doggiez, I don’t know why its not doing what its supposed to. I gotta go for a bit, but later I’ll look at it more intently if Andrew or someone else hasn’t helped you figure it out by then.

Offline

#40 2006-02-13 09:59:28

Hiram
Member
From: Utrecht, Netherlands
Registered: 2004-02-16
Posts: 35
Website

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

This code editing business is a bit too scary for your average Txp using poet. Can’t someone whip up a plugin that would allow users to have specific visitors excluded from the listings?

Offline

#41 2006-02-13 16:37:02

hcgtv
Archived Plugin Author
From: Key Largo, Florida
Registered: 2005-11-29
Posts: 2,722
Website

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

I second Hiram’s request.

I tried all the examples and never got it to work properly using TXP 4.0.3.

At least I’d like to remove my own IP from the logs. I used to use Dean’s referrer script on some of my sites and it was so simple to exclude domains or ip’s from the logs, don’t see why it can’t be as simple.

Offline

#42 2006-02-20 12:41:21

Hiram
Member
From: Utrecht, Netherlands
Registered: 2004-02-16
Posts: 35
Website

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

Pages upon pages upon pages of googlebot entries. Hundreds of them. Surely, there must be a code wizard out there who can write a simple plugin to relieve us average users from having to wade through all that. Here’s what the plugin should do:

  • allow for any number of domains to be entered by user, and have these domains un-listed in the visitor logs;
  • allow use of simple wildcards in defining the domains to be un-listed;
  • (in the best of all possible worlds) produce total numbers of visits by the un-listed domains.

Offline

#43 2006-02-21 17:17:21

Hiram
Member
From: Utrecht, Netherlands
Registered: 2004-02-16
Posts: 35
Website

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

This plugin does exactly what I wanted, and much more.

Offline

Board footer

Powered by FluxBB