correciones en tiempo de session

This commit is contained in:
humano 2020-03-17 11:01:12 -05:00
parent 4cad68cc3a
commit 6c47a5da23
3 changed files with 24 additions and 24 deletions

View File

@ -1,5 +1,6 @@
<?php <?php
function Conectarse(){ function Conectarse(){
session_start();
if ( !isset ( $link ) ) { if ( !isset ( $link ) ) {
@include("includes/datos.php"); @include("includes/datos.php");

View File

@ -211,7 +211,7 @@ legend.legend-area {
</style> </style>
</head> </head>
<body onload="revisarSession()"; > <body >
<?php if($embebido ==1) { <?php if($embebido ==1) {
if($form!=''){ echo formulario_embebido($form,$opciones);} if($form!=''){ echo formulario_embebido($form,$opciones);}
elseif($identificador !='') { echo mostrar_identificador($identificador,$id);} elseif($identificador !='') { echo mostrar_identificador($identificador,$id);}
@ -256,13 +256,14 @@ else{}
<div class='row'> <div class='row'>
<div id='' class='col-sm-6'> <div id='' class='col-sm-6'>
<?php if(isset($_SESSION['id'])){ echo " <?php /* $sesion = "<pre>".print_r($_SESSION,true)."</pre>"; if(isset($_SESSION['id'])){ echo "
<form id='manejo_sesion' name='form_session' class='navbar-form navbar-left'> $sesion <form id='manejo_sesion' name='form_session' class='navbar-form navbar-left'>
<div class='input-group'> <div class='input-group'>
<input type='text' name='tiempo_session' size='18' class='form-control input-sm' readonly> <input type='text' name='tiempo_session' size='18' class='form-control input-sm' readonly>
<span class='input-group-addon'><a href='#' onclick=\"location.reload();\" title='Renovar'><span class='glyphicon glyphicon-refresh' aria-hidden='true'></span></a></span> <span class='input-group-addon'><a href='#' onclick=\"location.reload();\" title='Renovar'><span class='glyphicon glyphicon-refresh' aria-hidden='true'></span></a></span>
</div> </div>
</form> "; } ?> </form> "; }else{ echo "/ $sesion /<input type='text' name='tiempo_session' size='18' class='form-control input-sm' readonly>";}
*/ ?>
<?php <?php
///echo adjuntar_basico('33'); ///echo adjuntar_basico('33');

View File

@ -10,23 +10,24 @@ function delayTimer() {
function revisarSession(){ function revisarSession(sesion){
tiempo = "30"; tiempo = "30";
gavela="19"; gavela="19";
timestamp = Math.round(Date.now() /1000) timestamp = Math.round(Date.now() /1000)
inicio = leerCookie("timestamp"); inicio = sesion;//leerCookie("timestamp");
transcurrido = (timestamp - inicio); transcurrido = (timestamp - inicio);
transcurrido_minutos = Math.round(transcurrido/60); transcurrido_minutos = Math.round(transcurrido/60);
restante = (tiempo - transcurrido_minutos); restante = (tiempo - transcurrido_minutos);
prefin = (tiempo*60)-transcurrido; prefin = (tiempo*60)-transcurrido;
//sesion = "hola";
document.form_session.tiempo_session.value = "Cierra en: "+restante+" minutos "; document.form_session.tiempo_session.value = "Cierra en: "+restante+" minutos ("+transcurrido+" "+sesion+") ";
if(restante == 1 ){ if(restante == 1 ){
//alert(transcurrido); //alert(transcurrido);
location.href="../../salir.php"; location.href="../../salir.php";
}else{ }else{
setTimeout("revisarSession()",2000) ; setTimeout("revisarSession("+sesion+")",2000) ;
} }
} }
@ -622,6 +623,3 @@ else if (document.all) document.all[''+id+''].style.visibility = "hidden"
else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden" else if (document.getElementById) document.getElementById(''+id+'').style.visibility = "hidden"
} }
} }