From 90d1a4c38fc5f55eef35487fb46984de1c4ab158 Mon Sep 17 00:00:00 2001 From: humano Date: Thu, 12 Jul 2018 18:37:02 -0500 Subject: [PATCH] solucion parcial bug de cerrar session --- funciones/conex.php | 11 +++++++++-- js/scripts.js | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/funciones/conex.php b/funciones/conex.php index 9790660..fcbe03b 100644 --- a/funciones/conex.php +++ b/funciones/conex.php @@ -22,12 +22,16 @@ function Conectarse(){ exit(); } */ + $timestamp =time(); $_SESSION['path']= $path_instalacion; $_SESSION['path_images_secure']= $path_images_secure; $_SESSION['url']= $url; $_SESSION['site']= $site; $_SESSION['analizador']= "$codigo_analizador"; $_SESSION['upload_size']= $upload_size; + + $_SESSION['timestamp']= $timestamp; + return $link; } } @@ -54,13 +58,16 @@ function Conectarse_recursivo(){ exit(); } */ + $timestamp =time(); + $_SESSION['path']= $path_instalacion; $_SESSION['path_images_secure']= $path_images_secure; $_SESSION['url']= $url; $_SESSION['site']= $site; $_SESSION['analizador']= "$codigo_analizador"; - $_SESSION['upload_size']= $upload_size; + $_SESSION['timestamp']= $timestamp; + setcookie("timestamp",$timestamp); return $link; } } -?> \ No newline at end of file +?> diff --git a/js/scripts.js b/js/scripts.js index f40910c..ac9f828 100644 --- a/js/scripts.js +++ b/js/scripts.js @@ -1,3 +1,36 @@ + function revisarSession(){ + tiempo = "30"; + gavela="19"; + timestamp = Math.round(Date.now() /1000) + inicio = leerCookie("timestamp"); + transcurrido = (timestamp - inicio); + transcurrido_minutos = Math.round(transcurrido/60); + restante = (tiempo - transcurrido_minutos) + prefin = (tiempo*60)-transcurrido + + document.form_session.tiempo_session.value = "Cerrar en: "+restante+" minutos "; + + if(restante == 1 ){ + //alert(transcurrido); + location.href="./includes/salir.php"; +}else{ + setTimeout("revisarSession()",2000) ; +} +} + + +function leerCookie(nombre) { + var lista = document.cookie.split(";"); + for (i in lista) { + var busca = lista[i].search(nombre); + if (busca > -1) {micookie=lista[i]} + } + var igual = micookie.indexOf("="); + var valor = micookie.substring(igual+1); + return valor; + } + + function loadArticle(pageNumber,id,plantilla,registros,scroll) { var newDiv = document.createElement('div');