session_start(); if (!isset($_SESSION['cve_usuario'])) { header('Location:login.php'); return; } $noticia = new Noticia(); $count = NULL; if (isset($_POST['txtCveNoticia'])) { if ($_POST['txtCveNoticia'] != 0) { $noticia = new Noticia($_POST['txtCveNoticia']); } } if (isset($_POST['xAccion'])) { if ($_POST['xAccion'] == 'grabar') { $noticia->setCveReata($_SESSION['cve_usuario']); $noticia->setTipoEvento(1); // Tipo boletin $noticia->setTitulo($_POST['txtTitulo']); $noticia->setNoticiaCorta($_POST['txtNoticiaCorta']); $noticia->setNoticia($_POST['txtNoticia']); $noticia->setCveModifico($_SESSION['cve_usuario']); $noticia->setActivo(isset($_POST['cbxActivo']) ? 1 : 0); $count = $noticia->grabar(); } if ($_POST['xAccion'] == 'eliminar') { $noticia->borrar($_POST['txtCveNoticia']); } if ($_POST['xAccion'] == 'logout') { unset($_SESSION['cve_usuario']); unset($_SESSION['nombre']); header('Location:login.php');