Advertisement
EduzZiTo

Untitled

May 13th, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.28 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <title>Galeria</title>
  6. <style type="text/css">
  7. body{
  8. background-color: rgb(46, 49, 49);
  9. color: white;
  10. font-family: "Comic Sans Ms"
  11. }
  12. .nav{
  13. background-color: rgb(63, 195, 128);
  14. border-radius: 7px;
  15. text-align: center;
  16. padding-bottom: 1px;
  17. padding-top: 3px;
  18. margin: auto;
  19. width: 500px;
  20. }
  21. .nav1{
  22. background-color: rgb(63, 195, 128);
  23. border-radius: 7px;
  24. text-align: center;
  25. padding-bottom: 1px;
  26. padding-top: 3px;
  27. }
  28. button {
  29.  
  30. background-color: rgb(236, 240, 241);
  31. border: none;
  32. color: black;
  33.  
  34. text-align: center;
  35. text-decoration: none;
  36. display: inline;
  37.  
  38. }
  39. a:link {
  40. color: black;
  41. text-decoration: none;
  42. }
  43.  
  44. a:visited {
  45. color: black;
  46. text-decoration: none;
  47. }
  48.  
  49. a:hover {
  50. color: black;
  51. text-decoration: none;
  52. }
  53.  
  54. a:active {
  55. color: black;
  56. text-decoration: none;
  57. }
  58. </style>
  59. </head>
  60. <body>
  61. <?php
  62.  
  63. ?>
  64.  
  65.  
  66. <?php
  67. $bd_host="localhost";
  68. $bd_user="root";
  69. $bd_password="";
  70. $bd_database="galeria";
  71. $tipo="";
  72. $msg="";
  73. $erro=0;
  74. $ms = new mysqli($bd_host,$bd_user,$bd_password,$bd_database);
  75. $num=$nome=$telem=$email=$foto='';
  76. if ($ms->connect_error) {
  77. $msg= '<h3 class="erro">Erro: ('. $ms->connect_errno .') '. $ms->connect_error . '</h3>';
  78. $erro=1;
  79. }
  80.  
  81. ?>
  82. <?php
  83. if(isset($_POST["submitz"])){
  84. if($_POST["nome1"]!="" && $_POST["pass"]!="")
  85. {
  86. $qr = "select nome from galeria_registos where nome =? and Password=?";
  87. $ordem = $ms->prepare($qr);
  88. $ordem->bind_param('ss', $_POST['nome1'],$_POST['pass']);
  89. $ordem->execute();
  90. $ordem->bind_result($nome);
  91. if($ordem->fetch()){
  92. $existe=true;
  93. $_SESSION["nid"]=session_id();
  94. $_SESSION["nome1"]=$nome;
  95.  
  96. $msg='<h3 class="sucesso">Sucesso!</h3>';
  97. include 'cabecalho3.php';
  98.  
  99. }
  100. else{
  101. $existe=false;
  102. $msg='<h3 class="erro">Erro, Dados de acesso errados!</h3>';
  103. }
  104. $ordem->close();
  105. }
  106.  
  107. }
  108. else{
  109. include 'cabecalho1.php';
  110.  
  111. }
  112. ?>
  113. <?php
  114.  
  115. $qr = "SELECT imagem from galeria_fotos";
  116. echo "<br>";
  117. $results = $ms->query($qr);
  118. echo "<h1 class='nav'>TODAS AS FOTOS</h1><br>";
  119. echo "";
  120.  
  121.  
  122. echo "<table style='margin:auto' colspan='2'>";
  123. while ($row = $results->fetch_assoc()) {
  124. echo "<tr>";
  125. echo "<td>";
  126. ?>
  127. <img src="<?php echo $row['imagem'];?>" width="200px">
  128. <?php
  129. echo "</td>";
  130. echo "<td>";
  131. if($row = $results->fetch_assoc()){
  132.  
  133. ?>
  134. <img src="<?php echo $row['imagem'];?>" width="200px">
  135. <?php
  136. echo "</td>";
  137. }
  138. echo "<td>";
  139. if($row = $results->fetch_assoc()){
  140. ?>
  141. <img src="<?php echo $row['imagem'];?>" width="200px">
  142. <?php
  143. echo "</td>";
  144. }
  145. echo "</tr>";
  146. }
  147. echo "</table>";
  148. echo "</div>";
  149.  
  150. ?>
  151. <?php
  152. if (isset($_POST['pesq']))
  153. {
  154. $qr="SELECT tipo FROM galeria where tipo=?";
  155. $st=$ms->prepare($qr);
  156. $st->bind_param('s', $_POST["numeroo"]);
  157. $st->execute();
  158. $st->bind_result($tipo);
  159. if($st->fetch())
  160.  
  161. $st->close();
  162.  
  163.  
  164.  
  165. $qro="SELECT imagem from galeria_fotos inner join galeria on galeria_fotos.tipo=galeria.tipo WHERE galeria_fotos.tipo='$tipo'";
  166.  
  167. $results = $ms->query($qro);
  168. echo "<div>";
  169. echo "<br><h1 class='nav'>Fotos por tipo selecionado</h1><br>";
  170. echo "<table style='margin:auto'>";
  171.  
  172. while ($row1 = $results->fetch_assoc()) {
  173. echo "<tr>";
  174. echo "<td>";
  175. ?>
  176. <img src="<?php echo $row1['imagem'];?>" width="200px">
  177. <?php
  178. echo "</td>";
  179.  
  180. echo "<td>";
  181. if($row1 = $results->fetch_assoc()){
  182. ?>
  183. <img src="<?php echo $row1['imagem'];?>" width="200px">
  184. <?php
  185.  
  186. echo "</td>";
  187. }
  188. echo "<td>";
  189. if($row1 = $results->fetch_assoc()){
  190. ?>
  191. <img src="<?php echo $row['imagem'];?>" width="200px">
  192. <?php
  193. echo "</td>";
  194. }
  195. echo "</tr>";
  196. }
  197. echo "</table>";
  198. echo "</div>";
  199.  
  200.  
  201. }
  202.  
  203.  
  204.  
  205.  
  206. ?>
  207.  
  208. <form class="" action="" method="post" name="tipoxx">
  209. <input type="hidden" name="pesq" value="1">
  210. <br><br>
  211. <h4 style="text-align:center">Tipo<select name="numeroo" onchange="document.tipoxx.submit();">
  212. <option value=""></option>
  213. <?php
  214. $qr="SELECT tipo FROM galeria";
  215. $st = $ms->query($qr);
  216. while($row = $st->fetch_assoc())
  217. {
  218. echo '<option value = "'.$row['tipo'].'">'.$row['tipo'].' </option>';
  219. }
  220. $st->close();
  221. ?>
  222. </select></h4>
  223. <br><br>
  224. </form>
  225. <?php
  226. echo $msg;
  227. ?>
  228. <?php
  229. if (isset($_POST["logout"]))
  230. {
  231. session_unset();
  232. session_destroy();
  233.  
  234. }
  235. ?>
  236. </body>
  237. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement