Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules
Author Message
voddkaman
New Member
New Member



Joined: May 03, 2005
Posts: 7

PostPosted: Tue May 03, 2005 12:50 pm Reply with quote

Hi,

I want to change the stats module so that my visits are counted as hits. Can this be done? Sad I'm new to Nuke so any detailed help would be appreicated.
 
View user's profile Send private message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

PostPosted: Wed May 04, 2005 6:16 am Reply with quote

What version of nuke are you using? I can't see where your hits wouldn't be counted?
 
View user's profile Send private message
voddkaman







PostPosted: Fri May 06, 2005 10:42 pm Reply with quote

sorry for the delay: i'm using version 7.5....and I don't want my visits to count.
 
Raven







PostPosted: Fri May 06, 2005 11:11 pm Reply with quote

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
Confused
 
voddkaman







PostPosted: Sat May 07, 2005 12:07 am Reply with quote

LOL...sorry about that...I meant for my visits NOT to count. Embarassed
 
Raven







PostPosted: Sat May 07, 2005 11:41 pm Reply with quote

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 ?> tag
Code:
}
so 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







PostPosted: Mon May 09, 2005 2:08 pm Reply with quote

Thanks much Very Happy
 
sprithansi
New Member
New Member



Joined: May 02, 2008
Posts: 7

PostPosted: Sun Jun 15, 2008 12:07 pm Reply with quote

Will this works in version 2.20.01?
 
View user's profile Send private message
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

PostPosted: Sun Jun 15, 2008 12:49 pm Reply with quote

Try it and see Wink
 
View user's profile Send private message Send e-mail
sprithansi







PostPosted: Tue Jul 01, 2008 3:35 am Reply with quote

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

PostPosted: Tue Jul 01, 2008 6:22 am Reply with quote

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
}
?>

_________________
Where Do YOU Stand?
HTML Newsletter::ShortLinks::Mailer::Downloads and more... 
View user's profile Send private message Visit poster's website
sprithansi







PostPosted: Wed Jul 02, 2008 12:56 am Reply with quote

Thanks. It works Smile
Is it possible to add more users to this? E.g. Admin and user...
 
montego







PostPosted: Wed Jul 02, 2008 6:24 am Reply with quote

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

PostPosted: Sat Mar 07, 2009 2:59 pm Reply with quote

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.
 
View user's profile Send private message
gazj
Worker
Worker



Joined: Apr 28, 2006
Posts: 152
Location: doncaster england

PostPosted: Wed Aug 12, 2009 9:31 am Reply with quote

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. 
View user's profile Send private message Visit poster's website
montego







PostPosted: Fri Aug 14, 2009 8:45 am Reply with quote

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







PostPosted: Fri Aug 14, 2009 2:22 pm Reply with quote

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







PostPosted: Sat Aug 22, 2009 7:49 am Reply with quote

That is fine, but I also said this as the alternative:

montego wrote:
or at least download it and see how this was implemented. Wink
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Modules

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©