示例#1
0
}
$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');
        return;
    }
}
$sql = "SELECT * FROM noticias ORDER BY cve_noticia DESC";
示例#2
0
<?php

require "funciones.php";
$bd = new BaseDeDatos();
$bd->setConexion();
$cadena = new Cadena($_FILES['fotoN']['name']);
// Limpio el nombre con el objeto Cadena
$cadena2 = new Cadena($_FILES['fotoN']['tmp_name']);
// Limpio el nombre temporal con el objeto Cadena
$tamano = $_FILES['fotoN']['size'] / 1000 . ' kb';
// Obtengo el tamaño de la imagen
$imagen = new Imagen('', $cadena->limpiar(), $cadena2->limpiar(), '../photos/thumb_', $tamano);
$imagen->redimensionar(200, 165);
$noticia = new Noticia('');
$noticia->setNoticia($_POST['tituN'], $_POST['descN'], '../photos/thumb_' . $cadena->limpiar());