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 }
Rsi\Fred\User\Authenticator\GeoIp\$countries
$countries
Allowed country codes (ISO 3166-1 alpha-2).
Definition: GeoIp.php:7
Rsi\Fred\User\Authenticator\GeoIp\check
check()
Perform the check.
Definition: GeoIp.php:9
Rsi\Fred\User\Authenticator\GeoIp
Definition: GeoIp.php:5
Rsi\Fred\Component\component
component($name)
Get a component (local or default).
Definition: Component.php:81
Rsi\Fred\User\Authenticator
Definition: GeoIp.php:3