PageRenderTime 37ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/alcancias_registradas.php

https://gitlab.com/juliocesartors/t-rex-proyect
PHP | 228 lines | 125 code | 93 blank | 10 comment | 14 complexity | 92763eedcabc1f43d97bcd0d93be61a4 MD5 | raw file
  1. <?php
  2. session_start();
  3. if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {
  4. header ("Location: index.php");
  5. }
  6. ?>
  7. <!DOCTYPE html>
  8. <style>
  9. table, th, td {
  10. border: 1px solid black;
  11. }
  12. table.scroll {
  13. width: 100%;
  14. /* border-collapse: collapse; */
  15. border-spacing: 0;
  16. border: 2px solid transparent;
  17. }
  18. th{
  19. background: gray;
  20. /*position:fixed; */
  21. }
  22. table.scroll tbody,
  23. table.scroll thead {
  24. display: inherit;
  25. margin-left: -25%;
  26. }
  27. thead tr th {
  28. height: 30%;
  29. line-height: 30%;
  30. /*text-align: left;*/
  31. }
  32. table.scroll tbody {
  33. height: 100%;
  34. width: 100%;
  35. }
  36. tbody { border-top: 2px solid black; }
  37. tbody td, thead th {
  38. border-right: 1px solid black;
  39. }
  40. tbody td:last-child, thead th:last-child {
  41. border-right: none;
  42. }
  43. </style>
  44. <?php
  45. $rol = $_SESSION['rol'];
  46. if($rol=="Coordinador Parroquial"){
  47. require "base_parroco_coordinador.php";
  48. }
  49. elseif($rol=="Oficina"){
  50. require "base.php";
  51. }
  52. elseif($rol=="Sacerdote"){
  53. header('base_parroco_coordinador.php');
  54. }
  55. elseif($rol=="Coordinador Sectorial"){
  56. header('base_parroco_coordinador.php');
  57. }
  58. elseif($rol=="Coordinador Vicarial"){
  59. header('base_parroco_coordinador.php');
  60. }
  61. ?>
  62. <html class="no-js" lang="">
  63. <head>
  64. <meta charset="utf-8">
  65. <script language="javascript" type="text/javascript" src="js/jquery-1.6.2.js"></script>
  66. <script language="javascript" type="text/javascript" src="js/ajax.js"></script>
  67. <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  68. <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.2/jquery.min.js"></script>
  69. <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
  70. </head>
  71. <body>
  72. <center>
  73. <?php
  74. /*if ($_SESSION['rol'] != 'Oficina' ) {
  75. header ("Location: 404.html");
  76. }
  77. */
  78. $conexion = new mysqli("localhost","tesis","utp.2015","saga");
  79. //$conexion = new mysqli("mysql.campanaarquidiocesana.com","mgcdb","proyectosaga","campana_saga");
  80. if($conexion -> connect_error){
  81. die("Error en la conexion!");
  82. }
  83. else {
  84. ?>
  85. <div id="contenedor2">
  86. <div id="contenedor3">
  87. <form method="GET" action="" id="form1">
  88. <?php
  89. echo("<u><h2>Consulta de alcancias por parroquias</h2></u><br/>");
  90. }
  91. $vicaria = $_POST['slct1'];
  92. $parroquia = $_POST['slct2'];
  93. $indicador = 0;
  94. $result = $conexion->query("SELECT codigo_vicaria from alcancia WHERE codigo_vicaria = '{$vicaria}' LIMIT 1");
  95. $result2 = $conexion->query("SELECT codigo_parroquia from alcancia WHERE codigo_parroquia = '{$parroquia}' LIMIT 1");
  96. $result3 = $conexion->query("SELECT nombre from parroquia WHERE codigo_parroquia = '{$parroquia}' ");
  97. $result4 = $conexion->query("SELECT nombre from vicaria WHERE codigo_vicaria = '{$vicaria}' ");
  98. if ($result->num_rows == 1) {
  99. $indicador = 1;
  100. }
  101. if ($indicador == 1 && $result3->num_rows > 0 && $result4->num_rows > 0){
  102. $row2= $result3->fetch_assoc();
  103. $row3= $result4->fetch_assoc();
  104. echo "<strong>Alcancias registradas en la vicaria: ".$row3['nombre']."<n/> <n/>y parroquia: <n/> <n/>".$row2['nombre'].", <u> Elija una opciĆ³n para desplegar informaciĆ³n</u></strong><br/><br>";
  105. }
  106. $sql = "SELECT `codigo_alcancia` FROM `alcancia` WHERE codigo_vicaria ='{$vicaria}' AND codigo_parroquia = '{$parroquia}' ORDER BY `codigo_alcancia` ASC ";
  107. $result = $conexion->query($sql);
  108. if ($result->num_rows > 0 ) {
  109. echo "<select name='select1' id='select1' >";
  110. while($row = $result->fetch_assoc() ) {
  111. echo "<option value='".$row['codigo_alcancia']."'>".$row['codigo_alcancia']."</option>";
  112. }
  113. echo "</select>";
  114. echo "<br>";
  115. } else {
  116. echo "0 Resultados.";
  117. }
  118. ?>
  119. <br>
  120. <br>
  121. <br>
  122. <input type="button" style="width:37px; height:40px; background-image: url(css/fondos/checkmark.png);" id="ajaxButton" ></input>
  123. <div id="result"></div>
  124. </form>
  125. </div>
  126. </div>
  127. <br>
  128. </body>
  129. <center>
  130. </html>
  131. <?php
  132. require "footer.html";
  133. ?>