|
|
@ -20,35 +20,54 @@ if (empty($_GET['port']) || !\Yggverse\Net\Socket::isPort($_GET['port'])) |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Valid host required to continue |
|
|
|
|
|
|
|
if (isset($_GET['host']) && !\Yggverse\Net\Socket::isHost($_GET['host'])) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
exit( |
|
|
|
|
|
|
|
json_encode( |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'success' => false, |
|
|
|
|
|
|
|
'message' => _('valid host required') |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set client address if optional host not provided |
|
|
|
// Set client address if optional host not provided |
|
|
|
if (empty($_GET['host']) && isset($_SERVER['REMOTE_ADDR']) && !\Yggverse\Net\Socket::isHost($_SERVER['REMOTE_ADDR'])) |
|
|
|
if (empty($_GET['host'])) |
|
|
|
{ |
|
|
|
{ |
|
|
|
$host = $_SERVER['REMOTE_ADDR']; |
|
|
|
// Valid REMOTE_ADDR required to continue |
|
|
|
|
|
|
|
if (empty($_SERVER['REMOTE_ADDR']) || !\Yggverse\Net\Socket::isHost($_SERVER['REMOTE_ADDR'])) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
exit( |
|
|
|
|
|
|
|
json_encode( |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'success' => false, |
|
|
|
|
|
|
|
'message' => _('could not detect valid REMOTE_ADDR') |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$host = $_SERVER['REMOTE_ADDR']; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
$host = $_GET['host']; |
|
|
|
// Valid host required to continue |
|
|
|
|
|
|
|
if (isset($_GET['host']) && !\Yggverse\Net\Socket::isHost($_GET['host'])) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
exit( |
|
|
|
|
|
|
|
json_encode( |
|
|
|
|
|
|
|
[ |
|
|
|
|
|
|
|
'success' => false, |
|
|
|
|
|
|
|
'message' => _('valid host required') |
|
|
|
|
|
|
|
] |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
$host = $_GET['host']; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Connection test |
|
|
|
// Connection test |
|
|
|
exit( |
|
|
|
exit( |
|
|
|
json_encode( |
|
|
|
json_encode( |
|
|
|
[ |
|
|
|
[ |
|
|
|
'success' => \Yggverse\Net\Socket::isOpen($_GET['host'], $_GET['port'], 3) |
|
|
|
'success' => \Yggverse\Net\Socket::isOpen($host, $_GET['port'], 3) |
|
|
|
] |
|
|
|
] |
|
|
|
) |
|
|
|
) |
|
|
|
); |
|
|
|
); |
|
|
|