-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlistaUsuario.php
More file actions
49 lines (40 loc) · 1.51 KB
/
listaUsuario.php
File metadata and controls
49 lines (40 loc) · 1.51 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
<?php
//Importar classes e conexao com o banco
include('class/connection.php');
include('class/model.php');
$dat = new Dados();
if (isset($_GET['excluir'])) {
$id_excl = $_GET['excluir'];
$dadosMat = $dat->deletaUsuario($conn, $id_excl);
if ($dadosMat == true) {
echo "<script type='javascript'>alert('Material deletado com Sucesso!');";
echo "javascript:window.location='listaMaterial.php';</script>";
}
}
//Header
include('includes/header.php'); ?>
<table class="table">
<thead>
<tr>
<th scope="col">CPF</th>
<th scope="col">Nome Usuario</th>
<th scope="col">Tipo Usuario</th>
</tr>
</thead>
<tbody>
<?php
$consulta = $conn->query("SELECT * FROM tb_usuario;");
while ($linha = $consulta->fetch(PDO::FETCH_ASSOC)) { ?>
<tr>
<th scope="row"><?php echo $linha['id_cpf']; ?></th>
<td><?php echo $linha['nome']; ?></td>
<td><?php if($linha['tipo_usuario'] == 3){echo 'administrador';}elseif($linha['tipo_usuario'] == 2){echo 'Gerente';}else{echo 'usuario';} ?></td>
<td><a href="alterarUsuario.php?id=<?php echo $linha['id_cpf'];?>"><button type="submit" class="btn btn-warning">Alterar</button></a><a href="?excluir=<?php echo $linha['id_cpf']; ?>"><button type="submit" class="btn btn-danger">Excluir</button></a>
<td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
//footer
include('includes/footer.php') ?>