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"); } }
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); }
/** * 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"); }
public function enviosenha() { $model = Container::getClass($this->model); if (isset($_GET['id'])) { $this->view->usuario = $model->find($_GET['id']); } $this->render("enviosenha"); }