From 0e6afef0bee86105389c759f81360dbc80ac7185 Mon Sep 17 00:00:00 2001 From: thinkphp Date: Tue, 22 Dec 2015 08:05:34 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8E=BB=E6=8E=89get=5Fclient=5Fip=E8=B0=83?= =?UTF-8?q?=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- library/org/oauth/driver/tencent.php | 2 +- library/traits/model/auto.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/library/org/oauth/driver/tencent.php b/library/org/oauth/driver/tencent.php index 2afa2d2c..d72df952 100644 --- a/library/org/oauth/driver/tencent.php +++ b/library/org/oauth/driver/tencent.php @@ -47,7 +47,7 @@ class Tencent extends Driver 'oauth_consumer_key' => $this->AppKey, 'access_token' => $this->token['access_token'], 'openid' => $this->openid(), - 'clientip' => get_client_ip(), + 'clientip' => $_SERVER['REMOTE_ADDR'], 'oauth_version' => '2.a', 'scope' => 'all', 'format' => 'json', diff --git a/library/traits/model/auto.php b/library/traits/model/auto.php index dabc85c7..a52038ab 100644 --- a/library/traits/model/auto.php +++ b/library/traits/model/auto.php @@ -361,9 +361,9 @@ trait Auto } return NOW_TIME >= $start && NOW_TIME <= $end; case 'ip_allow': // IP 操作许可验证 - return in_array(get_client_ip(), explode(',', $rule)); + return in_array($_SERVER['REMOTE_ADDR'], explode(',', $rule)); case 'ip_deny': // IP 操作禁止验证 - return !in_array(get_client_ip(), explode(',', $rule)); + return !in_array($_SERVER['REMOTE_ADDR'], explode(',', $rule)); case 'filter': // 使用filter_var验证 $result = filter_var($value, is_int($rule) ? $rule : filter_id($rule)); return false === $result ? false : true;