-
Notifications
You must be signed in to change notification settings - Fork 0
/
gerenciar_usuarios.php
139 lines (134 loc) · 3.99 KB
/
gerenciar_usuarios.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
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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
<?php
session_start();
include('config/db.php');
if (!isset($_SESSION['username'])) {
header('Location: index.php');
exit();
}
// Buscar usuários
$query = "SELECT id, username FROM usuarios";
$result = mysqli_query($conn, $query);
if (!$result) {
die("Erro ao buscar usuários: " . mysqli_error($conn));
}
$usuarios = mysqli_fetch_all($result, MYSQLI_ASSOC);
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Gerenciamento de Usuários</title>
<link rel="apple-touch-icon" sizes="180x180" href="img/favicon_io/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="32x32" href="img/favicon_io/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="img/favicon_io/favicon-16x16.png">
<link rel="manifest" href="img/favicon_io/site.webmanifest">
<style>
body {
font-family: Arial, sans-serif;
color: #005073;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
}
.sidebar {
width: 250px;
height: 100vh;
background-color: #333;
color: #fff;
padding: 20px;
position: fixed;
top: 0;
left: 0;
display: flex;
flex-direction: column;
z-index: 1000;
}
.sidebar h3 {
margin-top: 0;
}
.sidebar a {
text-decoration: none;
color: #fff;
display: block;
padding: 10px;
margin: 5px 0;
border-radius: 4px;
transition: background-color 0.3s ease;
}
.sidebar a:hover {
background-color: #575757;
}
.sidebar ul {
list-style-type: none;
padding: 0;
margin: 0;
}
.content {
margin-left: 250px;
padding: 20px;
width: calc(100% - 250px);
}
table {
width: 100%;
border-collapse: collapse;
margin-bottom: 20px;
}
table, th, td {
border: 1px solid #ccc;
}
th, td {
padding: 10px;
text-align: left;
}
th {
background-color: #f4f4f4;
}
button, a.button {
background-color: #079DC2;
color: white;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
text-decoration: none;
display: inline-block;
}
button:hover, a.button:hover {
background-color: #005073;
}
.actions {
display: flex;
gap: 10px;
}
</style>
</head>
<body>
<?php include('dashboard.php'); ?> <!-- Inclui o menu lateral -->
<div class="content">
<h2>Gerenciamento de Usuários</h2>
<table>
<thead>
<tr>
<th>ID</th>
<th>Nome de Usuário</th>
<th>Ações</th>
</tr>
</thead>
<tbody>
<?php foreach ($usuarios as $usuario): ?>
<tr>
<td><?php echo htmlspecialchars($usuario['id']); ?></td>
<td><?php echo htmlspecialchars($usuario['username']); ?></td>
<td class="actions">
<a href="alterar_senha.php?id=<?php echo htmlspecialchars($usuario['id']); ?>" class="button">Alterar Senha</a>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<a href="registrar_usuario.php"><button>Cadastrar Novo Usuário</button></a>
</div>
</body>
</html>