Admin_LoginController::protect PHP Метод

protect() защищенный Метод

protected protect ( )
    protected function protect()
    {
        $user = $this->getParam("username");
        $data = $this->readLogFile();
        $matchesIpOnly = 0;
        $matchesUserOnly = 0;
        $matchesUserIp = 0;
        foreach ($data as $login) {
            $matchIp = false;
            $matchUser = false;
            if ($login[0] > time() - 300) {
                if ($user && $login[2] == $user) {
                    $matchesUserOnly++;
                    $matchUser = true;
                }
                if ($login[1] == Tool::getAnonymizedClientIp()) {
                    $matchesIpOnly++;
                    $matchIp = true;
                }
                if ($matchIp && $matchUser) {
                    $matchesUserIp++;
                }
            }
        }
        if ($matchesIpOnly > 49 || $matchesUserOnly > 9 || $matchesUserIp > 4) {
            $m = "Security Alert: Too many login attempts , please wait 5 minutes and try again.";
            Logger::crit($m);
            die($m);
        }
    }