Hostname Filtering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I have a few PHP scripts where I log hit to a page i.e. IP and hostname via a look up.

What I want to do is create essentially a blacklist to prevent bots and other hosts and IP from being logged and skewing my stats. My local IP/host and the MSN and Googlebot hits should not be in my stats or at least I can flag them to hide them.

For example:

$blacklist = array(
'*.wavefront.ca',
'*.googlebot.com',
'msnbot.msn.com',
'*.inktomisearch.com',
'68.146.96.245'
);

So lets say I have my host:

$host = 'lj602144.inktomisearch.com';

I want to quickly parse this array and return a simple boolean if I am in the blacklist. I could create a loop and cycle through the array valves and to a regex on each but I was hoping someone would have a more elegant solution.

Thanks,

Dan T

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux