diff --git a/crossdomain.php b/crossdomain.php index b6afc06e8..53bbdd0ef 100644 --- a/crossdomain.php +++ b/crossdomain.php @@ -56,19 +56,14 @@ if (isset($PokemonServers[$config['host']])) { // see if this is actually a registered server if ($config['host'] !== 'localhost') { - $ip = gethostbyname($config['host']); foreach ($PokemonServers as &$server) { - if (!isset($server['ipcache'])) { - $server['ipcache'] = gethostbyname($server['server']); - } - if ($ip === $server['ipcache']) { - if (($config['port'] === $server['port']) || - (isset($server['altport']) && - $config['port'] === $server['altport'])) { - $path = isset($_REQUEST['path']) ? $_REQUEST['path'] : ''; - $config['redirect'] = 'http://' . $server['id'] . '.psim.us/' . rawurlencode($path); - break; - } + if ($config['host'] === $server['server'] && ( + $config['port'] === $server['port'] || + (isset($server['altport']) && $config['port'] === $server['altport']) + )) { + $path = isset($_REQUEST['path']) ? $_REQUEST['path'] : ''; + $config['redirect'] = 'http://' . $server['id'] . '.psim.us/' . rawurlencode($path); + break; } } }