public function login($email = null, $user_password = null) { //check if email exists in data base //check if password is set if ($this->find_by_email($email) && $user_password) { $this->_email = $email; $this->_password = $user_password; $this->_hash = $this->_data['password']; if (Encryption::checkPassword($this->_password, $this->_hash)) { //set the data in a session. $session = new SessionController(); $session->set('user_session', array("user_id" => $this->_data['id'], "name" => $this->_data['name'] . " " . $this->_data['lastname'])); return true; // RedirectController::to("/kortingennu/"); } } return false; }