12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /*
- * Inserta los datos de rol
- * Recibe:
- * desc - Descripción
- * sist
- * icono
- * 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 = "../roles.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();
- }
- if(!isset($_POST["desc"]) || !isset($_POST["id"])){
- header("Location: ".$pag."?error=0");
- exit();
- }
- $desc = trim(filter_input(INPUT_POST, "desc", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $icono = trim(filter_input(INPUT_POST, "icono", FILTER_SANITIZE_STRING,array('flags' => FILTER_FLAG_STRIP_LOW)));//limpia texto
- $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- $sist = filter_input(INPUT_POST, "sist", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- $stmt = $pdo->prepare('Select * from fu_rolusuario(:id, :desc)');
- $stmt->bindParam(":desc", $desc);
- $stmt->bindParam(":id", $id);
- if(!$stmt->execute()){
- //print_r($stmt->errorInfo());
- header("Location:".$pag."?error=5");
- exit();
- }
- /*
- $log = new LogActividad();
- $desc_log = "Actualiza rol ID[".$id."] Nombre[".$desc."] Sist[".$sist."] Icono[".$icono."]";
- $log->appendLog($_SESSION["usuario_id"], $_SESSION["usuario_nombre"]." ".$_SESSION["usuario_apellidos"], $desc_log);*/
- header("Location: ".$pag."?ok=1");
- ?>
|