Forum Moderators: coopster

Message Too Old, No Replies

Ignore specific IP

in custom tracking script

         

icanthinkofaname

2:07 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



Good Morning to everyone,
Ok I have a script that will log ppl's ip's and there browser and then will display it online inside of a php script. Is there a way to ignore an ip so that it will not show up in this list? I dont want to block this ip b/c its an apache test script that will ping my site ever 5 minutes and if the site is down it will page my phone. So i need to kno if there is a way to ignore this ip but still allow it to run the ping?

Any help on this would be great.

Thanks again,
Mike

johannes

2:15 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



What list do you want to block the ip from?

If your php script produces the list you just can insert something like:

if($ip!="xxx.xxx.xxx.xxx"){
write to the list
}else{
don't write to the list
}

where xxx.xxx.xxx.xxx is the ip you'd like to block.

icanthinkofaname

2:20 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



but if I place that in there and block that IP it will then keep paging my phone and I dont want that every 5 min :). Is that the only way to do that is to block it?

Thanks again for the reply.

BlueSky

3:38 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



Why do you think Johannes' script would cause your phone to be paged every five minutes? The test script pinging your site is running on a different computer...right? The other computer is the one which will be paging you not the one your site is running on...right?

icanthinkofaname

3:58 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



The script that pages my phone is on a different server. That server's IP shows up on my ip.txt file. I would like to stop that IP from showing up inside of that file but If I place a block on that IP then it will mean that the apache on my server is down and will page my phone.

The script for the phone is written to check if the apache is up, if it can not reach my site then it will page. Which means if I block that IP from showing up inside of the ip.txt file that script will signal and say that my site is down, which it is not, its just that a block was placed on that IP.

Hope that helped,
Mike

BlueSky

4:30 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



Okay, well what Johannes recommended was for logging not blocking. Inside your script which does the ip and browser logging, just do a check for the IP. If it does not match the distant computer used for paging, then log those two. If it does match, then skip the logging.

If your distant computer doesn't have a dedicated IP, then you'll either have to check the IP range it uses or add a user agent so your site's server can easily pick it out.

icanthinkofaname

5:02 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



Thanks for the info. The ip for the site that pings my server is dedicated. What would be the code to use so that my script will ignore that ip?

Thanks again,
Mike

BlueSky

5:19 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



It's just a simple if statement like Johannes posted above:

If your php script produces the list you just can insert something like:

if($ip!="xxx.xxx.xxx.xxx"){
write to the list
}else{
don't write to the list
}

where xxx.xxx.xxx.xxx is the ip you'd like to block.

Where he says: "write to the list", that is the place you insert the code which logs the ip and browser. The part which says: "else { don't write to the list }" you can leave that completely off. The xxx.xxx.xxx.xxx is the dedicated IP.

icanthinkofaname

6:53 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



that did not seem to work. I placed it inside of the script that called this function up to place in the information to be sent to a page to view online. Is that the correct page?

Thanks again,
Mike

icanthinkofaname

9:46 pm on Aug 18, 2003 (gmt 0)

10+ Year Member



aww i got it

This is what has to be placed inside of the code that will call this.

if ($REMOTE_ADDR!= "IP address")
{

Thanks again for all of the help,
Mike