| Author |
Message |
voddkaman New Member


Joined: May 03, 2005 Posts: 7
|
Posted:
Tue May 03, 2005 12:50 pm |
|
Hi,
I want to change the stats module so that my visits are counted as hits. Can this be done? I'm new to Nuke so any detailed help would be appreicated. |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16976 Location: Kansas
|
Posted:
Wed May 04, 2005 6:16 am |
|
What version of nuke are you using? I can't see where your hits wouldn't be counted? |
|
|
|
 |
voddkaman New Member


Joined: May 03, 2005 Posts: 7
|
Posted:
Fri May 06, 2005 10:42 pm |
|
sorry for the delay: i'm using version 7.5....and I don't want my visits to count. |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16976 Location: Kansas
|
Posted:
Fri May 06, 2005 11:11 pm |
|
You say in your first post | Quote: | | I want to change the stats module so that my visits are counted as hits | but in your second you say | Quote: | | and I don't want my visits to count |  |
|
|
|
 |
voddkaman New Member


Joined: May 03, 2005 Posts: 7
|
Posted:
Sat May 07, 2005 12:07 am |
|
LOL...sorry about that...I meant for my visits NOT to count.  |
|
|
|
 |
Raven Site Admin/Owner

Joined: Aug 27, 2002 Posts: 16976 Location: Kansas
|
Posted:
Sat May 07, 2005 11:41 pm |
|
In includes/counter.php, your beginning code should look something like this | Code: | if (stristr($_SERVER['SCRIPT_NAME'], "counter.php")) {
Header("Location: index.php");
die();
}
global $prefix, $db; |
And then the rest of the script, ending with a PHP closing tag of ?> | Code: | if (stristr($_SERVER['SCRIPT_NAME'], "counter.php")) {
Header("Location: index.php");
die();
}
global $prefix, $db;
// REST OF SCRIPT
?> |
Starting with the "global" statement, modify the text above to this | Code: | global $prefix, $db, $user;
$userinfo = getusrinfo($user);
if (strtolower($userinfo['username'])!='yourusername') { |
Then, add this line just before the closing PHP ?> tagso that it looks like | Code: | if (stristr($_SERVER['SCRIPT_NAME'], "counter.php")) {
Header("Location: index.php");
die();
}
global $prefix, $db, $user;
$userinfo = getusrinfo($user);
if (strtolower($userinfo['username'])!='yourusername') {
// REST OF SCRIPT
}
?> |
You will change the value for "yourusername" to your nuke user name using lowercase. |
|
|
|
 |
voddkaman New Member


Joined: May 03, 2005 Posts: 7
|
Posted:
Mon May 09, 2005 2:08 pm |
|
Thanks much  |
|
|
|
 |
sprithansi New Member


Joined: May 02, 2008 Posts: 7
|
Posted:
Sun Jun 15, 2008 12:07 pm |
|
Will this works in version 2.20.01? |
|
|
|
 |
Guardian2003 Site Admin

Joined: Aug 28, 2003 Posts: 6299 Location: Vsetin, Czech Republic
|
Posted:
Sun Jun 15, 2008 12:49 pm |
|
Try it and see  |
|
|
|
 |
sprithansi New Member


Joined: May 02, 2008 Posts: 7
|
Posted:
Tue Jul 01, 2008 3:35 am |
|
Tested, and it's not working.
It would be nice to have an option too choose if e.g. not to count hits from admin |
|
|
|
 |
montego Former Admin in Good Standing

Joined: Aug 29, 2004 Posts: 9070 Location: Arizona
|
Posted:
Tue Jul 01, 2008 6:22 am |
|
Well, that thread was three years old and not based upon RN. So, maybe try this instead:
| Code: |
if (stristr($_SERVER['SCRIPT_NAME'], "counter.php")) {
Header("Location: index.php");
die();
}
global $prefix, $db, $admin;
if (!is_admin($admin)) {
// REST OF SCRIPT
}
?>
|
|
|
|
|
 |
sprithansi New Member


Joined: May 02, 2008 Posts: 7
|
Posted:
Wed Jul 02, 2008 12:56 am |
|
Thanks. It works
Is it possible to add more users to this? E.g. Admin and user... |
|
|
|
 |
montego Former Admin in Good Standing

Joined: Aug 29, 2004 Posts: 9070 Location: Arizona
|
Posted:
Wed Jul 02, 2008 6:24 am |
|
Well, every admin will be excluded (i.e., those you set up in Edit Admins). If you want to also exclude certain regular users than you have to combine the two concepts. Maybe something like this:
| Code: |
if (stristr($_SERVER['SCRIPT_NAME'], "counter.php")) {
Header("Location: index.php");
die();
}
global $prefix, $db, $admin, $user;
$userinfo = getusrinfo($user);
$userName = strtolower($userinfo['username']);
if (!is_admin($admin) && !in_array($userName, array('username1', 'username2', ...)) {
// REST OF SCRIPT
}
?>
|
Just remember to lower-case the user names. If you do not wish to do that (thinking you may have duplicates after you lower-case them), then remove the strtolower() function around the $userinfo assignment. |
|
|
|
 |
tehw1n Hangin' Around

Joined: Jul 15, 2008 Posts: 49
|
Posted:
Sat Mar 07, 2009 2:59 pm |
|
Is there any way to exclude several IP ranges from the hit counter?
I monitor my site from several locations around the world but dont want these hits to count. |
|
|
|
 |
gazj Worker


Joined: Apr 28, 2006 Posts: 150 Location: doncaster england
|
Posted:
Wed Aug 12, 2009 9:31 am |
|
just add an if(!is_admin around the counter include in the header thats the most simple way |
|
|
|
 |
montego Former Admin in Good Standing

Joined: Aug 29, 2004 Posts: 9070 Location: Arizona
|
Posted:
Fri Aug 14, 2009 8:45 am |
|
This exclusion capability is already embedded within the latest 2.30.xx version of RavenNuke(tm). Check out the rnconfig.php settings down torwards the bottom. You might want to migrate to RavenNuke(tm) or at least download it and see how this was implemented.  |
|
|
|
 |
gazj Worker


Joined: Apr 28, 2006 Posts: 150 Location: doncaster england
|
Posted:
Fri Aug 14, 2009 2:22 pm |
|
i dont like RavenNuke i much prefer starting with stock phpnuke 7.6 and building it how i like it rather than having to start with something and remove what i dont want its much easier for me |
|
|
|
 |
montego Former Admin in Good Standing

Joined: Aug 29, 2004 Posts: 9070 Location: Arizona
|
Posted:
Sat Aug 22, 2009 7:49 am |
|
That is fine, but I also said this as the alternative:
| montego wrote: | or at least download it and see how this was implemented. |
|
|
|
|
 |
|
|
|
|