15.2. How to prevent the statistics module from gathering hits from certain hosts

If you are still in the phase of editing and tweaking your PHP-Nuke site while it is already online, you may find out that your frequent visits are counted just as every other visit to your site by the statistics module. During a very productive phase, this can skew the statistics of your site quite a bit!

Contrary to what you might have expected, to prevent the statistics module from gathering hits from certain hosts, like your own one, you have to edit the header.php file, not any other file from the modules folder.

Noteheader.php and includes/my_header.php
 

Do not confuse header.php, a file located in the PHP-Nuke root directory, with the my_header.php file, located under the includes directory. The former contains standard PHP-Nuke functions for the PHP-Nuke header, the latter is there for your own, personal additions to the header.

In your header.php file, find the code:

include("includes/counter.php");

and replace it with[1]:

global $admin;
if(!is_array($admin)) {
$admin_name = base64_decode($admin);
$admin_name = explode(":", $admin_name);
$admin_name = "$admin_name[0]";
} else {
$admin_name = "$admin[0]";
}
if($admin_name != "PutYourAdminNameHere") {
include("includes/counter.php");
}

Put your administrator name in place of the "PutYourAdminNameHere" string in the above code and visits by that administrator will not increase your statistics counter any more.

TipHow to block all administrators from the statistics counter
 

A simpler fix, which will block all administrators from the statistics counter, is:

global $admin;
if(!$admin)
{
inlude("includes/counter.php");
}

Notes

[1]

See Block hosts from total hits in statistics module.