@@ -19,10 +19,12 @@ discard block |
||
| 19 | 19 | if (filter_var($ip, FILTER_VALIDATE_IP) === FALSE) { |
| 20 | 20 | $ip = $_SERVER["REMOTE_ADDR"]; |
| 21 | 21 | if ($deep_detect) { |
| 22 | - if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) |
|
| 23 | - $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
| 24 | - if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) |
|
| 25 | - $ip = $_SERVER['HTTP_CLIENT_IP']; |
|
| 22 | + if (filter_var(@$_SERVER['HTTP_X_FORWARDED_FOR'], FILTER_VALIDATE_IP)) { |
|
| 23 | + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |
|
| 24 | + } |
|
| 25 | + if (filter_var(@$_SERVER['HTTP_CLIENT_IP'], FILTER_VALIDATE_IP)) { |
|
| 26 | + $ip = $_SERVER['HTTP_CLIENT_IP']; |
|
| 27 | + } |
|
| 26 | 28 | } |
| 27 | 29 | } |
| 28 | 30 | $purpose = str_replace(array("name", "\n", "\t", " ", "-", "_"), NULL, strtolower(trim($purpose))); |
@@ -58,10 +60,12 @@ discard block |
||
| 58 | 60 | break; |
| 59 | 61 | case "address": |
| 60 | 62 | $address = array($ipdat->geoplugin_countryName); |
| 61 | - if (@strlen($ipdat->geoplugin_regionName) >= 1) |
|
| 62 | - $address[] = $ipdat->geoplugin_regionName; |
|
| 63 | - if (@strlen($ipdat->geoplugin_city) >= 1) |
|
| 64 | - $address[] = $ipdat->geoplugin_city; |
|
| 63 | + if (@strlen($ipdat->geoplugin_regionName) >= 1) { |
|
| 64 | + $address[] = $ipdat->geoplugin_regionName; |
|
| 65 | + } |
|
| 66 | + if (@strlen($ipdat->geoplugin_city) >= 1) { |
|
| 67 | + $address[] = $ipdat->geoplugin_city; |
|
| 68 | + } |
|
| 65 | 69 | $output = implode(", ", array_reverse($address)); |
| 66 | 70 | break; |
| 67 | 71 | case "city": |
@@ -45,13 +45,11 @@ |
||
| 45 | 45 | if (preg_match("/^[\d]+\.[\d]+(?:\.[\d]{0,2}$)?/",$ua_array[4],$matches)) |
| 46 | 46 | { |
| 47 | 47 | $return['version'] = $matches[0]; |
| 48 | - } |
|
| 49 | - else |
|
| 48 | + } else |
|
| 50 | 49 | { |
| 51 | 50 | $return['version'] = $ua_array[4]; |
| 52 | 51 | } |
| 53 | - } |
|
| 54 | - else |
|
| 52 | + } else |
|
| 55 | 53 | { |
| 56 | 54 | return false; |
| 57 | 55 | } |