Example #1
0
 public function logout()
 {
     if (Session::loggedIn()) {
         if (Session::rememberMe()) {
             Session::unsetRememberMeFlag();
             Cookie::unsetRememberMeCookies("", "", -60);
         }
         Session::unsetLoggedIn();
         session_unset();
     }
     header("Location: /");
 }
Example #2
0
 public function index()
 {
     if (Session::loggedIn()) {
         $this->template("header", ["title" => App::NAME, "subtitle" => App::TAGLINE, "categories" => ArticleCategory::getObjsAll()]);
         // $this->template("hero", ["title" => "News"]);
         $this->view("account/index", ["user" => User::getObjByEmail(Session::getUsername())]);
         //$this->jq("account/index");
         $this->template("footer");
     } else {
         header("Location: /");
     }
 }
Example #3
0
 public function __construct()
 {
     if (ENVIRONMENT == 'development') {
         new GenModels();
     }
     session_start();
     $this->router = new Router();
     if (!Session::loggedIn() && null !== Cookie::getUsername() && null !== Cookie::getAuthKey()) {
         $user = User::getObjByAuthKey(Cookie::getAuthKey());
         if (isset($user) && $user->getEmail() == Cookie::getUsername()) {
             Session::setUsername($user->getEmail());
             Session::setRememberFlag(true);
             Cookie::setRememberMeCookies($user->getEmail(), $user->getAuthKey());
         }
     }
 }