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