public function actionLogin() { $email = ''; $password = ''; $user = new User(); if (isset($_POST['login_btn'])) { $email = $_POST['login_email']; $password = $_POST['login_password']; $errors = false; //Валидация полей if (!User::checkEmail($email)) { $errors[] = 'Неправильный Email'; } if (!User::checkPassword($password)) { $errors[] = 'Пароль не должен быть короче 6-ти символов'; } //Проверка существует ли пользователь $userId = $user->checkUserData($email, $password); $userProfile = $user->checkProfileData($userId); if ($userId == false) { $errors[] = 'Не верные данные для входа на сайт'; } else { $user->auth($userId); if ($userProfile == false) { header('Location: /user/profile'); } else { header('Location: /'); } } } require_once ROOT . '/views/user/login.php'; return true; }