-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathanuncios.php
More file actions
113 lines (92 loc) · 3.55 KB
/
anuncios.php
File metadata and controls
113 lines (92 loc) · 3.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<?php
/**
* Created by PhpStorm.
* User: felipebhz
* Date: 2019-09-01
* Time: 13:39
*/
session_start();
require 'init.php';
if ((!isset($_SESSION['user']) == true) and (!isset($_SESSION['pass']) == true)) {
unset($_SESSION['user']);
unset($_SESSION['pass']);
header('location:login.php');
}
$anuncios = (new BD())->query("SELECT a.id AS id_anunciante, a.nome AS anunciante, a.cep AS cep_anunciante, an.id AS id_anuncio, an.texto AS texto,
an.cep AS cep_anuncio
FROM anunciantes a
JOIN anuncios an ON a.id = an.id_anunciante;");
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel='stylesheet' href='https://use.fontawesome.com/releases/v5.4.1/css/all.css' integrity='sha384-5sAR7xN1Nv6T6+dT2mhtzEpVJvfS3NScPQTrOxhwjIuvcA67KV2R5Jz6kr4abQsz' crossorigin='anonymous'>
<link href="fonts/fonts.css" rel="stylesheet">
<link rel="stylesheet" href="style.css">
<!-- Arquivos do DataTable -->
<!-- DataTable CSS -->
<link href="https://cdn.datatables.net/1.10.19/css/jquery.dataTables.min.css" rel="stylesheet">
<!-- Scripts do DataTables MD -->
<!-- JQuery -->
<script type=" text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<!-- Data Table JS -->
<script type="text/javascript" src="https://cdn.datatables.net/1.10.19/js/jquery.dataTables.min.js"></script>
<title>comuREDE</title>
</head>
<body>
<header class="header">
<img class="header__logo" src="images/logo-comuREDE_02.png" alt="Logo comuREDE">
</header>
<main class="container">
<a class="btn__default formRegister__itemButton" style="text-decoration: none;" href="setup.php">Setup</a>
<br>
<h2 class="formRegister__title">
Lista de Anúncios Cadastrados:
</h2>
<div style="width: 100%;" class="table-bg p-20">
<table id="myTable" class="table table-striped table-bordered table-sm display compact" style="width:100%"" cellspacing=" 0" width="100%">
<thead>
<tr>
<th class="th-sm">Anunciante</th>
<th class="th-sm">Anúncio</th>
<th class="th-sm">CEP</th>
<th class="th-sm">Ações</th>
</tr>
</thead>
<tbody>
<?php
foreach ($anuncios as $anuncio) : ?>
<tr>
<td><?= $anuncio['anunciante'] ?></td>
<td><?= $anuncio['texto'] ?></td>
<td><?= $anuncio['cep_anuncio'] ?></td>
<td>
<a href="edit-anuncio.php?id=<?=$anuncio['id_anuncio']?>">Editar</a>
</td>
</tr>
<?php endforeach ?>
</tbody>
</table>
</div>
<form class="container__formRegister" method="POST" action="auth.php">
<button class="formRegister__itemButton btn__default">Sair</button>
<input type="hidden" name="logout" value="1">
</form>
</main>
<footer class="footer">
<h2 class="footer__title">Ajude a propagar essa ideia ;)</h2>
<i class="footer__iconsSocial fab fa-facebook-f"></i>
<i class="footer__iconsSocial fab fa-instagram"></i>
<i class="footer__iconsSocial fab fa-twitter"></i>
</footer>
</body>
</html>
<!-- Configuracao da Lib DataTable -->
<script type="text/javascript">
$(document).ready(function() {
$('#myTable').DataTable();
});
</script>