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();
?>
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í.</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">Á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ó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ó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ó 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>
Mi cuestión es ¿cómo prolongar la duración de la sesión al menos 30 min?
Les agradeceré mucho su ayuda.....