1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- <?php
- /*
- * Inserta los datos de un nuevo Menú. El orden es por default al último
- * Recibe:
- * desc - Descripción del menú
- * mostrar - Si se muestra en la barra o no
- * icono - Icono de FA
- * Error:
- * 0 - No se recibieron los datos
- * 1 - Error de base de datos
- * Success:
- */
- require_once("../include/constantes.php");
- require_once("../include/bd_pdo.php");
- $pag = "../menus.php";
- //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
- session_start();
- if(!$_SESSION["sgi_administrador"]){
- header("Location: main.php");
- exit();
- }
- unset($objValida);
- if(!isset($_POST["desc"]) || !isset($_POST["mostrar"], $_POST["sist"])){
- header("Location: ".$pag."?error=0");
- exit();
- }
- $desc = trim(filter_input(INPUT_POST, "desc", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $sist = filter_input(INPUT_POST, "sist", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- $mostrar = filter_input(INPUT_POST, "mostrar", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- //$mostrar = ($mostrar == 0 ? false : true);
- $icono = trim(filter_input(INPUT_POST, "icono", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $stmt = $pdo->prepare('Select * from fi_menu(:sist, :desc, :mostrar, :ico)');
- $stmt->bindParam(":sist", $sist);
- $stmt->bindParam(":desc", $desc);
- $stmt->bindParam(":mostrar", $mostrar);
- $stmt->bindParam(":ico", $icono);
- if(!$stmt->execute()){
- print_r($stmt->errorInfo());
- //header("Location:".$pag."?error=4&sist=".$sist);
- exit();
- }
- $rs = $stmt->fetch();
- $stmt->closeCursor();
- $stmt = null;
- header("Location: ".$pag."?ok=2&sist=".$sist);
- exit();
- ?>
|