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

hola buenas tardes estoy trabajando con sesiones asta ahora ya e iniciado la variable de sesion y la cuenta regresiva en cierto tiempo despues de entrar al sistema
lo que kiero sabes es como refrescar la variable de sesion por ejemplo cuando se activa la cuenta regresiva si llega a cero k me mande a la pagina de logueo y si lo cancelo que se refreque la sesion mi codigo asta ahora es este
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="js/jquery-1.5.1.min.js"></script>
  5. <style>
  6.   html {  background-image: url(images/glowcolor.png); }
  7.  .alerta {
  8.  position: fixed; /* Le damos el valor Fixed para que flote */
  9.  background: rgba(255, 255, 255, 0.50); /* Color de fondo de la capa */
  10.  width: 100%;
  11.  height: 100%;
  12.  top: 0;
  13.  left: 0;
  14.  z-index: 999;
  15. }
  16. .flota{
  17.  background: white; /*Color de fondo del contenedor*/
  18.  border-radius: 2px; /* Redondeado */
  19. box-shadow: 0px 0px 0px 1px black, 5px 5px 14px black; /* Sombra exterior */
  20.  z-index: 9999;
  21.  
  22.     position:absolute;
  23.     left:428px;
  24.     top:182px;
  25.     width:223px;
  26.     height:138px;
  27.     z-index:1;
  28. }
  29.  
  30. .close1{
  31.  position: absolute;
  32.  display: block;
  33.  top: -15px;
  34.  right: -15px;
  35.  cursor: pointer;
  36.  background: url(images/eliminar.png) 0px 0px no-repeat; /* Imagen del boton */
  37.  width: 30px;
  38.  height: 30px;
  39.  overflow: hidden;
  40.  text-indent: -9999px;
  41. }
  42. </style>
  43. <script>
  44. $(document).ready(function() {
  45.     setTimeout(function() {
  46.         $(".alerta").fadeIn(1000);
  47.     },5000);
  48. });
  49.  
  50.     $(document).ready(function() {
  51.  $(".close1").click(function(){ //Le decimos que al dar click en ".close"...
  52.     $(".alerta").hide("drop"); //Oculte el contenedor ".overlay" lentamente(slow)
  53.   event.preventDefault(); // Anulamos el enlace...
  54.  });
  55. });
  56.  
  57. </script>
  58.  
  59. <script type="text/javascript">
  60.  function display_c(start){
  61. window.start = parseFloat(start);
  62. var end = 0 // change this to stop the counter at a higher value
  63. var refresh=1000; // Refresh rate in milli seconds
  64. if(window.start >= end ){
  65. mytime=setTimeout('display_ct()',refresh)
  66. }
  67. else {
  68.     window.location="../login.html";
  69. }
  70. }
  71.  
  72. function display_ct() {
  73. // Calculate the number of days left
  74. var days=Math.floor(window.start / 86400);
  75. // After deducting the days calculate the number of hours left
  76. var hours = Math.floor((window.start - (days * 86400 ))/3600)
  77. // After days and hours , how many minutes are left
  78. var minutes = Math.floor((window.start - (days * 86400 ) - (hours *3600 ))/60)
  79. // Finally how many seconds left after removing days, hours and minutes.
  80. var secs = Math.floor((window.start - (days * 86400 ) - (hours *3600 ) - (minutes*60)))
  81.  
  82. var x = minutes + ":" + secs + " Minutos ";
  83.  
  84.  
  85. document.getElementById('ct').innerHTML = x;
  86. window.start= window.start- 1;
  87.  
  88. tt=display_c(window.start);
  89. }
  90.  
  91. setTimeout(document.getElementById('busca').style.display = 'inline',10);//aki puse esto
  92. </script>
  93.  
  94. </head>
  95. <body onload="display_c(124);">
  96. HOLA
  97. <div class="alerta" id="busca" style="display:none"><!-- Mostrar div DURANTE 10 min de inactividad mientras este oculto-->
  98.     <div  class="flota" style=" width:397px; height:244px; ">
  99.         <div class="close1">
  100.             <a href="#">Cerrar</a>
  101.         </div>
  102.             <center>
  103.                 <br><br><br>
  104.                 EL SISTEMA SE CERRARA POR SEGURIDAD EN
  105.                 <br><br>
  106.                 <span id='ct'></span>
  107.                 <br><br>
  108.                 CANCELAR OPERACION
  109.                 <input type="submit" value="CONTINUAR">
  110.  
  111.             </center>
  112.   </div>
  113. </div>
  114. </body>
  115. </html>