elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Security Series.XSS. [Cross Site Scripting]


  Mostrar Temas
Páginas: [1]
1  Programación / PHP / Paginacion en PHP en: 28 Febrero 2016, 01:47 am
Hola Y espero que me puedan ayudar
Lo que pasa es que pasa es que hecho una paginacion a un listado en el cual también hay aun campo de búsqueda y tengo agregarlo a un archivo donde se  agrega la ruta del archivo php 

por ejemplo

case 1073
http://foro.elhacker.net/programacion/listar.php

Entonces
cuando ingresa al sistema la url sale
http://foro.elhacker.net/programacion/default.php?op=1073

Y en la paginacion cuando le doy siguiente a la 2da pagina

cambia a
http://foro.elhacker.net/programacion/default.php?pagina2
y no se muestra nada

porque no esta tomando la ruta correcta
por eso quería que por favor me ayudes con esa parte del código que cuando uno vaya a la siguiente pagina no se actualice la url

Espero que por favor me puedas ayudar

Código
  1.  
  2. /****conexion.php***\
  3. <?php
  4. $cnx= mysql_connect("localhost","root","123456");
  5. if (!$cnx) {
  6. die("Fallo la conexión a la Base de Datos: ". mysql_error());
  7. }
  8. $bd = mysql_select_db("bdexample", $cnx);
  9. if (!$bd) {
  10. die("Fallo la selección de la Base de Datos: " . mysql_error());
  11. }
  12. ?>
  13.  
  14. /*************listar.php*****************\
  15. <?php
  16. require_once('conexion.php');
  17. if (isset($_POST['busc'])){
  18. $num=$_POST['num'];
  19. $sql="select * from tblCondominio where codigo='$num' order by fechaAcceso DESC";
  20. }else{
  21. $sql="select * from tblCondominio order by fechaAcceso DESC";
  22. }
  23. $_SESSION["SQL_SHOW"]=$sql;
  24. $tmp_rs = mysql_query($sql);
  25. $num_total_registros = mysql_num_rows($tmp_rs);
  26. $TAMANO_PAGINA = 5;
  27. $pagina = $_GET["pagina"];
  28. if (!$pagina) {
  29. $inicio = 0;
  30. $pagina = 1;
  31. }
  32. else {
  33. $inicio = ($pagina - 1) * $TAMANO_PAGINA;
  34. }
  35. $total_paginas = ceil($num_total_registros / $TAMANO_PAGINA);
  36. $consulta = $sql." LIMIT ".$inicio."," . $TAMANO_PAGINA;
  37. $reg = mysql_query($consulta);
  38. ?>
  39. <html>
  40. <head>
  41. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  42. <script type="text/javascript" language="javascript">
  43. function cambiar(id,color){
  44. document.getElementById(id).style.backgroundColor=color;
  45. }
  46. </script>
  47. </head>
  48. <body>
  49. <form action="default.php?op=1073" method="POST" >
  50. <table width="700" align="center" border="1">
  51. <tr>
  52. <td colspan=6 align="center">Modificaci&oacute;n</td></tr>
  53. <tr><td align=right>Codigo
  54. <td align=left><input type="text" name="codigo"/></td></tr>
  55. <tr>
  56. <td colspan=6><center><input type="submit" name="busc" value="Buscar">
  57. </center>
  58. </table>
  59. </form>
  60. <table width="100%" align="center" border="1">
  61. <tr><td width="62" align=center>TIPO</td>
  62. <td width="70" align=center>CODIGO</td>
  63. <td width="340" align=center>NOMBRE</td>
  64. <td width="40" align=right>DOCUMENTOS</td>
  65. <td width="40" align=center>OBSERVACIONES</td>
  66. <td width="30" align=center>OPCIONES</td></tr>
  67. <?php
  68. $i=0;
  69. while($res=mysql_fetch_array($reg)){
  70. ?>
  71. <tr style="background-color:#f0f0f0" id="<?php echo $i;?>" onMouseMove="cambiar('<?php echo $i;?>','#cccccc')" onMouseOut="cambiar('<?php echo $i;?>','#f0f0f0')">
  72. <td width="62" align=center>
  73. <?php if($res['tipo']==2){?>casa
  74. <?php }
  75. elseif($res['tipo']==1){?>
  76. departamento
  77. <?php }
  78. ?></td>
  79.  
  80. <td width="70" align=center><?php echo $res['codigo'];?></td>
  81. <td width="340" align=justify><?php echo $res['nombre'];?></td>
  82. <td width="40" align=center>
  83. <a href="recaudacion/data2/documents2/<?php echo $res['documentosReg'];?>" target="_blank"><?php echo $res['documentosReg'];?></a></h6></td>
  84. <td width="40"><?php echo $res['observaciones'];?></td>
  85. <td width="30"><a href="editar.php?num=<?php echo $res[2];?>"><strong>Editar</strong></a></td></tr>
  86. <?php
  87. $i=$i+1;
  88. }
  89. ?>
  90. </table>
  91. <table width="100%" align="center">
  92. <tr>
  93. <td width="8"></td>
  94. <td width="474" align="left" ><h3>
  95. <?php
  96. if ($total_paginas > 1) {
  97. if ($pagina != 1)
  98. echo '<a href="'.$url.'?pagina='.($pagina-1).'" class="Estilo1" >Anterior < </a>';
  99. for ($i=1;$i<=$total_paginas;$i++) {
  100. if ($pagina == $i)
  101. echo $pagina;
  102. else
  103. echo ' <a href="'.$url.'?pagina='.$i.'" class="Estilo1">'.$i.'</a> ';
  104. }
  105. if ($pagina != $total_paginas)
  106. echo '<a href="'.$url.'?pagina='.($pagina+1).'" class="Estilo1"> >Siguiente </a>';
  107. }
  108. ?>
  109. </h3></td>
  110. <td width="105"></td>
  111. <td width="250" align="left"><strong>Total de Registros: <span class="Estilo4">
  112. <?php
  113. $cantidad = "select count(codigo) from tblCondominio";
  114. $total= mysql_query($cantidad) or die(mysql_error());
  115. $total_registros = mysql_result($total,0,0);
  116. ?>
  117. <?php echo $total_registros;?><br>
  118. </span></strong><strong>Registros Encontrados: <span class="Estilo4">
  119. <?php
  120. $cantidad = "select count(codigo) from tblCondominio where codigo='$num'";
  121. $total= mysql_query($cantidad) or die(mysql_error());
  122. $total_registros = mysql_result($total,0,0);
  123. ?>
  124. <?php echo $total_registros;?></span></strong></td>
  125. </tr>
  126. </table>
  127. </body>
  128. </html>
  129.  
2  Programación / PHP / Descargar Excel en php en: 12 Diciembre 2015, 02:52 am
Buenas estoy tratando de descargar a excel
 pero necesito que a la hora de descargar se registre la fecha y se cambie el estado 5 al 6
de todos los registros que descargo


Código
  1.  
  2.  
  3. <?php
  4.  
  5. require_once('conexion.php');
  6.    header ("Cache-Control: no-cache, must-revalidate");  
  7.    header ("Pragma: no-cache");  
  8.    header ("Content-Type: application/vnd.ms-excel");
  9.    header ("Content-Disposition: attachment; filename=reporte.xls" );
  10.  
  11. $sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
  12.  
  13. $reg=mysql_query($sql,$cnx);
  14. ?>
  15. <table width="100%"  align="center" cellspacing="0">
  16. <tr><td colspan="12"  width="25" align=center><h5>TITULO</h5></td></tr>
  17. <tr><td colspan="12" width="90" align=center><h5>TITULO </h5></td></tr>
  18. <tr><td colspan="12" width="150" align=center><h5>TITULO PERIODO:</h5></td></tr>
  19.  
  20. </table>
  21. <table width="100%"  BORDER=3  align="center" cellspacing="0" BORDERCOLOR="#939393" BGCOLOR="FFFFFF">
  22.  
  23. <tr>
  24. <td width="25" align=center valign="top" BGCOLOR="C1D4D6"><h5>Nª</h5></td>
  25. <td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>DEPENDENCIA</h5></td>
  26. <td width="85" align=center valign="top" BGCOLOR="C1D4D6"><b><h5>CODIGO</h5></b></td>
  27. <td width="150" align=center valign="top" BGCOLOR="C1D4D6"><h5>N CUENTA</h5></td>
  28. <td width="230" align=center valign="top" BGCOLOR="C1D4D6"><h5>NOMBRE</h5></td>
  29. <td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>CODIGO RESLUCION</h5></td>
  30. <td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>FECHA NOTIFICACION</h5></td>
  31. <td width="450" align=center valign="top" BGCOLOR="C1D4D6"><h5>CAUSAL DE INGRESO DE RECAUDACION</h5></td>
  32. <td width="100" align=center valign="top" BGCOLOR="C1D4D6"><h5>TIPO MONTO A TRASLADAR</h5></td>
  33. <td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>OBSERVACIONES</h5></td>
  34. <td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>PERIODOS DE REVISION</h5></td>
  35. <td width="90" align=center valign="top" BGCOLOR="C1D4D6"><h5>MONTO A TRASLADAR</h5></td>
  36. </tr>
  37. <?php
  38. $i=0;
  39. while($res=mysql_fetch_array($reg)){
  40. ?>
  41. <td width="25" align=center><h5><?php echo $i+1;?></h5></td>
  42. <td width="90"><h5>00<?php echo $res['icr_dependencia'];?></h5></td>
  43. <td width="85" align=center><h5><?php echo $res['icr_codigo'];?></h5></td>
  44. <td width="150"><h5><?php echo $res['icr_cuenta_bn'];?></h5></td>
  45. <td width="230" align=justify><h6><?php echo $res['icr_nombre'];?></h6></td>
  46. <td width="100" align=center><h5>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></h5></td>
  47. <td width="100" align=center><h5><?php echo $res['icr_fecha_ri'];?></h5></td>
  48. <td width="450" align=justify><h5><?php echo $res['icr_causal'];?></h5></td>
  49.  
  50.    <td width="90" align=center>
  51.  <h5>
  52.    <?php if($res["icr_traslado"]==1){?> Saldo Parcial
  53.    <?php }elseif($res["icr_traslado"]==2){?> Saldo Total
  54.    <?php }?>    
  55.        </h5></td>
  56. <td width="90" align=justify><h6><?php echo $res['icr_observaciones_a'];?></h6></td>
  57.  
  58. <td width="90" align=center>
  59. <?php
  60. date_default_timezone_set('America/Lima');  
  61. $calendario_meses = array(
  62.    'January'=>'Enero',
  63.    'Febuary'=>'Febrero',
  64.    'March'=>'Marzo',
  65.    'April'=>'Abril',
  66.    'May'=>'Mayo',
  67.    'June'=>'Junio',
  68.    'July'=>'Julio',
  69.    'August'=>'Agosto',
  70.    'September'=>'Septiembre',
  71.    'October'=>'Octubre',
  72.    'November'=>'Noviembre',
  73.    'December'=>'Diciembre'
  74. );  
  75.  
  76. $data1 = explode('-', $res['icr_fecha_revision1']);  
  77. $fecha1 = date('F \d\e\l Y', strtotime($data1[0] . '-' . $data1[1]));
  78. $fecha1 = strtr($fecha1, $calendario_meses);
  79.  
  80. echo $fecha1; ?>  -
  81.  
  82. <?php
  83. date_default_timezone_set('America/Lima');  
  84. $calendario_meses2 = array(
  85.    'January'=>'Enero',
  86.    'Febuary'=>'Febrero',
  87.    'March'=>'Marzo',
  88.    'April'=>'Abril',
  89.    'May'=>'Mayo',
  90.    'June'=>'Junio',
  91.    'July'=>'Julio',
  92.    'August'=>'Agosto',
  93.    'September'=>'Septiembre',
  94.    'October'=>'Octubre',
  95.    'November'=>'Noviembre',
  96.    'December'=>'Diciembre'
  97. );  
  98.  
  99. $data2 = explode('-', $res['icr_fecha_revision2']);  
  100. $fecha2 = date('F \d\e\l Y', strtotime($data2[0] . '-' . $data2[1]));
  101. $fecha2 = strtr($fecha2, $calendario_meses2);
  102. echo $fecha2; ?>
  103. </td>
  104. <td width="90" align=center><h5><?php echo $res['icr_monto_icr'];?></h5></td>
  105. </tr>
  106.    <?php
  107. $i=$i+1;
  108. }
  109. ?>
  110. </table>
  111. </body>
  112. </html>
  113.  
3  Programación / Desarrollo Web / Script que solo salga una vez en: 9 Diciembre 2015, 00:40 am
Hola como se puede hacer para que el script solo salga una vez


Código
  1. <script>  
  2. function abrir() {  
  3. open('alerta.php','','top=150,left=200,width=350,height=300,menubar=yes,scrollbars=yes,resizable=yes');  
  4. }  
  5. </script>  
  6. <body onLoad="abrir()">
  7. </body>  
  8.  
  9.  
4  Programación / PHP / Mostar campo Fecha Vacio en: 8 Diciembre 2015, 03:12 am
Hola tengo un campo que en ocasiones esta vacio

este me devuelve con fecha de diciembre del 1969
cuando debería aparecerme en blanco como puedo hacer que solo aparezca los que tienen fechas y los que están con campos vacíos en blanco

Código
  1. <?php
  2. date_default_timezone_set('America/Lima');  
  3.  
  4. $calendario_meses = array(
  5.    'January'=>'Enero',
  6.    'Febuary'=>'Febrero',
  7.    'March'=>'Marzo',
  8.    'April'=>'Abril',
  9.    'May'=>'Mayo',
  10.    'June'=>'Junio',
  11.    'July'=>'Julio',
  12.    'August'=>'Agosto',
  13.    'September'=>'Septiembre',
  14.    'October'=>'Octubre',
  15.    'November'=>'Noviembre',
  16.    'December'=>'Diciembre'
  17. );  
  18.  
  19. $data = explode('-', $res['icr_fecha_revision2']);  
  20. $fecha = date('F \d\e\l Y', strtotime($data[0] . '-' . $data[1]));
  21. $fecha = strtr($fecha, $calendario_meses);
  22.  
  23. echo $fecha;  
  24. ?>
  25.  
5  Programación / PHP / PHP Error enpaginado en: 6 Diciembre 2015, 23:39 pm
Hola
Estoy tratando de empaginar
Me empaginan normal
Por ejemplo me muestra 30 registros totales
y me empagina 10 por hoja hasta ahi normal

Pero a la hora de hacer la busqueda por fechas no me funciona la busqueda
es decir no me lista el resultado

Todo lo contrario me sigue mostranto todos los registros


Código
  1. <?php
  2. require_once('conexion.php');
  3.  
  4. if (isset($_POST['busc'])){
  5. $fecha_reporte=$_POST['fecha_reporte'];
  6. $fecha_reporte2=$_POST['fecha_reporte2'];
  7.  
  8. $sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_fecha_ri>='$fecha_reporte'
  9. and icr_fecha_ri<='$fecha_reporte2' order by icr_fecha_ri ASC ";
  10. }else{
  11. $sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
  12. }
  13. $reg=mysql_query($sql,$cnx);
  14.  
  15. ?>
  16.  
  17.  
  18. <?php
  19. require_once('conexion.php');
  20. $num_registros=mysql_num_rows($reg);
  21. if($num_registros==0){
  22.  echo "No existen registros";
  23.  exit(0);  
  24.  }
  25. $registros=5;
  26. $pagina=$_GET['num'];
  27. if(is_numeric($pagina)){
  28.  $inicio=($pagina - 1)*$registros;
  29.  }
  30. else{
  31.  $inicio=0;
  32.  }
  33. $sql="select * from tbldocumentosicr order by icr_fecha_ri  limit $inicio,$registros";
  34. $reg=mysql_query($sql,$cnx);
  35. $paginas=ceil($num_registros/$registros);
  36. ?>
  37.  
  38.  
  39.  
  40. <html>
  41. <head>
  42.  
  43. <title>Listado</title>
  44.  
  45. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  46.  
  47.    <script type="text/javascript" src="jquery.quick.pagination.min.js"></script>
  48.    <script type="text/javascript" src="jquery.quick.pagination.js"></script>
  49.    <script type="text/javascript" src="calendar.js"></script>
  50.    <script type="text/javascript" src="calendar-setup.js"></script>
  51.    <script type="text/javascript" src="calendar-es.js"></script>
  52.    <style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>
  53.  
  54. <script type="text/javascript" language="javascript">
  55.   function cambiar(id,color){
  56.       document.getElementById(id).style.backgroundColor=color;
  57.   }
  58. </script>
  59.  
  60. <style type="text/css">
  61.   body,td,th {
  62.   color: #000000;
  63.   }
  64.   body {
  65.   }
  66. a:link {
  67.   color: #0058B0;
  68.   text-decoration: none;
  69. }
  70. a:visited {
  71.   text-decoration: none;
  72. }
  73. a:hover {
  74.   text-decoration: none;
  75. }
  76. a:active {
  77.   text-decoration: none;
  78. }
  79. .Estilo4 {color: #004080}
  80. </style>
  81.  
  82.  
  83. </head>
  84. <body>
  85. <form action="reportlima.php" method="POST" >
  86.  
  87. <table BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB"  BORDER="1" width="33%" align="center" cellpadding="1" >
  88. <tr>
  89.   <td colspan=7 align="center" BGCOLOR="C1D4D6" style="color:#000000"><h2><strong>Consulta</strong></h2></td>
  90. </tr>
  91.  
  92. <tr>
  93. <TD colspan=5 align=left><B>Fecha Notificacion RI</B></TD>
  94. <TR>
  95.   <TD colspan=4 align=right><B> Desde:</B></TD>
  96.   <TD colspan=2 align=left> <input name="fecha_reporte" type="text" id="fecha_reporte" style="background-color:#FBF9D5"/>
  97.   <button type="submit" id="button1">....</button>
  98.   <script type="text/javascript">                Calendar.setup({
  99.                                inputField    : "fecha_reporte",
  100.                                button        : "button1",
  101.                                align         : "center"
  102.                              });
  103.                               </script></TD>
  104. </TR>
  105.  
  106. <TR>
  107.   <TD colspan=4 align=right><B> Hasta:</B></TD>
  108.   <TD colspan=2 align=left> <input type="text" name="fecha_reporte2" id="fecha_reporte2" style="background-color:#FBF9D5"/>
  109.   <button type="submit" id="button2">....</button>
  110.   <script type="text/javascript">                Calendar.setup({
  111.                                inputField    : "fecha_reporte2",
  112.                                button        : "button2",
  113.                                align         : "center"
  114.                              });
  115.                               </script></TD>
  116. </TR>
  117.  
  118. <TR>
  119.    <TD colspan=7>
  120.    <br/>
  121. <center>  
  122.   <input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>
  123.   <input type="button" name="reg" value="Regresar" style='width:100px; height:35px' onClick="history.back()">
  124. </center>
  125. </table>
  126.  
  127. </form>
  128. <br></br>
  129. <table width="100%"  align="center" cellspacing="0">
  130.   <TD align=left><input type="submit" name="exporta" value="Exportar a Excel"  style='width:150px; height:35px'>
  131.  
  132. </TD>
  133. </table>
  134.  
  135. <table width="100%"  BORDER=3  align="center" cellspacing="0" BORDERCOLOR="#939393" BGCOLOR="F9FBFC">
  136.  
  137. <tr>
  138.   <td BGCOLOR="C1D4D6" width="25" align=center><h5>Nª</h5></td>
  139.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>DEPENDENCIA</h5></td>
  140.   <td BGCOLOR="C1D4D6" width="85" align=center><b><h5>CODIGO</h5></b></td>
  141.   <td BGCOLOR="C1D4D6" width="150" align=center><h5>N CUENTA</h5></td>
  142.   <td BGCOLOR="C1D4D6" width="230" align=center><h5>NOMBRE</h5></td>
  143.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>CODIGO RESLUCION</h5></td>
  144.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA NOTIFICACION</h5></td>
  145.   <td BGCOLOR="C1D4D6" width="330" align=center><h5>CAUSAL DE INGRESO</BR>DERECAUDACION</h5></td>
  146.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>TIPO MONTO<BR> A TRASLADAR</h5></td>
  147.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>OBSERVACIONES</h5></td>
  148.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>PERIODOS DE REVISION</h5></td>
  149.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>MONTO A TRASLADAR</h5></td>
  150.   <td BGCOLOR="C1D4D6" width="70" align=center><h5>ESTADO</h5></td>
  151.  
  152. </tr>
  153. <?php
  154. $i=0;
  155. while($res=mysql_fetch_array($reg)){
  156.   ?>
  157.   <tr style="background-color:#f0f0f0" id="<?php echo $i;?>" onMouseMove="cambiar('<?php echo $i;?>','#cccccc')" onMouseOut="cambiar('<?php echo $i;?>','#f0f0f0')">
  158.  
  159.    <td width="25" align=center><h5><?php echo $res[''];?></h5></td>
  160.    <td width="90" align=center><h5>00<?php echo $res['icr_dependencia'];?></h5></td>
  161.    <td width="85" align=center><h5><?php echo $res['icr_codigo'];?></h5></td>
  162.    <td width="150" align=center><h5><?php echo $res['icr_cuenta_bn'];?></h5></td>
  163.    <td width="230" align=justify><h6><?php echo $res['icr_nombre'];?></h6></td>
  164.    <td width="100" align=center><h5>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></h5></td>
  165.    <td width="100" align=center><h5><?php echo $res['icr_fecha_ri'];?></h5></td>
  166.    <td width="330" align=justify><h5><?php echo $res['icr_causal'];?></h5></td>
  167.  
  168.    <td width="90" align=center>
  169.     <h5>
  170.       <?php if($res["icr_traslado"]==1){?>
  171.       Saldo Parcial
  172.       <?php }elseif($res["icr_traslado"]==2){?>
  173.       Saldo Total
  174.       <?php }?>    
  175.      </h5></td>
  176.  
  177. <td width="90" align=justify><h6><?php echo $res['icr_observaciones_a'];?></h6></td>
  178.  
  179. <td width="90" align=justify><h6><?php echo $res[''];?></h6></td>
  180.  
  181.  
  182. <td width="90" align=center>
  183.  
  184. <?php
  185.    $data = explode('-', $res['icr_fecha_revision1']);
  186.    echo date('F \d\e\l Y', strtotime($data[0] . '-' . $data[1])); ?> -
  187.  
  188. <?php
  189.    $data = explode('-', $res['icr_fecha_revision2']);
  190.    echo date('F \d\e\l Y', strtotime($data[0] . '-' . $data[1])); ?>
  191.  
  192. </td>
  193.  
  194.   <td width="90" align=center><h5><?php echo $res['icr_monto_icr'];?></h5></td>
  195.  
  196.   <td width="70" align=center>
  197.    <h5>
  198.      <?php if($res["icr_estado"]==5){?>Notificado con RI
  199.      <?php }elseif($res["icr_estado"]==6){?>Reportado
  200.      <?php }?>
  201.      </h5></td>
  202.  
  203. </tr>
  204.   <?php
  205.   $i=$i+1;
  206.   }
  207.   ?>
  208. </table>
  209.  
  210. <tr>
  211. <td align="center" bgcolor="#FFFFFF"><h3><strong>Total de Registros:
  212.   <span class="Estilo4">
  213.     <?php
  214. $cantidad = "select count(icr_num_accion) from tbldocumentosicr  where icr_estado='5'";
  215. $total= mysql_query($cantidad) or die(mysql_error());
  216. $total_registros = mysql_result($total,0,0);
  217. ?>
  218.      <?php echo $total_registros;?> <br></span></strong><strong>Registros Encontrados: <span class="Estilo4">
  219.      <?php
  220. $cantidad = "select count(icr_num_accion) from tbldocumentosicr where icr_fecha_ri>='$fecha_reporte' and icr_fecha_ri<='$fecha_reporte2'";
  221. $total= mysql_query($cantidad) or die(mysql_error());
  222. $total_registros = mysql_result($total,0,0);
  223. ?>
  224.      <?php echo $total_registros;?></span></strong></h3></td>
  225. </tr>
  226.  
  227.  
  228.  
  229.  
  230. <?php
  231. if($pagina>1)
  232. echo "<a href='reportlima.php?num=".($pagina -1)."' >Anterior</a> ";
  233. for($cont=1;$cont<=$paginas;$cont++){
  234. if($cont==$pagina)
  235. echo $cont ." ";
  236. else
  237. echo "<a href='reportlima.php?num=".$cont."' >$cont</a> ";
  238. }
  239. if($pagina<$paginas)
  240. echo "<a href='reportlima.php?num=".($pagina +1)."' >Siguiente</a> ";
  241. ?>
  242. </body>
  243. </html>
  244.  
  245.  
6  Programación / PHP / PHP Cambiar idioma de fecha en: 6 Diciembre 2015, 23:31 pm
Hola a todos
Espero que me puedan ayudar
Tengo un campo en la bd Fecha que esta en cadena y le convertido como Fecha

Pero a la hora de Listarlo
Como yo quiero es por ejemplo Diciembre del 2015
Me sale en ingles December del 2015

Estoy tratando de hacerlo con un array pero no me funciona



Código
  1. <?php
  2.  
  3. date_default_timezone_set('America/Lima');
  4.  
  5. $calendario_meses = array(1=>"Enero",2=>"Febrero",3=>"Marzo",4=>"Abril",5=>"Mayo",6=>"Junio",
  6. 7=>"Julio",8=>"Agosto",9=>"Septiembre",10=>"Octubre",
  7. 11=>"Noviembre",12=>"Diciembre");
  8.  
  9. ?>
  10.  
  11. // Esta es la manera como extraigo de la BD
  12.  
  13. <?php
  14.    $data = explode('-', $res['icr_fecha_revision2']);
  15.    echo date('F \d\e\l Y', strtotime($data[0] . '-' . $data[1])); ?>  
  16. </td>
  17.  
7  Programación / PHP / PHP Cambiar fecha cadena a date en: 2 Diciembre 2015, 02:15 am
Buenas he encontrado un campo fecha pero esta en varchar  pero no puedo cambiarlo a date por que se perderían registros

Tengo que hacer un listado que me muestre ( Mes y Año )
Por ejemplo
con este formato Abril del 2015
 
podrían ayudarme como se puede convertir en mes y año de una cadena
las fechas estas guardadas así
Año-Mes-Dias
2015-12-24

Dejo comentado en donde se agrega el codigo
<!--- 
<td width="25" align=center><?php echo $res['icr_fecha_revision1'];?></td>

si lo hago de esta manera me  sale asi 2015-12-24
Pero lo que quiero es que salga Diciembre del 2015                                                                     
--->

Código
  1.  
  2.  
  3. <?php
  4. require_once('conexion.php');
  5.  
  6. if (isset($_GET['busc'])){
  7. $fecha_reporte=$_GET['fecha_reporte'];
  8. $fecha_reporte2=$_GET['fecha_reporte2'];
  9. $sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_fecha_ri>='$fecha_reporte' and icr_fecha_ri<='$fecha_reporte2' order by icr_fecha_ri ASC";
  10. }else{
  11. $sql="select * from tbldocumentosicr INNER JOIN tblinfracciones ON tbldocumentosicr.icr_infraccion=tblinfracciones.icr_infraccion where icr_estado='5' order by icr_fecha_ri ASC";
  12. }
  13. $reg=mysql_query($sql,$cnx);
  14. ?>
  15. <html>
  16. <head>
  17. <title>Listado</title>
  18. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  19.    <script type="text/javascript" src="calendar.js"></script>
  20.    <script type="text/javascript" src="calendar-setup.js"></script>
  21.    <script type="text/javascript" src="calendar-es.js"></script>
  22.    <style type="text/css"> @import url("calendar-win2k-cold-1.css"); </style>
  23.  
  24. <script type="text/javascript" language="javascript">
  25.   function cambiar(id,color){
  26.    document.getElementById(id).style.backgroundColor=color;
  27.   }
  28. </script>
  29. <style type="text/css">
  30. body,td,th {
  31. color: #000;
  32. }
  33. body {
  34. }
  35. </style>
  36. </head>
  37.  
  38. <body>
  39. <form action="reportlima.php" method="get" >
  40.  
  41. <table BGCOLOR="F9FBFC" BORDERCOLOR="EAEAEB"  BORDER="1" width="900" align="center" cellpadding="1" >
  42. <tr>
  43.   <td colspan=6 align="center" BGCOLOR="C1D4D6" style="color:#000000"><h2><strong>Consulta</strong></h2></td>
  44.  
  45. </tr>
  46.  
  47. <TR>
  48. <TD align=left><B>Fecha Notificacion RI</B></TD>
  49.  
  50. <TR>
  51. <TD align=right><B> Desde:</B></TD>
  52. <TD align=left> <input type="text" name="fecha_reporte" id="fecha_reporte" style="background-color:#FBF9D5"/>
  53. <button type="submit" id="button1">....</button>
  54. <script type="text/javascript">           Calendar.setup({
  55.               inputField    : "fecha_reporte",
  56.               button        : "button1",
  57.               align         : "center"
  58.             });
  59.                 </script>
  60. </TD></TR>
  61.  
  62. <TR>
  63. <TD align=right><B> Hasta:</B></TD>
  64. <TD align=left> <input type="text" name="fecha_reporte2" id="fecha_reporte2" style="background-color:#FBF9D5"/>
  65.  
  66. <button type="submit" id="button2">....</button>
  67. <script type="text/javascript">           Calendar.setup({
  68.               inputField    : "fecha_reporte2",
  69.               button        : "button2",
  70.               align         : "center"
  71.             });
  72.                 </script>
  73. </TD></TR>
  74.  <TR>
  75.   <TD colspan=6>
  76.    <br/>
  77.  
  78. <center>  
  79. <input type="submit" name="busc" value="Buscar" style='width:100px; height:35px'>
  80. <input type="button" name="reg" value="Regresar" style='width:100px; height:35px' onClick="history.back()"></center>
  81.  
  82. </table>
  83. </form>
  84. <br></br>
  85. <table width="1450"  align="center" cellspacing="0">
  86. <TD align=left><input type="submit" name="exporta" value="Exportar a Excel" style='width:150px; height:35px'></TD>
  87.  
  88. </table>
  89. <table BGCOLOR="F9FBFC" BORDERCOLOR=""  BORDER=5 width="1450"  align="center" cellspacing="0">
  90. <tr>
  91. <td colspan=14 align="center" bgcolor="#FFFFFF"><h2><strong></strong></h2></td>
  92.  </tr>
  93. <tr>
  94.   <td BGCOLOR="C1D4D6" width="25" align=center><h5>N &#38;#176;</h5></td>
  95.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>DEPENDENCIA</h5></td>
  96.   <td BGCOLOR="C1D4D6" width="85" align=center><b><h5>RUC</h5></b></td>
  97.   <td BGCOLOR="C1D4D6" width="150" align=center><h5>N CUENTA</h5></td>
  98.   <td BGCOLOR="C1D4D6" width="230" align=center><h5>RAZON SOCIAL</h5></td>
  99.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>CODIGO RESLUCION</h5></td>
  100.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>FECHA NOTIFICACION</h5></td>
  101. <td BGCOLOR="C1D4D6" width="330" align=center><h5>CAUSAL DE INGRESO</BR>DERECAUDACION</h5></td>
  102.   <td BGCOLOR="C1D4D6" width="100" align=center><h5>TIPO MONTO<BR> A TRASLADAR</h5></td>
  103.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>OBSERVACIONES</h5></td>
  104.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>PERIODOS DE REVISION</h5></td>
  105.   <td BGCOLOR="C1D4D6" width="90" align=center><h5>MONTO A TRASLADAR</h5></td>
  106.   <td BGCOLOR="C1D4D6" width="70" align=center><h5>ESTADO</h5></td>
  107.  
  108. </tr>
  109. <?php
  110. $i=0;
  111. while($res=mysql_fetch_array($reg)){
  112. ?>
  113.   <tr style="background-color:#f0f0f0" id="<?php echo $i;?>" onMouseMove="cambiar('<?php echo $i;?>','#cccccc')" onMouseOut="cambiar('<?php echo $i;?>','#f0f0f0')">
  114.  
  115.  <td width="25" align=center><?php echo $res[''];?></td>
  116.    <td width="90" align=center>00<?php echo $res['icr_dependencia'];?></td>
  117.    <td width="85" align=center><?php echo $res['icr_ruc'];?></td>
  118.    <td width="150" align=center><?php echo $res['icr_cuenta_bn'];?></td>
  119.    <td width="230" align=justify><?php echo $res['icr_contribuyente'];?></td>
  120.    <td width="100" align=center>0<?php echo $res['icr_dependencia'];?>024000<?php echo $res['icr_num_resolucion'];?></td>
  121.    <td width="100" align=center><?php echo $res['icr_fecha_ri'];?></td>
  122.    <td width="330" align=justify><?php echo $res['icr_causal'];?></td>
  123.    <td width="90" align=center>
  124. <?php if($res["icr_traslado"]==1){?>Saldo Parcial
  125. <?php }elseif($res["icr_traslado"]==2){?>Saldo Total
  126. <?php }?> </td>
  127. <td width="90" align=justify><?php echo $res[''];?></td>
  128.  
  129.  
  130.  
  131. <!---  AQUI ES DONDE SE DEBE AGREGAR EL CODIGO
  132.  
  133. <td width="25" align=center><?php echo $res['icr_fecha_revision1'];?></td>
  134.  
  135. si lo hago de esta manera me  sale asi 2015-12-24
  136. Pero lo que quiero es que salga Diciembre del 2015
  137. --->
  138.  
  139. <td width="90" align=center><?php echo $res['icr_monto_icr'];?></td>
  140.  
  141.  <td width="70" align=center>
  142. <?php if($res["icr_estado"]==1){?>Registrado
  143. <?php }elseif($res["icr_estado"]==2){?>Con Comunicaci&oacute;n
  144. <?php }elseif($res["icr_estado"]==3){?>Notificaci&#38;#243n Comunicaci&#38;#243n
  145. <?php }elseif($res["icr_estado"]==4){?>Con Resoluci&oacute;n
  146. <?php }elseif($res["icr_estado"]==5){?>Notificado con RI
  147. <?php }elseif($res["icr_estado"]==6){?>Reportado
  148. <?php }?>
  149. </td>
  150.  
  151. </tr>
  152. <?php
  153. $i=$i+1;
  154. }
  155. ?>
  156. </table>
  157. </body>
  158.  
  159. </html>
  160.  
  161.  
  162.  
  163.  
  164.  
  165.  
8  Programación / PHP / Calcular días hábiles en PHP en: 28 Noviembre 2015, 17:53 pm
Buenas espero que me puedan ayudar
estoy queriendo sumar 10 días hábiles (Lunes a Viernes) y sin contar feriados
a partir de una fecha
Lo que hecho es sumarle 10 días pero no quiero que cuente los sábados ni domingos y tampoco los feriados

Por ejemplo estos son algunos feriados

2015-12-08     2015-12-25     2016-01-01    


Código
  1. <?php
  2.  
  3. require_once('conexion.php');
  4.  
  5. $num_accion=$_POST['num_accion'];
  6. $fecha_noti=$_POST['fecha_noti'];
  7.  
  8. $fecha_venci_noti= date("Y-m-d", strtotime("$fecha_noti + 10 days"));
  9.  
  10. $sql="update tbldias set
  11.  
  12. dc_fecha_noti='".$fecha_noti."',
  13. dc_fecha_venci_noti='".$fecha_venci_noti."'
  14.  
  15. where dc_num_accion=".$num_accion;
  16.  
  17. $res=mysql_query($sql,$cnx);
  18.  
  19. ?>

Mod: Obligatorio el uso de etiquetas GeSHi.
Páginas: [1]
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines