| 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: 14943 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: 14943 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: 14943 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: 3
|
Posted:
Sun Jun 15, 2008 12:07 pm |
|
Will this works in version 2.20.01? |
|
|
|
 |
Guardian2003 Site Admin

Joined: Aug 28, 2003 Posts: 4578 Location: Slovakia - working my way around Eastern Europe
|
Posted:
Sun Jun 15, 2008 12:49 pm |
|
Try it and see  |
|
|
|
 |
sprithansi New Member


Joined: May 02, 2008 Posts: 3
|
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: 7262 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: 3
|
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 Site Admin

Joined: Aug 29, 2004 Posts: 7262 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. |
|
|
|
 |
|
|
|
|