public function validateAction() { $fc = FrontController::getInstance(); $model = new UserTableModel(); $model->setTable('user'); if (empty($fc->getParams()['email']) && empty($fc->getParams()['key'])) { header('Location: /'); exit; } $model->setValidateUserData($fc->getParams()); if ($model->checkValidKey()) { $output = $model->render('../views/user/validate.php', 'withoutSliderAndSidebarAndFooter'); $fc->setPage($output); } else { Session::setMsg('Невозможно активировать данный аккаунт. Пожалуйста зарегистрируйтесь заново', 'warning'); header('Location: /user/login'); exit; } }
public function loginAction() { $fc = FrontController::getInstance(); $model = new UserTableModel(); if ($_SERVER['REQUEST_METHOD'] === 'POST') { $model->setTable('user'); $model->setData(); $model->login(); header('Location: /admin'); } else { if ($_SESSION['user_id']) { header('Location: /admin'); } $output = $model->render('../views/admin/login.php', 'other'); $fc->setPage($output); } }