3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function ipInCIDRNetwork($cidr_network, $ip) { // Thanks Bill Grady for posting a *working* IP in CIDR network function! // Source: http://billgrady.com/wp/2009/05/21/ip-matching-with-cidr-notation-in-php/ // Get the base and the bits from the CIDR if (empty($ip)) { return false; } list ($base, $bits) = explode('/', $cidr_network); if ($bits < 8 || $bits > 32) { throw new Exception("Error: Invalid CIDR mask specified."); } // Now split it up into it's classes list ($a, $b, $c, $d) = explode('.', $base); // Now do some bit shifting/switching to convert to ints $i = ($a << 24) + ($b << 16) + ($c << 8) + $d; $mask = $bits == 0 ? 0 : (~0 << (32 - $bits)); // Here's our lowest int $low = $i & $mask; // Here's our highest int $high = $i | (~$mask & 0xFFFFFFFF); // Now split the ip we're checking against up into classes list ($a, $b, $c, $d) = explode('.', $ip); // Now convert the ip we're checking against to an int $check = ($a << 24) + ($b << 16) + ($c << 8) + $d; // If the ip is within the range, including highest/lowest values, // then it's witin the CIDR range if ($check >= $low && $check <= $high) return true; return false; } $networks = [ '79.141.162.0/24', '95.141.27.0/24', '67.213.218.0/24', // '50.2.6.16/29', '50.2.0.0/15', '96.44.151.0/26', '173.254.206.0/24', '217.13.192.0/20', '173.254.206.0/24', '173.254.219.0/24', '173.254.245.0/25', '204.152.206.128/25', '208.167.231.128/25', '5.102.170.0/23', '66.212.24.64/26', '91.238.214.0/23', '94.46.8.128/26', '96.44.151.0/26', '93.182.128.0/18', '41.208.186.0/24', '77.94.48.5/32', '69.22.185.184/32', '209.73.132.117/32', '209.73.132.0/24', '213.131.53.54/32', '208.68.36.0/22', '222.73.233.146/32', '217.150.82.14/32', // oper mini? //'69.197.128.0/18', '69.197.132.68/32', '199.15.248.179/32', '84.223.98.40/32', '217.115.10.128/28', //'72.13.84.0/24', '79.141.164.0/24', '192.157.192.0/18', '209.188.113.101/32', '209.90.238.252/32', '216.119.149.174/32', '216.119.144.0/20', '173.203.0.0/17', '91.229.20.159/32', '192.162.102.0/23', '54.241.192.0/18', '66.175.208.0/21', '37.221.160.0/21', '74.3.165.39/32', '192.73.232.0/21', '93.114.40.0/21', '77.97.32.95/32', '113.10.222.6/32', '81.2.197.0/24', '221.176.14.6/32', '46.32.224.0/19', /* egi hosting start */ '173.245.220.0/22', '173.245.64.0/19', '205.164.0.0/18', '216.151.183.0/24', '69.46.64.0/19', '23.27.0.0/16', '31.193.7.160/27', '69.46.64.0/19', /* egi hosting end */ '206.225.80.0/21', '206.225.92.0/22', '216.55.160.0/21', '216.55.168.0/22', '216.55.176.0/21', '216.55.184.0/22', '14.136.236.172/32', '95.170.86.0/24', '198.74.96.0/19', '115.25.216.6/32', '212.186.0.0/18', '86.1.77.110/32', '176.31.180.0/22', '96.44.188.0/22', '31.172.0.0/17', '78.142.128.0/18', '5.9.0.0/16', '79.141.172.0/24', '82.221.96.0/19', '109.187.36.216/32', '74.120.15.0/24', '171.25.193.0/24', '23.30.140.221/32', '209.17.191.117/32', '91.121.0.0/17', '80.250.96.0/20', //'124.92.0.0/14', '85.237.192.0/19', '218.188.13.237/32', '5.135.0.0/16', '95.154.192.0/18', //'67.159.0.0/18', // UCWEB? '78.129.128.0/17', '93.174.88.0/21', '178.209.96.0/19', '176.116.153.18/32', '95.141.27.41/32', '200.113.174.211/32', '37.247.48.0/21', '82.196.0.0/20', '96.47.226.16/29', '128.6.224.107/32', '74.117.56.0/21', '199.48.147.36/32', '65.49.0.0/17', '50.59.161.34/32', '66.92.44.0/24', '50.56.0.0/17', //rackspace '68.234.25.12/32', '198.211.96.0/19', '65.181.123.254/32', '204.93.60.186/32',//nlayer '91.228.52.0/23', //firstroot /* ovh start */ '142.4.192.0/19', '176.31.0.0/16', '176.31.96.0/19', '178.32.0.0/15', '178.33.40.0/21', '188.165.0.0/16', '192.95.0.0/18', '198.27.64.0/18', '37.59.0.0/16', '46.105.0.0/16', '46.105.32.0/19', '46.105.96.0/19', '5.39.0.0/17', '87.98.128.0/18', '91.121.0.0/19', '91.121.136.0/21', '91.121.160.0/19', '91.121.192.0/20', '91.121.208.0/21', '91.121.220.0/22', '91.121.32.0/19', '91.121.64.0/18', '94.23.0.0/16', '94.23.192.0/18', /* ovh end */ /* volumedrive start */ '142.0.32.0/20', '173.242.112.0/20', '199.115.228.0/22', '199.168.136.0/21', '199.180.112.0/21', '199.19.104.0/21', // free proxy? 199.19.105.156 '204.124.180.0/22', '74.118.192.0/22', '199.115.231.51/32', /* volumedrive end */ /* hetzner start */ '176.9.0.0/16' , '178.63.0.0/16', '178.63.103.0/26', '178.63.46.128/26', '188.40.0.0/16', '213.239.192.0/18', '46.4.0.0/16', '5.9.0.0/16', '78.46.0.0/15', '78.47.145.144/28', '85.10.192.0/20', '88.198.0.0/16', // free proxy? 88.198.55.109 /* hetzner end */ '184.172.0.0/15', // ThePlanet /* singlehop start */ '108.163.192.0/18', '108.178.0.0/18', '173.236.0.0/17', '184.154.0.0/16', '198.143.128.0/18', '198.143.128.32/27', '198.20.64.0/18', '65.60.0.0/18', '69.175.0.0/17', '96.127.128.0/18', '99.198.96.0/19', /* singlehop end */ '208.67.16.0/21', //plesklogin /* burstnet/hostnoc start */ '173.212.192.0/18', '178.238.128.0/20', '184.22.0.0/16', '184.22.151.64/27', '184.82.0.0/16', '31.193.0.0/20', '31.193.7.192/26', '46.37.160.0/19', '46.37.179.128/26', '64.120.128.0/17', '64.191.0.0/17', '66.197.128.0/17', '66.96.192.0/18', '66.96.212.16/28', '96.9.128.0/18', /* burstnet end */ '204.93.32.0/19', //nlayer /* proxy51 */ '142.54.171.0/24', '173.232.86.0/24', '199.116.84.0/24', '199.116.85.0/24', '199.116.86.0/24', '199.116.87.0/24', '216.172.139.0/25', '216.172.141.0/24', '23.29.55.0/24', '23.29.56.0/24', '23.29.57.0/24', '23.29.58.0/24', '38.87.64.0/20', '50.117.0.0/17', '50.117.64.0/21', '50.117.64.0/24', '50.117.69.0/24', '50.117.73.0/24', '69.46.81.0/24', /* proxy51 end */ '23.30.140.221/32', //comcast tor '216.119.144.0/20', //vps.net '95.211.99.0/24', //;easeweb '95.211.100.0/23', //leasweb '204.14.72.0/21', //areti internet '85.17.122.0/24', //leaseweb '85.17.0.0/16', // leaseweb '199.58.84.0/22', //leaseweb '81.19.32.0/22', //telematica Czech '86.104.14.0/24', //amplusnet RO '79.141.166.0/24', //kaya global '74.221.208.0/20', //cloudvz/peer1 '31.31.72.0/21', //wedos cz internet '194.14.179.0/24', //iperweb / prometeus IT '193.183.98.0/23', //ipperweb UK '192.211.48.0/20', //incero hosting US '37.235.54.0/24', // edis hosting UK '91.108.178.0/24', //webexxxpurts '176.53.69.14/32', //santek TR //'95.211.0.0/16', //leaseweb - useris pasiskunde, negaliu pilnai banint '109.73.77.248/29', //redstation hosting '95.141.20.0/24', //kaia global '198.50.128.0/17', //ovh '95.141.31.0/24', //kaia global '208.110.64.0/19', // RR RC wholesale internet, US '79.141.160.0/20', //kaia global '198.102.28.0/24', //spam '198.102.29.0/24', //spam '198.102.30.0/24', //spam '198.102.31.0/24', //spam '216.177.128.0/20', //alentus '69.22.169.117/32', // ?? '95.141.29.48/28', //kaia global '209.73.148.0/24', //critical issue '213.251.128.0/18', // OVH FR '162.216.45.0/24', // front range hosting '5.199.128.0/20', //webtropia DE '162.210.196.160/27', //leaseweb '37.221.172.0/23', //voxility US '77.247.181.160/28', //tor servers, '216.218.128.0/17', // hurricane electric US '66.45.252.88/29', //prometheus.vectro.com '74.63.64.0/18', //fdc servers/phoenix nap '209.239.112.0/20', //'Hosting Solutions International, Inc. US '212.111.205.0/24', // URAN academic netw, UA '198.143.1.0/24', //phoenix nap '95.141.27.0/24', //kaia global UA '209.239.96.0/19', //gblx global crossing US '184.171.160.0/20', // secured servers USsudo '79.141.172.0/24', //kaia global FI '82.221.96.0/19', // Thor IS '67.221.255.0/24', //eurotransit '67.86.96.85/32',//weird proxy '74.115.0.0/21', //anchorfree vpn '199.255.208.0/21', //anchorfree vpn '162.220.8.0/21', //nodes direct US '66.90.64.0/18', //fdcservers '198.245.48.0/20', // OVH '12.107.206.114/32', '95.141.28.0/24', //kaia global '50.62.0.0/15', //godaddy '192.3.16.0/22', //colocrossing us '188.132.188.0/24', // mars global datacenters '162.243.0.0/16', //DigitalOcean '162.210.196.160/27', //spotflux vpn //kaia global: '67.221.255.0/24', '79.141.160.0/21', '79.141.169.0/24', '79.141.170.0/23', '79.141.172.0/22', '95.141.16.0/20', '185.18.104.0/23', '185.18.106.0/24', '192.121.66.0/24', '192.121.68.0/24', '193.34.48.0/22', '193.142.97.0/24', '193.180.174.0/24', '194.124.229.0/24', '195.13.60.0/22', '195.78.240.0/22', //end kaia global //as11346 nlayer '46.16.32.0/22', '46.16.36.0/22', '50.117.49.0/24', '50.117.61.0/24', '50.117.72.0/24', '69.22.129.0/24', '69.22.168.0/24', '69.22.170.0/24', '69.22.172.0/24', '69.22.179.0/24', '69.22.185.0/24', '69.22.187.0/24', '69.31.50.0/23', '176.56.174.0/24', '198.144.106.0/23', '199.101.192.0/24', '199.101.196.0/24', '199.255.210.0/24', '199.255.213.0/24', '204.93.60.0/24', '209.73.141.0/24', '209.73.148.0/24', '216.172.147.0/24', '69.22.174.0/24', //end nlayer '188.211.239.0/24', //leaseweb '37.221.172.0/23', // voxility '178.18.16.0/22', //fibermax '46.20.32.0/20', //DE hosting '5.79.64.0/18', //leaseweb '212.83.128.0/19', //online s.a.s. FR '192.99.0.0/16', //OVH '109.169.0.0/18', //iosmart hosting '209.107.208.0/24', //egi hosting '69.31.68.0/22', // NLAYER '198.199.64.0/19', ///digitalocean '174.142.0.0/16', //iweb '64.62.201.0/24', //us fremont, energy group networks '199.58.84.0/24', //leaseweb/spotflux '50.116.5.0/24', //linode '23.92.16.0/21', //linode '162.210.196.0/24', //leaseweb us '192.96.203.0/24', //leaseweb us '199.58.84.0/24', //leaseweb us '63.141.198.0/23', //nlayer '50.117.45.0/24', //egi ny '216.172.135.0/24', //egi ny '216.172.142.0/24', //egi ny '199.188.236.0/24', //gyrocast/protime /* digitalocean start */ '37.139.0.0/19', '38.74.208.0/20', '69.55.48.0/20', '82.196.0.0/20', '141.0.168.0/21', '146.185.128.0/18', '154.27.0.0/19', '185.14.184.0/22', '192.34.56.0/21', '192.81.208.0/20', '192.241.128.0/19', '198.199.64.0/18', '198.211.96.0/19', '208.68.36.0/22', /* digitalocean end */ /* linode/netaccess */ '23.92.16.0/21', '23.239.8.0/21', '31.220.8.0/22', '31.220.32.0/21', '50.116.48.0/20', '62.28.0.0/18', '64.21.0.0/17', '64.21.128.0/18', '64.212.170.0/23', '64.247.0.0/18', '65.77.140.0/24', '66.29.0.0/17', '66.175.208.0/21', '66.228.32.0/20', '66.241.105.0/24', '66.246.0.0/16', '67.196.0.0/16', '67.219.128.0/20', '69.164.208.0/20', '70.47.0.0/16', '74.91.32.0/20', '77.67.101.0/24', '82.146.48.0/21', '96.126.104.0/21', '97.107.128.0/20', '146.20.20.0/24', '146.20.33.0/24', '162.208.28.0/23', '162.216.16.0/22', '173.255.224.0/19', '179.42.0.0/18', '179.63.64.0/20', '181.233.0.0/18', '190.112.192.0/22', '190.112.200.0/23', '190.112.203.0/24', '192.155.88.0/22', '198.74.56.0/21', '198.175.9.0/24', '198.182.247.0/24', '199.79.133.0/24', '199.127.148.0/22', '199.201.233.0/24', '200.35.152.0/24', '200.35.154.0/23', '204.17.128.0/23', '204.68.168.0/24', '207.99.0.0/17', '207.166.146.0/24', '207.192.64.0/18', '208.90.144.0/22', '209.66.0.0/24', '209.66.16.0/24', '209.66.50.0/24', '209.123.0.0/16', '216.44.114.0/23', '216.118.64.0/18', '216.146.44.0/23', '216.169.208.0/20', /* linode/netaccess end */ /* leaseweb start */ '5.44.144.0/22', '5.61.32.0/20', '5.79.64.0/18', '31.31.32.0/21', '31.186.168.0/22', '31.186.172.0/23', '37.1.144.0/22', '37.1.192.0/21', '37.1.216.0/21', '37.48.64.0/18', '37.49.224.0/23', '37.58.48.0/20', '37.75.152.0/21', '41.242.144.0/21', '46.17.0.0/21', '46.102.240.0/21', '46.165.192.0/18', '46.182.120.0/21', '46.182.176.0/22', '46.226.192.0/21', '46.243.0.0/21', '62.84.240.0/22', '62.212.64.0/19', '77.81.240.0/21', '77.223.144.0/23', '77.235.32.0/19', ]; $ips = [ '213.159.50.59', '213.159.50.51' ]; $bad_proxy = false; $bad_ip = implode(', ', $ips); if (!$bad_proxy) { foreach ($ips as $ip) { foreach ($networks as $network) { if (ipInCIDRNetwork($network, $ip) && !in_array($ip, $whitelist, true)) { // mail('vytenis.darulis@gmail.com', 'ip ban wapego', $t); //$app->log('bad proxy '.$_SERVER['HTTP_USER_AGENT']. ' '.$network. ' '. $ip.' '.user_id(). ' '.username(), [], \Monolog\Logger::NOTICE); $proxy = $network; $bad_proxy = true; $bad_ip = $ip; $_SESSION['_proxy'] = $proxy; break; } } } if (!$bad_proxy) { $tor_nodes = require_once(_CROCO_DIR.'tor_list.php'); foreach ($tor_nodes as $node) { if ($node === $_SERVER['REMOTE_ADDR_ORIGINAL']) { $bad_proxy = true; $proxy = $node; $bad_ip = $_SERVER['REMOTE_ADDR_ORIGINAL']; $_SESSION['_proxy'] = $proxy; break; } } } }
Output for 5.4.0 - 7.1.0
Notice: Use of undefined constant _CROCO_DIR - assumed '_CROCO_DIR' in /in/0mjJq on line 521 Warning: require_once(_CROCO_DIRtor_list.php): failed to open stream: No such file or directory in /in/0mjJq on line 521 Fatal error: require_once(): Failed opening required '_CROCO_DIRtor_list.php' (include_path='.:') in /in/0mjJq on line 521
Process exited with code 255.
Output for 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/0mjJq on line 31
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/0mjJq on line 31
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_NEW in /in/0mjJq on line 9
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_NEW in /in/0mjJq on line 9
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/0mjJq on line 9
Process exited with code 255.