|
@@ 43-45 (lines=3) @@
|
| 40 |
|
} |
| 41 |
|
|
| 42 |
|
private static function locateDevice1() { |
| 43 |
|
if (CONFIG['GEOIP']['version'] != 1) { |
| 44 |
|
return ['status' => 'error', 'error' => 'Function for GEOIPv1 called, but config says this is not the version to use!']; |
| 45 |
|
} |
| 46 |
|
//$host = $_SERVER['REMOTE_ADDR']; |
| 47 |
|
$host = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); |
| 48 |
|
$record = geoip_record_by_name($host); |
|
@@ 68-70 (lines=3) @@
|
| 65 |
|
* @return array |
| 66 |
|
*/ |
| 67 |
|
private static function locateDevice2() { |
| 68 |
|
if (CONFIG['GEOIP']['version'] != 2) { |
| 69 |
|
return ['status' => 'error', 'error' => 'Function for GEOIPv2 called, but config says this is not the version to use!']; |
| 70 |
|
} |
| 71 |
|
require_once CONFIG['GEOIP']['geoip2-path-to-autoloader']; |
| 72 |
|
$reader = new Reader(CONFIG['GEOIP']['geoip2-path-to-db']); |
| 73 |
|
$host = filter_input(INPUT_SERVER, 'REMOTE_ADDR', FILTER_VALIDATE_IP); |