123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <?php
- /*
- * Asigna pareja a participantes activos
- */
- require_once("../../include/constantes.php");
- require_once("../../include/bd_pdo.php");
- session_start();
- if(!isset($_SESSION["n_usuario_id"])){
- session_destroy();
- $pag = "../salir.php?expired=1";
- header("Location: ".$pag);
- exit();
- }
- $session_life = 1*60*60;//convertido a segundos
- if (isset($_SESSION["n_timeout"])) {
- // calculate the session's "time to live"
- $sessionTTL = time() - $_SESSION["n_timeout"];
- if ($sessionTTL > $session_life) {
- $_SESSION = array();
- session_destroy();
- $pag = $_SERVER['SERVER_NAME']."/navidad/salir.php?expired=1";
- header("Location: http://".$pag);
- exit();
- }
- }else{
- $_SESSION = array();
- session_destroy();
- $pag = $_SERVER['SERVER_NAME']."/navidad/salir.php?expired=1";
- header("Location: http://".$pag);
- exit();
- }
- $_SESSION["n_timeout"] = time();
- $pag = "../tarjeta.php";
- if(!isset($_POST["texto"]) || trim($_POST["texto"]) == ""){
- header("Location: ".$pag."?error=0");
- exit();
- }
- //$texto = nl2br(trim(filter_input(INPUT_POST, "texto", FILTER_SANITIZE_SPECIAL_CHARS,array('flags' => FILTER_FLAG_STRIP_LOW))));//limpia texto
- $texto = nl2br(htmlentities(trim($_POST["texto"]), ENT_QUOTES, "UTF-8"));//limpia texto
- //actualiza
- $stmt = $pdo->prepare('Select * from fu_navidadtarjeta(:de, :texto)');
- $stmt->bindParam(":de", $_SESSION["n_usuario_id"]);
- $stmt->bindParam(":texto", $texto);
- if(!$stmt->execute()){
- header("Location: ".$pag."?error=1");
- exit();
- }
- $stmt->closeCursor();
- header("Location: ../main.php?ok=0");
- ?>
|