PageRenderTime 48ms CodeModel.GetById 26ms RepoModel.GetById 0ms app.codeStats 0ms

/clases/dame_fotos.php

https://bitbucket.org/weddcam/develop_weddcam
PHP | 63 lines | 61 code | 2 blank | 0 comment | 12 complexity | 11e8bedcd92145a3243f32a912af54fa MD5 | raw file
Possible License(s): BSD-3-Clause, GPL-2.0, MIT, LGPL-3.0, LGPL-2.1
  1. <?php
  2. header('Content-type: application/json');
  3. include 'conexion_publico.php';
  4. $cuantos=false;$primvez=true;
  5. $dml = "select nombre_foto, titulo "
  6. ." from v_ranking_fotos_mes "
  7. ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='1' "
  8. ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
  9. $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
  10. while ( $aRow = mysql_fetch_array( $result ) )
  11. {
  12. if ($primvez) {$cuantos= true;$primvez=false;$output[0][] = '1';}
  13. $output[0][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
  14. }
  15. if (!$cuantos) {
  16. $output[0][0] = '0';
  17. }
  18. $primvez=true;$cuantos=false;
  19. $dml = "select nombre_foto, titulo "
  20. ." from v_ranking_fotos_mes "
  21. ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='2' "
  22. ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
  23. $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
  24. while ( $aRow = mysql_fetch_array( $result ) )
  25. {
  26. if ($primvez) {$cuantos= true;$primvez=false;$output[1][] = '1';}
  27. $output[1][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
  28. }
  29. if (!$cuantos) {
  30. $output[1][0] = '0';
  31. }
  32. $primvez=true;$cuantos=false;
  33. $dml = "select nombre_foto, titulo "
  34. ." from v_ranking_fotos_mes "
  35. ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='3' "
  36. ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
  37. $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
  38. while ( $aRow = mysql_fetch_array( $result ) )
  39. {
  40. if ($primvez) {$cuantos= true;$primvez=false;$output[2][] = '1';}
  41. $output[2][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
  42. }
  43. if (!$cuantos) {
  44. $output[2][0] = '0';
  45. }
  46. $primvez=true;$cuantos=false;
  47. $dml = "select nombre_foto, titulo "
  48. ." from v_ranking_fotos_mes "
  49. ." where ano_voto='".$_POST['ano']."' and mes_voto='".$_POST['mes']."' and id_categoria='4' "
  50. ." order by ano_voto desc, mes_voto desc,id_categoria, numero_votos desc limit 25";
  51. $result = mysql_query($dml) or die("error-leer_fotos".mysql_error());
  52. while ( $aRow = mysql_fetch_array( $result ) )
  53. {
  54. if ($primvez) {$cuantos= true;$primvez=false;$output[3][] = '1';}
  55. $output[3][]=$aRow['nombre_foto'].'[crm]'.$aRow['titulo'];
  56. }
  57. if (!$cuantos) {
  58. $output[3][0] = '0';
  59. }
  60. echo json_encode( $output );
  61. ?>