BioTorrents.de’s version of Gazelle
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

proxies.class.php 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. // Useful: http://www.robtex.com/cnet/
  3. $AllowedProxies = array(
  4. // Opera Turbo (may include Opera-owned IP addresses that aren't used for Turbo, but shouldn't run much risk of exploitation)
  5. '64.255.180.*', // Norway
  6. '64.255.164.*', // Norway
  7. '80.239.242.*', // Poland
  8. '80.239.243.*', // Poland
  9. '91.203.96.*', // Norway
  10. '94.246.126.*', // Norway
  11. '94.246.127.*', // Norway
  12. '195.189.142.*', // Norway
  13. '195.189.143.*', // Norway
  14. );
  15. function proxyCheck($IP)
  16. {
  17. global $AllowedProxies;
  18. for ($i = 0, $il = count($AllowedProxies); $i < $il; ++$i) {
  19. // Based on the wildcard principle it should never be shorter
  20. if (strlen($IP) < strlen($AllowedProxies[$i])) {
  21. continue;
  22. }
  23. // Since we're matching bit for bit iterating from the start
  24. for ($j = 0, $jl = strlen($IP); $j < $jl; ++$j) {
  25. // Completed iteration and no inequality
  26. if ($j == $jl - 1 && $IP[$j] === $AllowedProxies[$i][$j]) {
  27. return true;
  28. }
  29. // Wildcard
  30. if ($AllowedProxies[$i][$j] === '*') {
  31. return true;
  32. }
  33. // Inequality found
  34. if ($IP[$j] !== $AllowedProxies[$i][$j]) {
  35. break;
  36. }
  37. }
  38. }
  39. return false;
  40. }