CartMetrix - Do you know yours?

« Find Large Files Wasting Disk Space | Home | iTerm Here Applescript Update »

9/20/2005

Shortstat Hack To Remove Local Views

Prevent your own pageviews from appearing in Shortstat stats

Create a file called _getmyip.php in your Shortstat directory with the following code:

<?php

   $thisip = $_SERVER[‘REMOTE_ADDR’]
   $fp = fopen(‘_myip.php’, ‘w’);
   $buffer = ‘<’.‘? $_myip = "’.$thisip.‘"; ?’.‘>’;
   fwrite($fp, $buffer, strlen($buffer));
      
   if(fclose($fp))   echo ’set IP to: ‘ . $thisip
?>

Source: [ download | view ]

Add this code to the very top of shortstat/inc.stats.php:

<?php

   @include(‘_myip.php’);
   if($_SERVER[‘REMOTE_ADDR’] == $myip)   exit;

Now open up _getmyip.php in a browser, and check to see that it writes the _myip.php file properly.

Call this page up whenever you are working on or viewing your site to prevent your pageviews from skewing your data.

To be secure, rename _getmyip.php to something unique so someone can’t reset your IP address.

Popularity: 7%

Trackback:

Related Posts

One Response to “Shortstat Hack To Remove Local Views”

  1. affordable auto insurance quotes said:

    affordable auto insurance quotes

    necklaces hurl evades inexpensively,

Post your opinion

Verification Image

Please type the letters you see in the picture.

Subscribe without commenting


damonparker.org is proudly powered by WordPress
Entries (RSS) and Comments (RSS).

copyright © 2002-2008 damonparker.org. all rights reserved.

Close
E-mail It