FRED™  3.0
FRED™: Framework for Rapid and Easy Development
GeoIp.php
Go to the documentation of this file.
1 <?php
2 
4 
5 class GeoIp extends \Rsi\Fred\User\Authenticator{
6 
7  public $countries = []; //!< Allowed country codes (ISO 3166-1 alpha-2).
8 
9  public function check(){
10  $info = $this->component('services')->geoIp($this->component('security')->remoteAddr);
11  return $info && in_array($info['countryCode'],array_map('strtoupper',$this->countries));
12  }
13 
14 }
$countries
Allowed country codes (ISO 3166-1 alpha-2).
Definition: GeoIp.php:7
component($name)
Get a component (local or default).
Definition: Component.php:80