PHP Code:
$ip = getenv("REMOTE_ADDR");
I'm looking to exclude a range of IP addresses from being added to my database in one of my scripts (mainly because they are search engine spiders).
Now I can exclude IP address easily with if else statements. And I have excluded my IP address, and google's spider. In this example 111.111.111.111 is my IP and 222.222.222.222 is google's spider.
PHP Code:
if ($ip != '111.111.111.111' || $ip != '222.222.222.222') {
// stuff to add to MySQL database
}
I want to exclude more IP addresses from other spiders, and I would normally just add
PHP Code:
|| $ip != 'oth.ip.add.ress'
but what if I wanted to exclude a range of IP addresses, like Live Search which have about 10 IPs starting with 65.55.208
Isn't there some kind of way to exclude any number that follows 65.55.208.
Surely this is easy, its just not clear in any PHP tutorials.
|