1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- <?php
- /*
- * Inserta los datos del nuevo sistema
- * Recibe:
- * desc - Descripción
- * nombre
- * pag
- */
- 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();
- }
- $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 fi_sistema(:nom, :desc, :pag)');
- $stmt->bindParam(":nom", $nombre);
- $stmt->bindParam(":desc", $desc);
- $stmt->bindParam(":pag", $pag_base);
- if(!$stmt->execute()){
- //print_r($stmt->errorInfo());
- header("Location:".$pag."?error=1");
- exit();
- }
- $rs = $stmt->fetch();
- $stmt->closeCursor();
- $stmt = null;
- header("Location: ".$pag."?ok=0");
- exit();
- ?>
|