function checkUser() { $user = $this->getSession()->get('user'); if (empty($user)) { $bag = new Bag(); $bag->set('loginerror', 'FORBIDDEN, you need to log in first!!!'); $this->redirect('admin'); } }
/** * This is the main function of the class * @return void */ function indexAction() { $post = $this->gPOST(); $signin = $post->signin; //check in db $OK = $this->validate($signin); if (!$OK) { $bag = new Bag(); $bag->set('loginerror', 'The email or password does not match the records.'); $this->redirect('admin'); } else { $this->redirect('dashboard'); } }