private function initLogin($username, $password)
 {
     $userModel = new User();
     $userId = $userModel->login($username, $password);
     Session::set('id', $userId);
     RouteService::redirect('users', 'profile');
 }
示例#2
0
 private function initLogin($user, $pass)
 {
     $userModel = new User();
     $userId = $userModel->login($user, $pass);
     $_SESSION['id'] = $userId;
     header("Location: profile");
 }
 public function initLogin($username, $password)
 {
     $userModel = new User($this->databaseInstance);
     $userId = $userModel->login($username, $password);
     $_SESSION = [];
     $_SESSION['id'] = $userId;
     header('Location: ../profile');
     exit;
 }
 private function initLogin($user, $pass)
 {
     $userModel = new User();
     $userInfo = $userModel->login($user, $pass);
     $_SESSION['id'] = $userInfo['id'];
     $_SESSION['username'] = $userInfo['username'];
     $_SESSION['cart'] = [];
     $role = $userModel->role($userInfo['id']);
     $_SESSION['role'] = $role['title'];
     // Change location, if user, admin or editor
     if ($role['title'] == 'admin') {
         Header('Location: ' . $this->directories . '/admin/dashboard');
     } else {
         if ($role['title'] == 'editor') {
         } else {
             Header('Location: ' . $this->directories . '/products/showAll');
         }
     }
 }