Hidek1...
este es el html que contiene el form
Código PHP:
<?php
session_start();
//antes de hacer los cálculos, compruebo que el usuario está logueado
//utilizamos el mismo script que antes
if ($_SESSION["autentificado"] != "SI") {
//si no está logueado lo envío a la página de autentificación
header("Location: index.html");
} else {
//sino, calculamos el tiempo transcurrido
$fechaGuardada = $_SESSION["ultimoAcceso"];
$ahora = date("Y-n-j H:i:s");
$tiempo_transcurrido = (strtotime($ahora)-strtotime($fechaGuardada));
//comparamos el tiempo transcurrido
if($tiempo_transcurrido >= 60 * 30 /*<----minutos*/) {
//si pasaron 10 minutos o más
session_destroy(); // destruyo la sesión
header("Location: index.html"); //envío al usuario a la pag. de autenticación
//sino, actualizo la fecha de la sesión
}else {
$_SESSION["ultimoAcceso"] = $ahora;
}
}
/// if(!isset($_SESSION['s_username']))header("location: ../index.html");
?>
<?php
if ($_POST['nom_capacita']=='Elegir personal por nombre' and $_POST['rut_capacita']=='')
{
echo "<script>history.back(alert(\"Por favor selecciona la persona a la cual deseas modificar el perfil.\"));</script>";
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function show_confirm()
{
var r=confirm("¿ Agregar Capacitación con los datos ingresados. ?");
if (r==true)
{
document.form1.submit();
}
else
{
location.href='add_propuesta.php';
}
}
</script>
<TITLE>:: xxxx - Sxxxxxxxxx ::</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=ISO-8859-1">
<!-- ImageReady Preload Script (index.psd) -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>JS Calendar (positioning test)</title>
<style type="text/css">
body {
background-image: url(imagenes/bg.jpg);
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
color: #FFFF00;
}
a:visited {
color: #FFFF00;
}
a:hover {
color: #FFFFFF;
}
</style>
<link href="css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style13 {font-size: 12px; color: #FFFFFF; }
.style4 {font-size: 14px; color: #FFFFFF;}
.style15 {color: #FFFF00; font-size: 12px; }
-->
</style>
</head>
<body>
<table width="100%" height="50" border="0">
<tr>
<td valign="bottom"><div align="center" class="style13">
<div align="center"><img src="imagenes/logo.gif" alt="logo" width="211" height="75" /></div>
</div></td>
<td valign="bottom"><div align="center"><img src="imagenes/sga1.gif" alt="scc" width="480" height="43" /></div></td>
</tr>
</table>
<div align="center"><br />
<table width="90%" border="0" cellpadding="3" cellspacing="0" bgcolor="#1C1C1C" class="texto_1">
<tr>
<td><a href="administracion.php"> Volver al menú principal </a></td>
<td width="50%"><div align="right"><a href="php/salir.php">X Cerrar sesión </a></div></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
<tr>
<td width="50%" bgcolor="#A2AB9E"><div align="right" class="texto_3"><strong>Buscar Personal por Nombre o R.U.T : </strong></div></td>
<td bgcolor="#A2AB9E"><label></label>
<form id="form2" name="form2" method="post" action="add_capacitacion_personal.php">
<label></label>
<label></label>
<table border="0">
<tr>
<td><div align="right">
<select name="nom_capacita" id="nom_capacita" >
<option selected="selected">Elegir personal por nombre</option>
<?php
$conexion= mysql_connect("localhost","xxxx","xxxxx") or die ("no se pudo conectar con el servidorssssssss");
mysql_select_db("administracion",$conexion)or die ("problemas en la conexion a la base de datos");
$adjudica= mysql_query("select nombre_completo from personal order by nombre",$conexion) or die ("cago".mysql_error());
while ($reg=mysql_fetch_array($adjudica))
echo "<option value=\"$reg[nombre_completo]\">$reg[nombre_completo]</option>";
?>
</select>
</div></td>
<td> </td>
</tr>
<tr>
<td><div align="right">
<input name="rut_capacita" type="text" id="rut_capacita" size="12" />
</div></td>
<td><input type="submit" name="Submit3" value="Buscar" /></td>
</tr>
</table>
</form> </td>
</tr>
</table>
<?php
$informacion= mysql_query("select * from personal where nombre_completo='$_POST[nom_capacita]' or rut='$_POST[rut_capacita]'",$conexion) or die ("cago".mysql_error());
if($reg=mysql_fetch_array($informacion));
{
$nombre=$reg["nombre_completo"];
$rut=$reg["rut"];
}
?>
</div>
<form action="php/php_add_capacitacion_personal.php" method="post" enctype="multipart/form-data" name="form1" id="form1">
<div align="center">
<table width="90%" border="0" bgcolor="#1C1C1C" class="texto_1">
<tr>
<td colspan="2" bgcolor="#333333" class="style4">Agregar experiencia laboral Sr.(a) : <span class="style15">
<?php
echo "$nombre" . ", " ;
function formateo_rut($rut_param){
$parte4 = substr($rut_param, -1); // seria solo el numero verificador
$parte3 = substr($rut_param, -4,3); // la cuenta va de derecha a izq
$parte2 = substr($rut_param, -7,3);
$parte1 = substr($rut_param, 0,-7); //de esta manera toma todos los caracteres desde el 8 hacia la izq
return $parte1.".".$parte2.".".$parte3."-".$parte4;
}
echo formateo_rut($rut);
?>
</span></td>
</tr>
<tr>
<td width="28%"> </td>
<td> </td>
</tr>
<tr>
<td colspan="2" bgcolor="#333333"><div align="center" class="style15">Capacitaciones registradas </div></td>
</tr>
</table>
<table width="90%" border="0" bgcolor="#1C1C1C" class="texto_1" cellspacing="4" >
<?php
// funcion cambiar formato fecha
function cambiarFormatoFecha($fecha){
list($anio,$mes,$dia)=explode("/",$fecha);
return $mes."-".$anio;
//return $dia."-".$mes."-".$anio;
}
// Fin funcion
//where nom_contrato='$_POST[nom_contrato]' order by fecha_modificacion
$result=mysql_query("select * from capacitaciones where rut='$rut' or nombre_completo='$nombre' ");
echo "<tr align='center' bgcolor='#333333'><td><strong>Institución</strong></td><td><strong>Curso Capacitación</strong></td><td><strong>Archivo</strong></td></tr>";
for ($i = 0; $i < mysql_num_rows($result); ++$i)
{
$columna = mysql_fetch_row($result);
if ($columna[5]!="")
{
$link="Certificado Capacitación";
}
echo "<tr><td align='center'>$columna[3]</td><td align='center'>$columna[4]</td><td align='center'><a href='$columna[5]' target='_blank'>$link</a></td></tr>";
}
?>
</table>
<table width="90%" border="0" bgcolor="#1C1C1C" class="texto_1">
<tr>
<td colspan="3" bgcolor="#333333"><div align="center" class="style15">Agregar datos </div></td>
</tr>
<tr>
<td width="28%"><div align="right">Institucion : </div></td>
<td colspan="2"><label>
<input name="institucion" type="text" id="institucion" size="40" />
</label></td>
</tr>
<tr>
<td><div align="right">Nombre Capacitación:</div></td>
<td colspan="2"><label>
<input name="nombre_curso" type="text" id="nombre_curso" size="40" />
</label></td>
</tr>
<tr>
<td><div align="right">Archivo : </div></td>
<td colspan="2"><label>
<input name="archivo_capa" type="file" class="texto_1" id="archivo_capa" />
</label></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td colspan="2"> </td>
</tr>
<tr>
<td> </td>
<td width="21%"><label>
<input type="reset" name="Reset" value="Limpiar formulario" />
</label></td>
<td><input type="button" class="rojo" onClick="show_confirm()" value="AGREGAR EXPERIENCIA"></td>
</tr>
<tr>
<td><div align="right"></div></td>
<td colspan="2"><input name="nnombre" type="hidden" id="nnombre" value="<?php echo $nombre ;?>" />
<input name="rrut" type="hidden" id="rrut" value="<?php echo $rut ;?>" /></td>
</tr>
</table>
<br />
</div>
</form>
</body>
</html>