function DoTest($testname, $param, $hostname, $timeout, $params) { /* parameters: 0: hostname 1: External IP Info Provider 0 = PurplePixie 1 = Other 2: Other IP Info Provider URL */ if ($params[1] == 0) { $url = ""; } else { $url = $params[2]; } $ip = get_external_ip($url); // echo "External: ".$ip."\n"; if ($ip <= 0) { return $ip; } $dynamic_ip = gethostbyname($params[0]); // echo "Dynamic: ".$params[0]." = ".$dynamic_ip."\n"; if ($dynamic_ip == $params[0]) { return -2; } // unmodified host; hostname lookup failed if ($dynamic_ip == $ip) { return 1; } else { return 0; } // External IP and Dynamic IP are not matching }
* "Sun, 24 Jan 2016 11:54:33 +0100 - updating record with aaa.bbb.ccc.ddd" * */ // setup default values and load config file date_default_timezone_set('Europe/Berlin'); $PWD = dirname(realpath($argv[0])); $OS = strtoupper(substr(PHP_OS, 0, 3)); $DIR_SLASH = $OS === 'WIN' ? '\\' : '/'; $LF = $OS === 'WIN' ? "\r\n" : "\n"; require_once $PWD . $DIR_SLASH . 'config.php'; check_permissions(); //ensue that we can read and write to the cache file $cached_ip = get_cached_IP($PWD . $DIR_SLASH . $CONFIG['cache_ip']); $CONFIG['client_id'] = 'DNSmadeEasy.com Updater/2016.01.24 https://www.mysupportforum.com/kaisersoft/'; // get external IP of system $external_ip = get_external_ip($argv, $CONFIG['ipscript']); // update DNS if it changed if ($external_ip === $cached_ip) { echo date('r') . " - external IP has not changed: {$external_ip}{$LF}"; exit(0); } elseif ($external_ip == '') { echo date('r') . " - IP lookup server returned invalid data. {$external_ip}{$LF}"; exit(99); } elseif ($external_ip !== $cached_ip && strpos($external_ip, '.') !== false) { // update DNS record process_records($CONFIG, $RECORDS, $external_ip); put_cached_IP($PWD . $DIR_SLASH . $CONFIG['cache_ip'], $external_ip); exit(0); } else { echo date('r') . " - ERROR: unhandeld script condition{$LF}"; exit(99);
// general info: $glestVersion = (string) clean_str($_GET['glestVersion']); $platform = (string) clean_str($_GET['platform']); $binaryCompileDate = (string) clean_str($_GET['binaryCompileDate']); if (isset($_GET['privacyPlease'])) { $privacyPlease = (int) $_GET['privacyPlease']; } else { $privacyPlease = 0; } // game info: $serverTitle = (string) clean_str($_GET['serverTitle']); $remote_ip = (string) clean_str($_SERVER['REMOTE_ADDR']); // If the clients' IP address belongs to a RFC1918 IP range... if (strncmp($remote_ip, get_localsubnet_ip_prefix(), strlen(get_localsubnet_ip_prefix())) == 0) { // ...then replace it by the master servers' public IP address. $remote_ip = get_external_ip(); } $service_port = (int) clean_str($_GET['externalconnectport']); // If the game server port was not transmitted... if ($service_port == '' || $service_port == 0) { // ..then assume the default port $service_port = 61357; // ... alternatively, refuse such servers /* header( 'Content-Type: text/plain; charset=utf-8' ); die( 'Invalid external connect port.'); */ } // game setup info: $tech = (string) clean_str($_GET['tech']); $map = (string) clean_str($_GET['map']);