12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849 |
- <?php
- /*
- * Actualiza los datos del sistema
- * Recibe:
- * id - ID del menú a editar
- * desc - Descripción del menú
- * nombre
- * pagina base
- */
- require_once("../include/constantes.php");
- require_once("../include/bd_pdo.php");
- $pag = "../sistemas.php";
- session_start();
- //--- Valida que el usuaro tenga permisos de superadministrador
- if(!$_SESSION["sgi_administrador"]){
- header("Location: main.php");
- exit();
- }
- if(!isset($_POST["desc"]) || !isset($_POST["nombre"]) || !isset($_POST["pag"])){
- header("Location: ".$pag."?error=0");
- exit();
- }
- $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- $desc = trim(filter_input(INPUT_POST, "desc", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $nombre = trim(filter_input(INPUT_POST, "nombre", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $pag_base = trim(filter_input(INPUT_POST, "pag", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $stmt = $pdo->prepare('Select * from fu_sistema(:id, :nombre, :desc, :pag)');
- $stmt->bindParam(":id", $id);
- $stmt->bindParam(":nombre", $nombre);
- $stmt->bindParam(":desc", $desc);
- $stmt->bindParam(":pag", $pag_base);
- if(!$stmt->execute()){
- header("Location:".$pag."?error=2");
- exit();
- }
- $stmt->closeCursor();
- $stmt = null;
- header("Location: ".$pag."?ok=1");
- exit();
- ?>
|