1234567891011121314151617181920212223242526272829303132333435 |
- <?php
- /*
- * Borra un grupo
- * Recibe:
- * id - ID del sistema a borrar
- */
- require_once("../include/constantes.php");
- require_once("../include/bd_pdo.php");
- //--- Objeto para validar usuario. El id de usuario lo lee desde sesión
- session_start();
- //--- Valida que el usuaro tenga permisos de superadministrador
- if(!$_SESSION["sgi_administrador"]){
- header("Location: main.php");
- exit();
- }else if(!isset($_POST["id"])){
- $return["error"] = "Error! No se recibió la información de la carrera.";
- }else{
- $id = filter_input(INPUT_POST, "id", FILTER_SANITIZE_NUMBER_INT);//limpia texto
- $stmt = $pdo->prepare('Select * from fd_sistema(:id)');
- $stmt->bindParam(":id", $id);
- if(!$stmt->execute()){
- $return["error"] = "Ocurrió un error al borrar los datos del sistema";
- }else{
- $stmt->closeCursor();
- $stmt = null;
- $return["ok"] = "El sistema se borró con éxito.";
- }
- }
- $return["json"] = json_encode($return);
- echo json_encode($return);
- ?>
|