Ver Mensaje Individual
  #7 (permalink)  
Antiguo 22/11/2013, 13:48
Avatar de Ilidam
Ilidam
 
Fecha de Ingreso: julio-2009
Ubicación: Veracruz
Mensajes: 108
Antigüedad: 14 años, 9 meses
Puntos: 0
Respuesta: refrescar variable de sesion con ajax??

muchas gracias ya me funciono asi
dejo el codigo por si alguien le sirve
Código PHP:
Ver original
  1. <html>
  2.     <head>
  3.     <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  4.     <script language="JavaScript" src="http://code.jquery.com/jquery-1.10.2.min.js"></script>
  5.     <script type="text/javascript">if(typeof jQuery==='undefined'){document.write(unescape("<scri"+"pt src='js/jquery-1.3.2.min.js' type='text/javascript'></scri"+"pt>"));}</script>
  6.     <style>
  7.           html {  background-image: url(images/glowcolor.png); }
  8.      .alerta {
  9.      position: fixed; /* Le damos el valor Fixed para que flote */
  10.      background: #FFF; /* Color de fondo de la capa */
  11.     width: 100%;
  12.      height: 100%;
  13.      top: 0;
  14.      left: 0;
  15.      z-index: 999;
  16.      display:none;
  17.     }
  18.     .flota{
  19.      opacity:1.0; /* opacidad del 60% */
  20.      filter:alpha(opacity=100); /* Opacidad para IE8 y earlier */
  21.      background: rgba(255, 255, 255, 0.50); /* Color de fondo de la capa */
  22.      border-radius: 8px; /* Redondeado */
  23.      box-shadow: 0px 0px 0px 1px black, 5px 5px 14px black; /* Sombra exterior */
  24.      position:absolute;
  25.      left:50%;
  26.      top:50%;
  27.      margin-left:-112px;
  28.      margin-top:-70px;
  29.      width:224px;
  30.      height:140px;
  31.      z-index:1;
  32.      color:#000;
  33.    }
  34.  
  35.     .flota h2 {
  36.         margin:auto;
  37.         text-align:center;
  38.     }
  39.     .flota span {
  40.         text-align:center;
  41.         width:100%;
  42.         position:inherit;
  43.         margin-top:20%;
  44.         font-size:36px;
  45.     }
  46.  
  47.     .close{
  48.      position: absolute;
  49.      display: block;
  50.      top: 0;
  51.      right: 2;
  52.      cursor: pointer;
  53.      background: url(images/eliminar.png) 0px 0px no-repeat; /* Imagen del boton */
  54.      width: auto;
  55.      height: 30px;
  56.      overflow: hidden;
  57.     }
  58.     </style>
  59.     <script>
  60.         $(document).ready(function() {
  61.             $(".close").click(function(){ //Le decimos que al dar click en ".close"...
  62.                 $(".alerta").hide("slow"); //Oculte el contenedor ".overlay" lentamente(slow)
  63.                 window.clearInterval(mytime); // Delete interval
  64.                 $.ajax({ type: "GET",url: "expira.php" });
  65.                 display_c(120); // Redefine time for new session expire
  66.                 event.preventDefault(); // Anulamos el enlace...
  67.              });
  68.         });
  69.     </script>
  70.     <script type="text/javascript">
  71.     function display_c(start){
  72.     window.start = parseFloat(start);
  73.     var end = 0 // change this to stop the counter at a higher value
  74.     var refresh=1000; // Refresh rate in milli seconds
  75.     var timeShow = 119;
  76.     if(window.start >= end ){
  77.         if(window.start <= timeShow){
  78.             $(".alerta").show();
  79.         }
  80.         mytime=setTimeout('display_ct()',refresh)
  81.     }
  82.     else {
  83.        window.location="../login.html";
  84.     }
  85.     }
  86.  
  87.     function display_ct() {
  88.     // Calculate the number of days left
  89.     var days=Math.floor(window.start / 86400);
  90.     // After deducting the days calculate the number of hours left
  91.     var hours = Math.floor((window.start - (days * 86400 ))/3600)
  92.     // After days and hours , how many minutes are left
  93.     var minutes = Math.floor((window.start - (days * 86400 ) - (hours *3600 ))/60)
  94.     // Finally how many seconds left after removing days, hours and minutes.
  95.     var secs = Math.floor((window.start - (days * 86400 ) - (hours *3600 ) - (minutes*60)))
  96.  
  97.     var x = minutes + ":" + secs + " Minutos ";
  98.  
  99.  
  100.     document.getElementById('ct').innerHTML = x;
  101.     window.start = window.start - 1;
  102.  
  103.     tt=display_c(window.start);
  104.     }
  105.     function wait(time) {
  106.         setTimeout('display_ct()',refresh);
  107.     }
  108.     </script>
  109.     </head>
  110.     <body onload="display_c(120);">
  111.     HOLA
  112.     <div class="alerta" id="busca" ><!-- Mostrar div DURANTE 10 min de inactividad mientras este oculto-->
  113.         <div  class="flota" style=" width:397px; height:244px; ">
  114.             <div class="close">
  115.                 <a href="#">Cerrar</a>
  116.             </div>
  117.             <h2>La sessi&oacute;n caducara en </h2>
  118.     <span id='ct'></span>
  119.       </div>
  120.     </div>
  121.  
  122.     </body>
  123.     </html>