Skip to content

Commit

Permalink
fix reading ip problem
Browse files Browse the repository at this point in the history
taoyu65 committed Aug 15, 2017

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 9d2ef75 commit 2a10834
Showing 2 changed files with 7 additions and 4 deletions.
4 changes: 3 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
#UMI Admin RBAC 后台管理系统
#UMI Admin RBAC 后台管理系统

> ```不同于其他后台管理, UMI Admin 可用于快速搭建后台 对于中小型后台甚至不用写任何代码```
English (https://github.com/taoyu65/UMIAdmin/blob/master/readme_ch.md)

7 changes: 4 additions & 3 deletions src/Http/Controllers/dashboardController.php
Original file line number Diff line number Diff line change
@@ -8,7 +8,6 @@
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cache;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Session;
use Illuminate\Support\Facades\Validator;
use YM\Models\User;

@@ -64,8 +63,10 @@ public function dashboard(Request $request)

#######################save ip information#######################
$ip = $_SERVER['REMOTE_ADDR'];//'98.176.248.193';//
$query = json_decode($this->curl_file_get_contents('http://ip-api.com/json/'.$ip));
if($query && $query->status == 'success') {
//$ip = file_get_contents('https://api.ipify.org');
//$query = json_decode(file_get_contents('http://ip-api.com/json/'.$ip));
$query = json_decode(file_get_contents("https://ipinfo.io/asdf/json"));
if(!isset($query->bogon) && !isset($query->error)) {
$country = $query->country;
$region = $query->region;
$city = $query->city;

0 comments on commit 2a10834

Please sign in to comment.