Ver Mensaje Individual
  #4 (permalink)  
Antiguo 14/10/2008, 08:40
cearriag
 
Fecha de Ingreso: marzo-2005
Mensajes: 156
Antigüedad: 19 años, 1 mes
Puntos: 0
Respuesta: Comparacion de fecha con la del servidor

bueno gracias por atender a mi consulta.
Le dejo el codigo de formulario que que debo validar. Desde ya muchas gracias
Código php:
Ver original
  1. <?php
  2. session_register('USUA_LOGIN');
  3. $USUA_LOGIN;
  4. echo"<html>\n";
  5. echo"<head>\n";
  6. ?>
  7. <link rel="stylesheet" href="estilo-general.css"          type="text/css" media="all">
  8. <link rel="stylesheet" href="estilo-menu-desplegable.css" type="text/css" media="all">
  9. <script language="javascript" src="no-tocar.txt"          type="text/javascript"></script>
  10. <script language="javascript" src="numero-de-menus.txt"   type="text/javascript"></script>
  11. <link rel="stylesheet" type="text/css" media="all" href="calendar-system.css" title="win2k-cold-1" />
  12. <?php
  13. echo"<title>B&uacute;squeda de Cursos</title>\n";
  14. echo"</head>\n";
  15. echo "<body onload='init();'>";
  16. $enlace = mysql_connect("localhost", "root", "") or die("No pudo conectarse : " . mysql_error());
  17. mysql_select_db("sisproed") or die("No pudo seleccionarse la BD.");
  18. $consulta="SELECT USUARIOS__USUA.USUA_LOGIN, USUARIOS__USUA.USUA_NOMBRE,USUARIOS__USUA.USUA_APELLIDO FROM USUARIOS__USUA where USUARIOS__USUA.USUA_LOGIN='$USUA_LOGIN'";
  19. $res=mysql_query($consulta) or die("La consulta fall&oacute;: " . mysql_error());
  20. $num=mysql_numrows($res);
  21. for($i=0;$i<$num;$i++) 
  22.                 {
  23.                     $nombre=mysql_result($res,$i,"USUA_NOMBRE");
  24.                     $apellido=mysql_result($res,$i,"USUA_APELLIDO");
  25.                 }
  26.  
  27.   ?>
  28. <body bgcolor="#FFFFFF">
  29. <div id="Layer1" style='color:#640000; background-color:#FFD600; border-bottom: 3px double #FF6600; border-top: 3px double #FF6600; margin: 0 0 5px 0; padding: 4px 0; font-size: 14px;'>
  30.   <div align="center"><font face="verdana" size="3"><strong>Escuela Rep&uacute;blica Federal Alemana</strong></font></div>
  31. </div>
  32. <div id="Layer2" style="position:absolute; left:892px; top:15px; width:351px; height:28px; z-index:2;">
  33.   <div align="right"><font face="verdana" size="2"><strong>Logueado como: <?php echo"$nombre $apellido"; ?></strong></font></div>
  34. </div>
  35.  
  36. <body bgcolor="#FEF372"><TABLE width="1120" BORDER = 0 align="center" CELLPADDING = 0 CELLSPACING = 0>
  37. <TR><TD width="163"><IMG SRC = "../../imagenes/terminado.jpg" WIDTH = 157 HEIGHT = 126></TD>
  38. <TD width="817"><IMG SRC = "../../imagenes/final..jpg" WIDTH = 800 HEIGHT = 126></TD>
  39.   <TD width="246"><img src = "../../imagenes/LogoMineducActual.jpg" width = 157 height = 126></TD></TR>
  40. <td width="163">
  41. </TABLE>
  42. <TABLE width="762" align="center" BORDER = 0 CELLPADDING = 0 CELLSPACING = 0 >
  43. <TR bgcolor="#EFEFEF">
  44.      <TD width="172"> <li><a id="desplegable1"><font face='Verdana' size='2'>Inscripci&oacute;n</font></a></li>  </TD>
  45.       <TD width="174" bgcolor="#EFEFEF"><li><a id="desplegable2"><font face='Verdana' size='2'>Atraso</font></a></li></TD>
  46.       <TD width="162" bgcolor="#EFEFEF"><li><a id="desplegable3"><font face='Verdana' size='2'>Horario</font></a></li></TD>
  47.         <TD width="162"><li><a id="desplegable4"><font face='Verdana' size='2'>Administraci&oacute;n</font></a></li></TD>
  48.         <TD width="162"><li><a id="desplegable5"><font face='Verdana' size='2'>Usuario</font></a></li></TD>
  49.         <TD width="162"><li><a id="desplegable6"><font face='Verdana' size='2'>Informes</font></a></li></TD>
  50.          
  51.   </TR>
  52.  </TABLE>
  53. <?php
  54.  
  55.    
  56.             echo"<center>";
  57.             echo"<br>";
  58.             echo"<br>";
  59.             echo "<align='center'><font face='Verdana' size='4'><strong>B&uacute;squeda de Inscripci&oacute;nes</font></strong>\n";
  60.             echo"<form action='informe_alum_incri_entre_fechas.php' method='POST' name='form1' >\n";
  61.             echo"<br>";
  62.             echo "<table align='center' width='590' border='1'>\n";
  63.             echo "<tr>\n";
  64.             echo "<td width='30%'><font face='Verdana' size='2'>Fecha Inicio</font></td>\n";
  65.             //echo"<td width='35' align='center'> <div align='left'></td>\n";
  66.             //echo"<td><input name='fecha1' type='text'  maxlength='10' size='10'>\n</td>";
  67.             echo "<td><input type='text' name='fecha1' id='f_date_c' size='10' onblur='calcular(this.value)' readonly='1' /></td><td><img src='img.gif' id='f_trigger_c' style='cursor: pointer; border: 1px solid red;' title='Seleccionar Fecha' onmouseover='this.style.background='red';' onmouseout='this.style.background='''/></td>";
  68.            
  69.            
  70.             echo "<td width='30%'><font face='Verdana' size='2'>Fecha Termino</font></td>\n";
  71.             ?>
  72.             <td><input type="text" name="fecha2" id="f_date_c1"   size="10" readonly="1" /></td>
  73.          <td><img src="img.gif" id="f_trigger_c1" style="cursor: pointer; border: 1px solid red;" title="Date selector"
  74.               onmouseover="this.style.background='red';" onMouseOut="this.style.background=''" /></td>
  75.             <?php
  76.             echo "<td><input type='button' name='btnbuscar' value='Generar Informe' title='Generar Informe' onclick='Validarfechas()'></td>\n";
  77.             echo"</div>\n";
  78.             echo "</tr>\n";
  79.             echo "</table>\n";
  80.             //echo "<p></p>\n";
  81.             echo "</form> <p></p>\n";
  82.             echo "</tr>\n";
  83.             echo "</table> ";
  84.             echo "</center>";
  85.             ?>
  86.             <script language="javascript" src="definir-menus.txt" type="text/javascript"></script>
  87.             <?php
  88.             echo"</body>\n";
  89.             echo "</html>\n";
  90.         //Fin Condicion Else
  91. ?>
  92. <script type="text/javascript" src="calendar.js"></script>
  93. <script type="text/javascript" src="lang/calendar-es.js"></script>
  94. <script type="text/javascript" src="calendar-setup.js"></script>
  95. <script type="text/javascript">
  96.             Calendar.setup({
  97.                 inputField     :    "f_date_c",     // id of the input field
  98.                 ifFormat       :    "%e/%m/%Y",     // format of the input field
  99.                 button         :    "f_trigger_c",  // trigger for the calendar (button ID)
  100.                 align          :    "Tl",           // alignment (defaults to "Bl")
  101.                 singleClick    :    true
  102.             });
  103.         </script>
  104.        
  105. <script type="text/javascript">
  106.             Calendar.setup({
  107.                 inputField     :    "f_date_c1",     // id of the input field
  108.                 ifFormat       :    "%e/%m/%Y",     // format of the input field
  109.                 button         :    "f_trigger_c1",  // trigger for the calendar (button ID)
  110.                 align          :    "Tl",           // alignment (defaults to "Bl")
  111.                 singleClick    :    true
  112.             });
  113.         </script>
  114.        
  115. <script type="text/javascript">
  116. function Validarfechas()
  117. {
  118. var fecha1 = document.form1.fecha1.value;
  119. var fecha2 = document.form1.fecha2.value;
  120. //var fecha3=document.form1.fechaactual.value;
  121. f1=new Date(fecha1);
  122. f2=new Date(fecha2);
  123. var today =new Date();
  124. day = today.getDate();
  125. month = (today.getMonth())+1;
  126. year = today.getFullYear();
  127. fechaserver = day +"/" + month +"/"+ year;
  128. if (f1>f2)
  129. {
  130.  alert("Fecha inicio es mayor que la Fecha actual " );
  131.  document.form1.fecha1.focus();
  132. }
  133. else
  134. {
  135.     if( (f1 >= fechaserver)||(f2 >= fechaserver) )
  136.     {
  137.         alert(" Fechas erroneas " + fechaserver);  
  138.     }
  139.         else
  140.         {
  141.         document.form1.submit();
  142.         }
  143. }
  144. }
  145. </script>