-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·45 lines (37 loc) · 1.05 KB
/
index.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
<?php
session_start();
$_SESSION['jaExiste'] = false;
require "config.php";
require "dao/UsuarioDaoMysql.php";
$usuarioDao = new UsuarioDaoMysql($pdo);
$lista = $usuarioDao->findAll();
?>
<a href="adicionar.php">Adicionar novo</a>
<table border='1' width='100%'>
<tr>
<th>ID</th>
<th>NOME</th>
<th>EMAIL</th>
<th>AÇÕES</th>
</tr>
<?php
if(count($lista)>0){
foreach($lista as $usuario){
echo "<tr>";
echo "<td>".$usuario->getId()."</td>";
echo "<td>".$usuario->getNome()."</td>";
echo "<td>".$usuario->getEmail()."</td>";
echo "<td><a href='editar.php?id=".$usuario->getId()."'>[Editar]</a><a href='excluir.php?id=".$usuario->getId()."' onclick='confirma()'>[Excluir]</a></td>";
echo "<tr>";
}
}
?>
</table>
<script>
function confirma() {
return confirm('Deseja mesmo excluir?');
}
setTimeout(() => {
document.getElementById('desaparece').style.display = 'none';
}, 3000);
</script>