Exemple #1
0
 public function whiteCheck($client = '')
 {
     $client = $client ? $client : $this->client;
     // 先检查全局白名单设置
     $whiteIP = Common::getConfig('white_ip', $this->config);
     $whiteUA = Common::getConfig('white_ua', $this->config);
     // IP白名单
     if (Common::checkIP($client['ip'], $whiteIP)) {
         $this->resultMsg = 'White IP list';
         $this->Log->info(__METHOD__, 'The client ip[' . $client['ip'] . '] was in white IP list');
         return true;
     }
     // UA白名单
     if (Common::checkUA($client['ua'], $whiteUA, Common::getConfig('white_ua_ignore_case', $this->config), Common::getConfig('white_ua_dns_reverse', $this->config), $client['ip'])) {
         $this->resultMsg = 'White UA list';
         $this->Log->info(__METHOD__, 'The client ua[' . $client['ua'] . '] was in white ua list');
         return true;
     }
     // 实时白名单
     if ($this->Model->isWhite($client)) {
         $this->resultMsg = 'Client in temporary white list';
         $this->Log->info(__METHOD__, 'The client session[' . $client['session'] . '] was in temporary white list');
         return true;
     } else {
         return false;
     }
 }