$ip = $_GET['ip']; $status = ""; if (preg_match('/^\\d{1,3}(\\.\\d{1,3}){3}$/', $ip)) { if ($ip == "127.0.0.1") { $status = "Host not allowed"; } else { $addr = explode('.', $ip); foreach ($addr as $piece) { if ($piece > 254) { $status = "Invalid IP address"; break; } } if ($status == "") { try { $result = pcheck::check(array($ip)); $status = "{$ip} - "; switch ($result[$ip]) { case -1: $status .= "detection failed"; break; case 0: $status .= "no proxy detected"; break; case 1: $status .= "OPEN PROXY DETECTED!"; break; } } catch (Exception $e) { $status = $e->getMessage(); }
if (!(function_exists('pcntl_fork') || $__runFromAdmin)) { die("This script may not be called from the web server.\n"); } /* Load the required libraries */ $__loader = array('log', 'classloader', 'version', 'game', 'tick', 'config', 'db_connection', 'db_accessor', 'db_copy', 'pcheck_thread', 'pcheck_manager', 'pcheck'); require_once "loader.inc"; l::setSyslogPrefix("lwProxy"); if (count($argv) > 1) { /* Checks for command line arguments */ if (count($argv) > 2 && ($argv[1] == '-c' || $argv[1] == '-f')) { $addresses = $argv; array_shift($addresses); array_shift($addresses); print "Running manual check, please wait ...\n"; try { $results = pcheck::check($addresses, $argv[1] == '-f'); } catch (Exception $e) { print "{$argv[0]}: " . $e->getMessage() . "\n"; exit(1); } foreach ($results as $address => $proxy) { print "\t{$address} - "; switch ($proxy) { case -1: print "detection failed"; break; case 0: print "no proxy detected"; break; case 1: print "OPEN PROXY DETECTED!";