Foros del Web » Programando para Internet » PHP »

Duración de sesiones

Estas en el tema de Duración de sesiones en el foro de PHP en Foros del Web. Qué tal amigos, recurro a ustedes para que me ayuden con un problema que tengo. He creado una web en la cual manejo sesiones. La ...
  #1 (permalink)  
Antiguo 08/10/2011, 02:34
 
Fecha de Ingreso: septiembre-2011
Ubicación: Tabasco Mexico
Mensajes: 30
Antigüedad: 12 años, 7 meses
Puntos: 0
Duración de sesiones

Qué tal amigos, recurro a ustedes para que me ayuden con un problema que tengo.

He creado una web en la cual manejo sesiones. La web es para registrar accidentes ocurridos en determinado lugar. Para registrar un accidente, el usuario primero tiene que iniciar sesión (obviamente, jeje).

El problema resulta en que, el usuario a veces tarda en promedio 5 min en registrar un accidente, entonces, cuando intenta registrar, la sesión ya ha expirado y pide loguearse nuevamente.

He estado investigando y leyendo sobre sesiones, y he visto que hay que editar el archivo php.ini para prolongar el tiempo de la sesión, pero el problema es que la web la tengo hospedada en startlogic.com y no sé cómo poder editar el archivo tal (aunque, supongo que no es posible poder editar ese archivo si mi página está hospedada en un servidor no local).


Probé agregando a cada página que tiene el session_start() el siguiente código:
Código PHP:
<?php
ini_set
("session.gc_maxlifetime","7200");
session_start();
?>
y sigo teniendo el mismo problema.

Aquí pongo una página de muestra de cómo tengo todas las páginas

Código PHP:


<?php
ini_set
("session.gc_maxlifetime","7200");
session_start();
if(
$_SESSION["logeado"] != "SI"){ 
echo 
"Aceso denegado<br>";
echo 
'<A HREF="login.php">Ingresa aqu&iacute;.</A><BR>';
exit;

}
?>
<?

 $fecha
strftime("%Y")."-"strftime("%d")."-".  strftime("%m");

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html>
<head>
    
<title>Registro de incidencias</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>

</head>
<body>
    
        
        
        
        <div class="titulo">
            <h1>Registro de incidencias</h1>
        </div>
        
        
        <div class="contenido">                
                   
                    <form name="form1" method="post" action="incidencias1.php">
                        <table border="0">



    <!-- ******** -->                          
                           <tr>                              
                            <td style="float:right">Fecha: </td>
                            <td><input style="float:left" name="fecha"type="text" value="<?php echo $fecha;?>"maxlength="50" size="50" disabled readonly/></td>                        
                           </tr>
    
        <!-- ************ -->                          
                           <tr>                              
                            <td style="float:right">Otra sede: </td>
                            <td><input style="float:left" name="otrasede"type="text" maxlength="50" size="50" onKeyUp="this.value = this.value.toUpperCase();" /></td>                        
                           </tr>
     <!-- ************************************************************************************************************************************************* -->                         
                            <tr>
                                <td style="float:right">Nombre(*):</td>
                                <td><input  style="float:left" name="nombre" onKeyUp="this.value = this.value.toUpperCase();" type="Text" name="nombre_reporta" size="50" maxlength="100"</td><br>                                                              
                            </tr>

  <!-- ******** -->                            
                             
                             <tr>
                                <td style="float:right">Cargo:</td>
                                <td><input style="float:left" name="cargo" onKeyUp="this.value = this.value.toUpperCase();" type="Text" name="cargo" size="50" maxlength="100"</td><br>                                                              
                            </tr>

  <!-- ********** -->                            
                            <tr>
                                <td style="float:right">&Aacute;rea:</td>
                                <td><input style="float:left" name="area" onKeyUp="this.value = this.value.toUpperCase();" type="Text" name="area" size="50" maxlength="100"</td><br>                                                              
                            </tr>
   
 <!-- ******** -->                             
                            <tr>                              
                            <td style="float:right">Otra incicendia: </td>
                            <td><input style="float:left" name="otrainc"type="text" maxlength="50" size="50" onKeyUp="this.value = this.value.toUpperCase();" /></td>                        
                           </tr>

  <!-- ******** -->       
                     
                            <tr>
                                <td style="float:right">Descripci&oacute;n(*): </td>
                                <td> <textarea style="float:left" onKeyUp="this.value = this.value.toUpperCase();" name="descripcion" rows="5" cols="38"></textarea> </td>
                                <td> <input type="radio" name="estatus" value="PENDIENTE" checked onclick = "solucion.disabled = true; soluciono.disabled = true;" />Pendiente</td>
                                <td> <input type="radio" name="estatus" value="SOLUCIONADO" onclick = "solucion.disabled = !this.checked; soluciono.disabled = !this.checked;" />Solucionado</td>
                               

</td>
                                
                            </tr>
     
   <!-- ********* -->                           
                            <tr>
                                <td style="float:right">Soluci&oacute;n: </td>
                                <td> <textarea style="float:left" onKeyUp="this.value = this.value.toUpperCase();" name="solucion" rows="5" cols="38" disabled></textarea> </td>
                                
                            </tr>
    
 <!-- *********** -->                             
                            <tr>                              
                            <td style="float:right">Ocurri&oacute; el(*): </td>
                            <!--<td><input maxlenght="10" style="float:left" name="fecha_inc" type="text" id="dateArrival" onClick="popUpCalendar(this, form1.dateArrival, 'dd-mm-yyyy');" size="10" readonly/></td>-->
                            <td><input style="float:left" maxlenght="10" style="float:left" name="fecha_inc" type="text" id="dateArrival" onfocus="showCalendarControl(this);" size="10" readonly /></td>
                            <!--<td><input style="float: left"type="text" name="fecha_inc" value=" "maxlength="11" size="10" ></td>-->                        
                           </tr>

    <!-- *********** -->                          
                            <tr>                              
                            <td style="float:right">A las: </td>
                            <td><input style="float: left"type="text" name="hora" value=" "maxlength="6" size="10">(Formato en 24:00 hrs)</td>               <td</td>         
                           </tr>

  <!-- ********* -->                            
                            <tr>
                           
                            <td></td>
                            <td>                                
                                <input type="submit" name="registrar" id="registrar" value="Registrar"/>
                                <INPUT TYPE="RESET" name="limpiar" VALUE="Limpiar"/>
                            </td>
                            
                        </tr>

 <!-- ********** -->                             
                        </table>                      
                 </form>
                    
                    <form name="control" action="pendientes.php" method="post">
                        <table>
                            <tr>
                                <td></td>
                                <td></td>
                                <td><input type="submit" value="Buscar pendientes"/></td>
                            </tr>
                        </table>
                        
        
    </form>
   
        </div>
        
  

    
    
</body>
</html>
Algo similar a esto tengo en todas las páginas, en donde al principio el sistema verifica si el usuario está registrado.

Mi cuestión es ¿cómo prolongar la duración de la sesión al menos 30 min?

Les agradeceré mucho su ayuda.....
  #2 (permalink)  
Antiguo 08/10/2011, 07:41
Avatar de SirDuque  
Fecha de Ingreso: febrero-2009
Ubicación: Paso del Rey, Buenos Aires, Argentina
Mensajes: 975
Antigüedad: 15 años, 2 meses
Puntos: 89
Respuesta: Duración de sesiones

Hola ponte en contacto con tu hosting, en general brindan muchisimas herramientas, session() es una funcion utilizada por casi todos los programadores, y dudo que el hosting tenga limitado a tan poco tiempo.
Ponte en contacto!

Nota: En algun lugar tendras session_destroy() o session_unset();
__________________
Mono programando!
twitter.com/eguimariano
  #3 (permalink)  
Antiguo 08/10/2011, 10:42
Avatar de mcun  
Fecha de Ingreso: octubre-2010
Ubicación: tras la pantalla
Mensajes: 466
Antigüedad: 13 años, 6 meses
Puntos: 55
Respuesta: Duración de sesiones

fíjate en el manual

http://www.php.net/manual/es/ref.session.php

Etiquetas: html, registro, sesiones, usuarios
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 07:44.