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: 17088
|
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

|
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

|
Posted:
Fri May 06, 2005 11:11 pm |
|
You say in your first postQuote: | I want to change the stats module so that my visits are counted as hits | but in your second you sayQuote: | and I don't want my visits to count |  |
|
|
|
 |
voddkaman

|
Posted:
Sat May 07, 2005 12:07 am |
|
LOL...sorry about that...I meant for my visits NOT to count.  |
|
|
|
 |
Raven

|
Posted:
Sat May 07, 2005 11:41 pm |
|
In includes/counter.php, your beginning code should look something like thisCode: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 thisCode: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 likeCode: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

|
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: 6799
Location: Ha Noi, Viet Nam
|
Posted:
Sun Jun 15, 2008 12:49 pm |
|
Try it and see  |
|
|
|
 |
sprithansi

|
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
Site Admin

Joined: Aug 29, 2004
Posts: 9457
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
}
?>
|
|
_________________ Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! |
|
|
 |
sprithansi

|
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

|
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: 152
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 |
_________________ as i stare into the abyss and battle with my demons i yell timeout and have a coffee break. |
|
|
 |
montego

|
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

|
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

|
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. |
|
|
|
|
 |
|