-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmeus-anuncios.php
53 lines (46 loc) · 1.29 KB
/
meus-anuncios.php
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
<?php require 'pages/header.php'; ?>
<?php
if(empty($_SESSION['cLogin'])) {
?>
<script type="text/javascript">window.location.href="login.php";</script>
<?php
exit;
}
?>
<div class="container">
<h1>Meus Anúncios</h1>
<a href="add-anuncio.php" class="btn btn-default">Adicionar Anúncio</a>
<table class="table table-striped">
<thead>
<tr>
<th>Foto</th>
<th>Titulo</th>
<th>Valor</th>
<th>Ações</th>
</tr>
</thead>
<?php
require 'classes/anuncios.class.php';
$a = new Anuncios();
$anuncios = $a->getMeusAnuncios();
foreach($anuncios as $anuncio):
?>
<tr>
<td >
<?php if(!empty($anuncio['url'])): ?>
<img src="assets/images/anuncios/<?php echo $anuncio['url']; ?>" height="50" border="0" />
<?php else: ?>
<img src="assets/images/anuncios/produtosemfoto.png" height="50" border="0" />
<?php endif; ?>
</td>
<td><?php echo $anuncio['titulo']; ?></td>
<td>R$ <?php echo number_format($anuncio['valor'], 2); ?></td>
<td>
<a href="editar-anuncio.php?id=<?php echo $anuncio['id']; ?>" class="btn btn-default">Editar</a>
<a href="excluir-anuncio.php?id=<?php echo $anuncio['id']; ?>" class="btn btn-danger">Excluir</a>
</td>
</tr>
<?php endforeach; ?>
</table>
</div>
<?php require'pages/footer.php'; ?>