/**
  * Checks to see if the user IP is allowed by {@link ipFilters}.
  * @param string $ip the user IP
  * @return boolean whether the user IP is allowed by {@link ipFilters}.
  */
 protected function allowIp($ip)
 {
     if (empty($this->ipFilters)) {
         return true;
     }
     $dbIpFilters = AllowedIp::model()->findAll(array('select' => 'ip_address'));
     foreach ($dbIpFilters as $dbIpFilter) {
         $this->ipFilters[] = $dbIpFilter->ip_address;
     }
     foreach ($this->ipFilters as $filter) {
         if ($filter === '*' || $filter === $ip || ($pos = strpos($filter, '*')) !== false && !strncmp($ip, $filter, $pos)) {
             return true;
         }
     }
     return false;
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return AllowedIp the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = AllowedIp::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
 public function actionHapusIp($id)
 {
     AllowedIp::model()->findByPk($id)->delete();
 }