function httpBL_get_env($htvars)
{
if(isset($_SERVER[$htvars])) {
return strip_tags($_SERVER[$htvars]);
} elseif(isset($_ENV[$htvars])) {
return strip_tags($_ENV[$htvars]);
} elseif(isset($HTTP_SERVER_VARS[$htvars])) {
return strip_tags($HTTP_SERVER_VARS[$htvars]);
} elseif(getenv($htvars)) {
return strip_tags(getenv($htvars));
} elseif(function_exists('apache_getenv') && apache_getenv($htvars, true)) {
return strip_tags(apache_getenv($htvars, true)); }
return '';
}
function httpBL_get_real_ip_address()
{
if (httpBL_get_env('HTTP_CLIENT_IP')) {
return httpBL_get_env('HTTP_CLIENT_IP'); }
elseif (httpBL_get_env('HTTP_X_FORWARDED_FOR')) {
return httpBL_get_env('HTTP_X_FORWARDED_FOR'); }
elseif (httpBL_get_env('REMOTE_ADDR')) {
return httpBL_get_env('REMOTE_ADDR'); }
elseif (httpBL_get_env('BAN_CHECK_IP')) {
return httpBL_get_env('BAN_CHECK_IP'); }
elseif (httpBL_get_env('HTTP_VIA')) {
return httpBL_get_env('HTTP_VIA'); }
elseif (httpBL_get_env('HTTP_CACHE_CONTROL')) {
return httpBL_get_env('HTTP_CACHE_CONTROL'); }
elseif (httpBL_get_env('HTTP_PROXY_CONNECTION')) {
return httpBL_get_env('HTTP_PROXY_CONNECTION'); }
elseif (httpBL_get_env('HTTP_X_FORWARDED')) {
return httpBL_get_env('HTTP_X_FORWARDED'); }
elseif (httpBL_get_env('HTTP_FORWARDED')) {
return httpBL_get_env('HTTP_FORWARDED'); }
elseif (httpBL_get_env('SERVER_NAME')) {
return httpBL_get_env('SERVER_NAME'); }
elseif (function_exists('is_callable')) {
if (!is_callable('gethostbyname')){
if (isset($_ENV['SERVER_NAME'])) {
$ip = gethostbyname($_SERVER['SERVER_NAME']); } } }
return httpBL_get_env('REMOTE_ADDR');
}
$URL = $_SERVER["REQUEST_URI"] ;
$USER_AGENT = $_SERVER["HTTP_USER_AGENT"] ;
//$REFERER = $_SERVER["REFERER"] ; // still used?
//$IP = $_SERVER["REMOTE_ADDR"] ;
$IP = httpBL_get_real_ip_address() ;
$HOST = $_SERVER["HTTP_HOST"] ;
//$REDIRECT_STATUS = $_SERVER["REDIRECT_STATUS"] ; // generating errors in /var/log/httpd/old-friends.co-error_log 2015-09-19
if ( isset($_GET["ip"]) ) $IP = $_GET["ip"] ; // for testing
$badVisitor = FALSE ;
if (stripos($IP, '1.171.') ===0) $badVisitor = TRUE ; //Taiwan scraper 2015-02-17
if (stripos($IP, '5.9.98.') ===0) $badVisitor = TRUE ; //MegaIndex.ru 2015-02-23
if (stripos($IP, '8.155.76.144') ===0) $badVisitor = TRUE ; //CO crawling T52 2015-03-29 (proxy)
if (stripos($IP, '11.156.') ===0) $badVisitor = TRUE ; //MegaIndex.ru 2015-03-27
if (stripos($IP, '24.151.230.67') ===0) $badVisitor = TRUE ; //Nasty msg poster 2015-09-03
if (stripos($IP, '37.24.') ===0) $badVisitor = TRUE ; // Greman bot scraping all domains, ignoring rules 2015-03-18
if (stripos($IP, '37.59.') ===0) $badVisitor = TRUE ;
if (stripos($IP, '37.187.') ===0) $badVisitor = TRUE ; // French bot scraping Posen-L at 3 secs/request 2018-04-14
if (stripos($IP, '42.124.251.148') ===0) $badVisitor = TRUE ; //Japan crawling T52 2015-03-29 (proxy)
if (stripos($IP, '46.75.251.148') ===0) $badVisitor = TRUE ; //Austria crawling T52 2015-03-29 (proxy)
if (stripos($IP, '46.105.100.') ===0) $badVisitor = TRUE ; // French scraper PosenL 2015-03-15
if (stripos($IP, '46.161.41.') ===0) $badVisitor = TRUE ; // Russian spambot T52 2015-03-15, 03-18
if (stripos($IP, '46.246.61.148') ===0) $badVisitor = TRUE ; // Swedish scraper OF 2015-04-15, 04-18
if (stripos($IP, '50.18.47.49') ===0) $badVisitor = TRUE ; // SanFrancisco bot crawling OF 2015-07-07
if (stripos($IP, '54.186.29.48') ===0) $badVisitor = TRUE ; // scraping OF sch pgs, VA NING/1.0
if (stripos($IP, '54.208.') ===0) $badVisitor = TRUE ; // scraping OF sch pgs, OR 2015-04-28
if (stripos($IP, '61.230.') ===0) $badVisitor = TRUE ;
if (stripos($IP, '66.7.202.137') ===0) $badVisitor = TRUE ; //SQL inject attack to T52 2015-02-16
if (stripos($IP, '66.119.41.34') ===0) $badVisitor = TRUE ; //NY crawling OF
if (stripos($IP, '68.61.42.67') ===0) $badVisitor = TRUE ; //adding bogus classmates 2015-06-21
if (stripos($IP, '69.201.76.144') ===0) $badVisitor = TRUE ; //NY crawling T52 2015-03-29 (proxy)
if (stripos($IP, '71.126.50.194') ===0) $badVisitor = TRUE ; //MA slamming OF 2015-03-21
if (stripos($IP, '76.26.81.81') ===0) $badVisitor = TRUE ; //Ceredo - Kenova garbage names poster 2015-09-03
if (stripos($IP, '88.198.56.239') ===0) $badVisitor = TRUE ; //Germany crawling T52 2015-03-29 (proxy)
if (stripos($IP, '91.109.') ===0) $badVisitor = TRUE ; // belgium; crawling all of Posen-L
if (stripos($IP, '91.121.') ===0) $badVisitor = TRUE ; // belgium; crawling OF
if (stripos($IP, '91.200.') ===0) $badVisitor = TRUE ;
if (stripos($IP, '91.236.75.') ===0) $badVisitor = TRUE ; // heavy scraping of OF school page 2015-05-17
if (stripos($IP, '94.23.27.166') ===0) $badVisitor = TRUE ; // Fremch bot crawling posen-l 2015-02-16
if (stripos($IP, '94.242.221.') ===0) $badVisitor = TRUE ; // Luxembrg bot crawling OF (+Trees) 2015-02-18, 03-18
if (stripos($IP, '99.192.') ===0) $badVisitor = TRUE ; // Shelbourne pervert 2015-03-17
if (stripos($IP, '99.192.67.') ===0) $badVisitor = TRUE ; // Shelbourne pervert 2015-03-17 (Darren H.)
if (stripos($IP, '99.192.69.') ===0) $badVisitor = TRUE ; // Shelbourne pervert 2015-03-16
if (stripos($IP, '99.192.85.') ===0) $badVisitor = TRUE ; // Shelbourne pervert 2015-03-16
if (stripos($IP, '101.65.')===0) $badVisitor = TRUE ; //Chinese hack probing 2015-07-07
if (stripos($IP, '103.27.127.')===0) $badVisitor = TRUE ; //Chinese hack probing 2015-03-28
if (stripos($IP, '104.255.66.211')===0) $badVisitor = TRUE ; //forum spammer? 2015-03-24
if (stripos($IP, '118.168.')===0) $badVisitor = TRUE ; //Taiwan scraper 2015-02-17
if (stripos($IP, '111.118.134.')===0) $badVisitor = TRUE ; //Camodian browser 2015-06-28
if (stripos($IP, '118.169.')===0) $badVisitor = TRUE ; //Taiwan scraper 2015-02-17
if (stripos($IP, '121.146.')===0) $badVisitor = TRUE ;
if (stripos($IP, '104.255.')===0) $badVisitor = TRUE ;
if (stripos($IP, '136.69.251.148') ===0) $badVisitor = TRUE ; //MI crawling T52 2015-03-29 (proxy)
if (stripos($IP, '138.169.153.27')===0) $badVisitor = TRUE ; //DC scraper caught in noForeignbots.php from LogVist
if (stripos($IP, '144.76.') ===0) $badVisitor = TRUE ; //DEU?RUSscrape slamming T52 2015-03-23 6am at least 3/sec
if ($IP == '144.76.27.118') $badVisitor = TRUE ; //DEU?RUSscrape slamming T52 2015-03-23 6am at least 3/sec
if ($IP == '144.76.63.35') $badVisitor = TRUE ; //MegaIndex slamming 2015-06-08
if (stripos($IP, '147.154.') ===0) $badVisitor = TRUE ; //DEU?RUSscrape slamming T52 2015-03-23 6am at least 3/sec
if ($IP == '147.154.235.102') $badVisitor = TRUE ; //DEU?RUSscrape slamming T52 2015-03-23 6am at least 3/sec
if ($IP == '158.106.67.') $badVisitor = TRUE ; //LinkWalker scraping T52 every 5 secs, 2015-03-26
if (stripos($IP, '161.202.75.36') ===0) $badVisitor = TRUE ; // adding bogus names
if (stripos($IP, '162.213.42.130') ===0) $badVisitor = TRUE ; // scraping T52, breaking rules (robospider)
if (stripos($IP, '168.216.') ===0) $badVisitor = TRUE ;
if (stripos($IP, '173.185.76.144') ===0) $badVisitor = TRUE ; //TX crawling T52 2015-03-29 (proxy)
if (stripos($IP, '176.102.')===0) $badVisitor = TRUE ;
if (stripos($IP, '176.31.')===0) $badVisitor = TRUE ; // French scraper T52 2015-08-08
if (stripos($IP, '183.') ===0) $badVisitor = TRUE ;
if (stripos($IP, '188.165.') ===0) $badVisitor = TRUE ; //Ahrefs back links hvy crawler 201-02-21
if (stripos($IP, '189.84.21.85') ===0) $badVisitor = TRUE ; //entering fake names OF 2015-04-14
if (stripos($IP, '192.96.207.229') ===0) $badVisitor = TRUE ; //SQL inject attack to T52 2015-02-16
if (stripos($IP, '197.231.221.211') ===0) $badVisitor = TRUE ; //SQL inject attack Trees & history 2015-05-19
if (stripos($IP, '198.245.60.28') ===0) $badVisitor = TRUE ; //scraping OF 2015-04-28
if (stripos($IP, '199.223.253.113') ===0) $badVisitor = TRUE ; //scraping OF 2015-04-28
if (stripos($IP, '213.251.182.103') ===0) $badVisitor = TRUE ; //hacking attempt from France 2015-07-06
if (stripos($USER_AGENT, 'Ahrefs') > 0) $badVisitor = TRUE ; //Ahrefs back links hvy crawler 201-02-21
if (stripos($USER_AGENT, 'brandprotect') > 0) $badVisitor = TRUE ; // scraping T52, 2015-03-26
if (stripos($USER_AGENT, 'brandimensions') > 0) $badVisitor = TRUE ; // scraping T52, 2015-03-26
if (stripos($USER_AGENT, 'MegaIndex') > 0) $badVisitor = TRUE ; // scraping , 2015-05-18
if (stripos($USER_AGENT, 'LinkWalker') > 0) $badVisitor = TRUE ; // scraping T52, 2015-03-26
if (stripos($USER_AGENT, 'NING/') > 0) $badVisitor = TRUE ; // scraping T52, 2015-03-26
if (stripos($USER_AGENT, 'MegaIndex') > 0) $badVisitor = TRUE ; // scraping T52, 2015-02-23
if (stripos($USER_AGENT, 'robospider') > 0) $badVisitor = TRUE ; // scraping T52 & posenL, breaking rules
//if (stripos($USER_AGENT, 'WebIndex') > 0) $badVisitor = TRUE ;
if (stripos($USER_AGENT, 'yandex') > 0) $badVisitor = TRUE ;
if (stripos($USER_AGENT, 'yoozBot') > 0) $badVisitor = TRUE ;
if ($badVisitor)
{
//mail('james@birchy.com','Blocked: '.$IP,'Blocked: '.var_export($_SERVER,TRUE).' '.var_export($_ENV,TRUE).' '.var_export($HTTP_SERVER_VARS,TRUE) ) ;
//header('No such page', true, 404);
//include('your_404_page.php');
die('No scraping allowed!');
}
?>
Warning: Cannot modify header information - headers already sent by (output started at /home/blockIPs.php:142) in /home/old-friends/public_html/header_php.php on line 3
Could not CONNECT to the database: SQLSTATE[HY000] [2019] Can't initialize character set utf8 (path: /usr/share/mysql/charsets/)