We have to have this annoying test because the internet is full of bad bots causing overloaded servers :(
$htmlend");
else
///Auto
die("$htmlstart Human check! Are you a human?
Please wait....
$htmlend");
}
//update time
else
{
$sql = "update `visitorsallowed` set `date`=NOW() WHERE `ip`='$ip'";
$result = mysql_query($sql);
}
}
if($allowedip==0)
{
$minserverload=2;
$maxserverload1=3;
$maxserverload2=5;
$maxconnections0=2000;
$maxconnections1=3000;
$maxconnections2=5000;
$blockeduseragents="/sqlmap|python-requests|curl\/|Java\/|Macintosh; Intel Mac OS X 10_15_7|Macintosh; Intel Mac OS X 10.15/i";
//Block AI-Bots when high serverload
if(($tempconnections > $maxconnections1 || $serverload > $maxserverload2) && !preg_match("/\/contact|\/register/i",$uri)
&& preg_match("/GoogleImageProxy|LinkupBot|SleepBot|ClaudeBot|GPTBot|Amazonbot|meta-webindexer|PetalBot|DataForSeoBot|DotBot|SemrushBot|AhrefsBot|PerplexityBot|AwarioBot/",$useragent))
{
http_response_code(503);
die("$htmlstart Hi bot! The server is currently unable to handle the request due to a temporary overloading and we would like real people to visit the website. If you are not a bot then contact us. $htmlend");
}
//Block strange bots SEO Bots when high serverload or too many connections
if(($tempconnections > $maxconnections0 || $serverload > $maxserverload1) && !preg_match("/\/contact|\/register/i",$uri)
&& preg_match("/sqlmap|Brightbot|TikTokSpider|tphotobot|dwnupd|SEOkicks|ExaSearchBot|ImageBot|YouBot|Lightpanda|Reflectionbot|AionBot|Dragonfly|Bytespider|ByteDanceSpider|YisouSpider|Mediatoolkitbot|Pinterestbot|SERankingBacklinksBot|Aranet-SearchBot|SleepBot|LinkupBot|SemrushBot|AhrefsBot|AwarioBot|DataForSeoBot|trendictionbot|Dotbot/",$useragent))
{
http_response_code(503);
die("$htmlstart Hi bot! The server is currently unable to handle the request due to a temporary overloading and we would like real people to visit the website. If you are not a bot then contact us. $htmlend");
}
//Block sqlmap
if(!preg_match("/\/contact|\/register/i",$uri) && preg_match("/sqlmap/",$useragent))
{
http_response_code(503);
die("$htmlstart Hi bot! The server is currently unable to handle the request due to a temporary overloading and we would like real people to visit the website. If you are not a bot then contact us. $htmlend");
}
//Block bots from searching?
if($bot==1 && preg_match("/\/search/i",$uri) && $_GET["q"]!="")
{
http_response_code(200);
die("$htmlstart Ehh? You are not a human. If you are not a bot then contact us. $htmlend");
}
//get country code
//disabled
/* try
{
$mmdb= 'GeoLite2-Country.mmdb';
$reader = new Reader( '/var/www/main/geoip/' . $mmdb );
$ipData = $reader->get($ip);
$yourcountrycode = $ipData['country']['iso_code'];
}
catch(Exception $e)
{
$yourcountrycode="";
}
if($bot==0 && $yourcountrycode!="" && $ip!="81.171.6.66" && $ip!="" && $ip!="127.0.0.1" && $ip!="localhost")
{
$nosessioncookie=false;
if($tempconnections > $maxconnections1 && $_GET['s']!="")
$nosessioncookie=true;
if( $serverload>$minserverload)
{
//bad countries
if($yourcountrycode=="BR" || $yourcountrycode=="CN" ||
$yourcountrycode=="SG" || $yourcountrycode=="HK" || $yourcountrycode=="IN" || $yourcountrycode=="AR" || $yourcountrycode=="RU" ||
$yourcountrycode=="VN" || $yourcountrycode=="IQ" || $yourcountrycode=="TR" || $yourcountrycode=="CO" || $yourcountrycode=="TW" ||
$yourcountrycode=="BD" || $yourcountrycode=="ID" || $yourcountrycode=="ZA" || $yourcountrycode=="UZ" || $yourcountrycode=="PH" || $yourcountrycode=="KH"
|| $yourcountrycode=="TH")
$countryblock=true;
else
$countryblock=false;
//non europen countries
if(! ($yourcountrycode=="" || $europeanCountries[$yourcountrycode]==1 ))
$countryeurope=false;
else
$countryeurope=true;
//$countryeurope=false;
if(
//Non european check
$countryeurope==false ||
// ($ip=="83.250.146.83") ||
//Java browser? Curl browser
(preg_match($blockeduseragents,$useragent))
||
//All site No useragent??
($useragent=="")
||
//All site Too high serverload
($serverload > $maxserverload1)
||
//All site countries
$countryblock
||
//too many connections
$tempconnections > $maxconnections1
||
//session cookie?
$nosessioncookie
||
preg_match("/\/search/i",$uri)
)
{
//not rss feeds forum external rss and contact page and register forum
if($skipcheckblock!=true && !preg_match("/503|missing|\/rss|\/external\.php\?type|\/external\.php\?forumids|\/contact|\/register/i",$uri))
{
@mysql_connect("localhost", "baldrick", "skriver5");
@mysql_select_db("howdyvcdhelp");
$sql = "SELECT ip FROM `visitorsallowed` WHERE `ip`='$ip'";
$result = mysql_query($sql);
$allowedip = MYSQL_NUM_ROWS($result)+0;
if($allowedip==0)
{
$sql = "SELECT ip FROM `visitors` WHERE `ip`='$ip' and js=1";
$result = mysql_query($sql);
$jscheck = MYSQL_NUM_ROWS($result)+0;
// if(($ip=="83.250.146.83"))
// $jscheck=0;
if($jscheck==0 )
{
if($serverload > $maxserverload1 || $tempconnections > $maxconnections1)
{
//always check
$countips=3;
}
else
{
//last 10 seconds block check
$sql = "SELECT ip FROM `visitorsblocked` WHERE `ip`='$ip' and time > now() - interval 10 second";
$result = mysql_query($sql);
$countips = MYSQL_NUM_ROWS($result)+0;
}
$useragent=mysql_real_escape_string($_SERVER['HTTP_USER_AGENT']);
$time=date("Y-m-d H:i:s");
$uri=mysql_real_escape_string($_SERVER[REQUEST_URI]);
$sql="insert into visitorsblocked values('$ip','$time','blocked','$useragent','0','4','$countips','$yourcountrycode','$uri')";
@mysql_query($sql);
//block if 3 hits or more
//or high serverload or many tempconnections
if($countips > 2)
{
$sql="update visitorsblocked set count=count+3 where ip='$ip'";
@mysql_query($sql);
$actual_link = "https://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
if($actual_link=="")
$actual_link="https://www.videohelp.com";
$templink=urlencode($actual_link);
//file_put_contents("/var/www/main/SQL/LOG/blocklog", "$uri $ip $yourcountrycode \r\n",FILE_APPEND);
@mysql_close();
http_response_code(503);
if($blocktype=="forum" || $tempconnections > $maxconnections2 || $serverload > $maxserverload2
|| $countryeurope==false || $countryblock
)
{
//no auto forward
die("$htmlstartHuman check! Are you a human?
Please wait....
We have to have this annoying test because the internet is full of bad bots causing overloaded servers :(
$htmlend");
}
else
{
//auto forward javascript
die("$htmlstart Human check! Are you a human?