Subversion Repositories f9daq

Rev

Rev 193 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 193 Rev 318
Line 6... Line 6...
6
 
6
 
7
        $ipcheck = ip2long($ip);
7
        $ipcheck = ip2long($ip);
8
        if($ipcheck == -1 || $ipcheck === false)
8
        if($ipcheck == -1 || $ipcheck === false)
9
          trigger_error('Invalid IP, what are you doing? :|', E_USER_ERROR);
9
          trigger_error('Invalid IP, what are you doing? :|', E_USER_ERROR);
10
        else
10
        else
11
 
-
 
-
 
11
          $key='482198dbcb57d1747babb7acebc5c02e';
12
          $uri = 'http://freegeoip.net/json/' . $ip;
12
          $uri = 'http://api.ipstack.com/' . $ip . '?access_key=' . $key . '&output=json&legacy=1';
13
        $json = file_get_contents($uri);
13
        $json = file_get_contents($uri);
14
        $data = json_decode($json, true);
14
        $data = json_decode($json, true);
15
        $location   = $data['country_name'];
15
        $location   = $data['country_name'];
16
        $longitude  = $data['longitude'];
16
        $longitude  = $data['longitude'];
17
        $latitude   = $data['latitude'];
17
        $latitude   = $data['latitude'];