Skip to content

Commit

Permalink
If ip is not valid or in a private range, set country to unknown.
Browse files Browse the repository at this point in the history
This implies and else statement to get a country if the ip is valid and
not in a private range.
  • Loading branch information
jorianvo committed Jun 18, 2015
1 parent 71d2f16 commit c5609b2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/log.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@ public static function sendToStatsd($path,$action){
// Ip can be invalid or a local address, if so set country to unknown
// Otherwise we can go ahead and resolv country
if (!filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_NO_PRIV_RANGE)) {
$country = "unknown";
$country = "Unknown";
} else {
// As filtering the private range works only for ipv4 we can still get no
// location from the db, this case is handled by the IpToCountry method
$country = self::IpToCountry($ip);
}

// As filtering the private range works only for ipv4 we can still get no
// location from the db, this case is handled by the IpToCountry method
$country = self::IpToCountry($ip);

//throw new \Exception("country of origin = $country");

// Check if file is read or written
Expand Down

0 comments on commit c5609b2

Please sign in to comment.