mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-08-28 14:11:08 -05:00
Merge pull request #327 from kotarou3/virtualhost
Only check if an address is already registered by hostname, not by IP
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user