Oppaitime'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

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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. }