PHP Web Host - Quality Web Hosting For All PHP Applications Free RavenNuke(tm) Add Ons
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
fade2gray
Regular
Regular


Joined: Mar 26, 2006
Posts: 87
Location: UK

PostPosted: Sat Apr 22, 2006 5:46 pm Reply with quote Back to top

Essentially, I'd like to prevent my IP address from tripping the hit counter whenever I turn a page whether I'm logged in as user, admin or just browsing anonymously.

I found a piece of code that will work for a static IP, but mine is dynamic and sometimes changes if my broadband connection gets cycled.

In the header.php file, replace
Code:
include("includes/counter.php");

with
Code:
$the_ip = $_SERVER[REMOTE_ADDR];
if($the_ip != "xxx.xxx.xxx.xxx") {
     include("includes/counter.php");
}

// code credit= Humpa & chris_au.

inserting the IP address at the x's.

I guess what I'm looking for is a modification to the index.php that'll get my IP and insert it into the header.php. Is this viable one way or another?

Thanks.
View user's profile Send private message Visit poster's website
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Sat Apr 22, 2006 6:14 pm Reply with quote Back to top

We can do something like

Code:

if(!stristr($the_ip,"xxx.xxx.xxx.")) {


That will take the class C part of the IP address. Depending on your ISP, you may have multiple ranges of IPs.

Another option is just not to count things when you're an admin. It does require that you remain logged in, but at least it isn't IP dependent anymore.
View user's profile Send private message Visit poster's website
fade2gray
Regular
Regular


Joined: Mar 26, 2006
Posts: 87
Location: UK

PostPosted: Sat Apr 22, 2006 6:54 pm Reply with quote Back to top

evaders99 wrote:
That will take the class C part of the IP address. Depending on your ISP, you may have multiple ranges of IPs.

So this would work but might also exclude other users of the same ISP?


evaders99 wrote:
Another option is just not to count things when you're an admin. It does require that you remain logged in, but at least it isn't IP dependent anymore.

Yes, Dirk over at Nukies suggested I stick with this method, but I'm not the only user of this box and wanted to minimize this risk of accidents by staying logged in. I'll just have to remember to log in before browsing too deeply.

Thanks.
View user's profile Send private message Visit poster's website
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Sat Apr 22, 2006 11:07 pm Reply with quote Back to top

Yes it would. Go the easy route as suggested, use the admin login Smile
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum