protected function input() { parent::input(); if (isset($param['logout'])) { $logout = $this->clear_int($param['logout']); if ($logout) { $this->ob_user->logout(); } } $this->ob_user = Model_User::get_instance(); $this->ob_model = Model::get_instance(); $this->title = 'Massage Practice | '; /// разбан через час $time_clean = time() - 3600 * UNBAN; $this->ob_user->clear_fail($time_clean); //проверяем неудачные попытки $ip = $_SERVER['REMOTE_ADDR']; $fail = $this->ob_user->get_fails($ip); $fail = $fail[0]['counter']; if (isset($_POST['auth_submit'])) { if ($fail < 3) { $login = $this->clear_str($_POST['auth_login']); $pass = $this->clear_str($_POST['auth_pass']); try { $id = $this->ob_user->check_user($login, $pass); //записываем id $this->user_id = $id; $this->ob_user->set(); $this->redirect(); } catch (AuthException $e) { if (!$fail) { $this->ob_user->first_fail($ip); } else { $this->ob_user->update_fail($ip, $fail); } } } else { try { throw new AuthException('Превышено число неправильных попыток! Повторите через 1 час'); } catch (AuthException $e) { $e->getMessage(); } } } if (isset($_COOKIE['NOU'])) { $id_update = $this->ob_user->unpackage(); $this->user_id = $id_update[0]; $this->i_user = $this->ob_user->get_user($this->user_id); } }