diff --git a/src/Database/seeds/umi_field_display_add_seeder.php b/src/Database/seeds/umi_field_display_add_seeder.php index 5d75d11..496a219 100644 --- a/src/Database/seeds/umi_field_display_add_seeder.php +++ b/src/Database/seeds/umi_field_display_add_seeder.php @@ -1039,7 +1039,7 @@ public function run() 'id' => 80, 'table_id' => 16, 'field' => 'password', - 'type' => 'textBox', + 'type' => 'bcryptPassword', 'relation_display' => '', 'custom_value' => '', 'display_name' => '', diff --git a/src/Database/seeds/umi_field_display_edit_seeder.php b/src/Database/seeds/umi_field_display_edit_seeder.php index 4a93514..c43adbe 100644 --- a/src/Database/seeds/umi_field_display_edit_seeder.php +++ b/src/Database/seeds/umi_field_display_edit_seeder.php @@ -1247,7 +1247,7 @@ public function run() 'id' => 96, 'table_id' => 16, 'field' => 'password', - 'type' => 'textBox', + 'type' => 'bcryptPassword', 'relation_display' => '', 'custom_value' => '', 'display_name' => '', diff --git a/src/Http/Controllers/dashboardController.php b/src/Http/Controllers/dashboardController.php index 1c717e6..03c29e4 100644 --- a/src/Http/Controllers/dashboardController.php +++ b/src/Http/Controllers/dashboardController.php @@ -8,6 +8,7 @@ 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; @@ -62,12 +63,12 @@ public function dashboard(Request $request) if (Auth::attempt(['name' => $userName, 'password' => $password])) { #######################save ip information####################### - $ip = $_SERVER['REMOTE_ADDR']; - $query = @unserialize(file_get_contents('http://ip-api.com/php/'.$ip)); - if($query && $query['status'] == 'success') { - $country = $query['country']; - $region = $query['region']; - $city = $query['city']; + $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') { + $country = $query->country; + $region = $query->region; + $city = $query->city; $add = DB::table('ip_info')->insert([ 'user_name' => $userName, 'ip' => $ip, @@ -105,4 +106,14 @@ public function getRefresh() Cache::flush(); return redirect($url); } + + public function curl_file_get_contents($url){ + $ch = curl_init(); + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $r = curl_exec($ch); + curl_close($ch); + return $r; + } }