|
|
@@ -90,10 +90,10 @@ $gateway->onConnect = function ($connection) {
|
|
|
|
|
|
$_SESSION['remotip'] = isset($_SERVER['HTTP_X_REAL_IP']) ? $_SERVER['HTTP_X_REAL_IP'] : $connection->getRemoteIp();
|
|
|
// //从cdn中提取ip
|
|
|
- // $ips = getRealIp($_SERVER['HTTP_X_FORWARDED_FOR']);
|
|
|
- // if ($ips == '') { } else {
|
|
|
- // $_SESSION['remotip'] = $ips;
|
|
|
- // }
|
|
|
+ $ips = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']);
|
|
|
+ if (isset($ips[0]) && $ips[0]) { } else {
|
|
|
+ $_SESSION['remotip'] = $ips[0];
|
|
|
+ }
|
|
|
$_SESSION['remotport'] = $connection->getRemotePort();
|
|
|
$_SERVER['REMOTE_ADDR'] = $_SESSION['remotip'];
|
|
|
|
|
|
@@ -116,10 +116,3 @@ $gateway->onConnect = function ($connection) {
|
|
|
if (!defined('GLOBAL_START')) {
|
|
|
Worker::runAll();
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-function getRealIp($addr)
|
|
|
-{
|
|
|
- $ips = explode(',', $addr);
|
|
|
- return isset($ips[0]) ? $ips[0] : '';
|
|
|
-}
|