Ejemplo n.º 1
0
 public function delete()
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['id'])) {
         session_destroy();
         header("Location:/");
         exit;
     }
     if (isset($_GET['id'])) {
         $model = Container::getClass($this->model);
         $model->delete($_GET['id']);
         header("Location:/artigos?deleteok=1");
         exit;
         //$this->render("delete");
     }
 }
Ejemplo n.º 2
0
 public function edit()
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     if (!isset($_SESSION['id'])) {
         session_destroy();
         header("Location:/");
         exit;
     }
     $model = Container::getClass($this->model);
     if (count($_POST)) {
         $model->save($_POST);
         $this->view->sucesso = true;
     }
     if (isset($_GET['id'])) {
         $this->view->dados = $model->find($_GET['id']);
     }
     $this->render("edit", false);
 }
Ejemplo n.º 3
0
 /**
  * Método / Action de Login
  */
 public function index()
 {
     $model = Container::getClass($this->model);
     $this->view->erro = false;
     if (count($_POST)) {
         $senha = md5(sha1(base64_encode($_POST['senha'])));
         $confirmaLogin = $model->_login($_POST['email'], $senha);
         if ($confirmaLogin['rows'] == 1) {
             if (!isset($_SESSION)) {
                 session_start();
             }
             $_SESSION['email'] = $confirmaLogin['fetch']['email'];
             $_SESSION['id'] = $confirmaLogin['fetch']['id'];
             $_SESSION['nome'] = $confirmaLogin['fetch']['nome'];
             header('location:/dashboard');
         } else {
             $this->view->erro = true;
         }
     }
     $this->render("index");
 }
Ejemplo n.º 4
0
 public function enviosenha()
 {
     $model = Container::getClass($this->model);
     if (isset($_GET['id'])) {
         $this->view->usuario = $model->find($_GET['id']);
     }
     $this->render("enviosenha");
 }