Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <meta charset="utf-8">
- <title>Galeria</title>
- <style type="text/css">
- body{
- background-color: rgb(46, 49, 49);
- color: white;
- font-family: "Comic Sans Ms"
- }
- .nav{
- background-color: rgb(63, 195, 128);
- border-radius: 7px;
- text-align: center;
- padding-bottom: 1px;
- padding-top: 3px;
- margin: auto;
- width: 500px;
- }
- .nav1{
- background-color: rgb(63, 195, 128);
- border-radius: 7px;
- text-align: center;
- padding-bottom: 1px;
- padding-top: 3px;
- }
- button {
- background-color: rgb(236, 240, 241);
- border: none;
- color: black;
- text-align: center;
- text-decoration: none;
- display: inline;
- }
- a:link {
- color: black;
- text-decoration: none;
- }
- a:visited {
- color: black;
- text-decoration: none;
- }
- a:hover {
- color: black;
- text-decoration: none;
- }
- a:active {
- color: black;
- text-decoration: none;
- }
- </style>
- </head>
- <body>
- <?php
- ?>
- <?php
- $bd_host="localhost";
- $bd_user="root";
- $bd_password="";
- $bd_database="galeria";
- $tipo="";
- $msg="";
- $erro=0;
- $ms = new mysqli($bd_host,$bd_user,$bd_password,$bd_database);
- $num=$nome=$telem=$email=$foto='';
- if ($ms->connect_error) {
- $msg= '<h3 class="erro">Erro: ('. $ms->connect_errno .') '. $ms->connect_error . '</h3>';
- $erro=1;
- }
- ?>
- <?php
- if(isset($_POST["submitz"])){
- if($_POST["nome1"]!="" && $_POST["pass"]!="")
- {
- $qr = "select nome from galeria_registos where nome =? and Password=?";
- $ordem = $ms->prepare($qr);
- $ordem->bind_param('ss', $_POST['nome1'],$_POST['pass']);
- $ordem->execute();
- $ordem->bind_result($nome);
- if($ordem->fetch()){
- $existe=true;
- $_SESSION["nid"]=session_id();
- $_SESSION["nome1"]=$nome;
- $msg='<h3 class="sucesso">Sucesso!</h3>';
- include 'cabecalho3.php';
- }
- else{
- $existe=false;
- $msg='<h3 class="erro">Erro, Dados de acesso errados!</h3>';
- }
- $ordem->close();
- }
- }
- else{
- include 'cabecalho1.php';
- }
- ?>
- <?php
- $qr = "SELECT imagem from galeria_fotos";
- echo "<br>";
- $results = $ms->query($qr);
- echo "<h1 class='nav'>TODAS AS FOTOS</h1><br>";
- echo "";
- echo "<table style='margin:auto' colspan='2'>";
- while ($row = $results->fetch_assoc()) {
- echo "<tr>";
- echo "<td>";
- ?>
- <img src="<?php echo $row['imagem'];?>" width="200px">
- <?php
- echo "</td>";
- echo "<td>";
- if($row = $results->fetch_assoc()){
- ?>
- <img src="<?php echo $row['imagem'];?>" width="200px">
- <?php
- echo "</td>";
- }
- echo "<td>";
- if($row = $results->fetch_assoc()){
- ?>
- <img src="<?php echo $row['imagem'];?>" width="200px">
- <?php
- echo "</td>";
- }
- echo "</tr>";
- }
- echo "</table>";
- echo "</div>";
- ?>
- <?php
- if (isset($_POST['pesq']))
- {
- $qr="SELECT tipo FROM galeria where tipo=?";
- $st=$ms->prepare($qr);
- $st->bind_param('s', $_POST["numeroo"]);
- $st->execute();
- $st->bind_result($tipo);
- if($st->fetch())
- $st->close();
- $qro="SELECT imagem from galeria_fotos inner join galeria on galeria_fotos.tipo=galeria.tipo WHERE galeria_fotos.tipo='$tipo'";
- $results = $ms->query($qro);
- echo "<div>";
- echo "<br><h1 class='nav'>Fotos por tipo selecionado</h1><br>";
- echo "<table style='margin:auto'>";
- while ($row1 = $results->fetch_assoc()) {
- echo "<tr>";
- echo "<td>";
- ?>
- <img src="<?php echo $row1['imagem'];?>" width="200px">
- <?php
- echo "</td>";
- echo "<td>";
- if($row1 = $results->fetch_assoc()){
- ?>
- <img src="<?php echo $row1['imagem'];?>" width="200px">
- <?php
- echo "</td>";
- }
- echo "<td>";
- if($row1 = $results->fetch_assoc()){
- ?>
- <img src="<?php echo $row['imagem'];?>" width="200px">
- <?php
- echo "</td>";
- }
- echo "</tr>";
- }
- echo "</table>";
- echo "</div>";
- }
- ?>
- <form class="" action="" method="post" name="tipoxx">
- <input type="hidden" name="pesq" value="1">
- <br><br>
- <h4 style="text-align:center">Tipo<select name="numeroo" onchange="document.tipoxx.submit();">
- <option value=""></option>
- <?php
- $qr="SELECT tipo FROM galeria";
- $st = $ms->query($qr);
- while($row = $st->fetch_assoc())
- {
- echo '<option value = "'.$row['tipo'].'">'.$row['tipo'].' </option>';
- }
- $st->close();
- ?>
- </select></h4>
- <br><br>
- </form>
- <?php
- echo $msg;
- ?>
- <?php
- if (isset($_POST["logout"]))
- {
- session_unset();
- session_destroy();
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement