public function cookieLogin($agent) { //check agent,and if session does not exist. Then check if cookie exist, if exist try log in with cookie. if (!$this->sessionModel->CheckValidSession($agent) && $this->cookieView->cookieExist()) { $cookieString = $this->cookieView->load(); // check userModel if cookie is a valid cookie, if valid cookie set session with user agent. if ($this->loginModel->cookieLogin($cookieString, $agent)) { $userID = $this->loginModel->GetUserID(); $userName = $this->loginModel->getUsernameByUserID($userID); $this->sessionModel->SetUser($userName); } else { $this->loginView->failedCookieMSG(); $this->cookieView->deleteCookie(); } } }