예제 #1
0
 public function __construct($ip, $safeMode = TRUE)
 {
     parent::__construct();
     if ($ip == NULL) {
         $ip = Server::get('remote_addr');
     }
     if (!self::isIP($ip)) {
         throw new IllegalArgumentException();
     }
     if (!Validator::isBool($safeMode)) {
         throw new IllegalArgumentException();
     }
     if (self::isIPv4($ip)) {
         $this->ipCoded = ip2long($ip);
         $this->ipParted = explode('.', $ip);
     } else {
         $this->ipCoded = self::ip6pack($ip);
         $this->ipParted = explode(':', $ip);
     }
     $this->ipCountPart = count($this->ipParted);
     $this->safeMode = $safeMode;
 }
예제 #2
0
 public function __construct()
 {
     parent::__construct();
     $this->longOfIP = [];
     $this->myIp = new IPvU(Server::get('remote_addr'));
 }