function login() { $email = $_POST['login_email']; $password = $_POST['login_password']; $id = User::getIdByEmail($email); if (!User::loginIsValid($email, md5($password))) { throw new Exception("Error when loggin in user."); } if (!User::accountIsActivated($id)) { echo "Your account has not yet been activated. Click \r\n\t\t\tthe link in the confirmation email which was sent to your email account when you registered"; return; } $this->session->set_userdata('userid', $id); redirect('/main'); }