-
-
Notifications
You must be signed in to change notification settings - Fork 40
/
Copy pathsistema.php
139 lines (136 loc) · 6.15 KB
/
sistema.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_once('config.php');
// print_r($_SESSION);
if((!isset($_SESSION['email']) == true) and (!isset($_SESSION['senha']) == true))
{
unset($_SESSION['email']);
unset($_SESSION['senha']);
header('Location: login.php');
}
$logado = $_SESSION['email'];
if(!empty($_GET['search']))
{
$data = $_GET['search'];
$sql = "SELECT * FROM usuarios WHERE id LIKE '%$data%' or nome LIKE '%$data%' or email LIKE '%$data%' ORDER BY id DESC";
}
else
{
$sql = "SELECT * FROM usuarios ORDER BY id DESC";
}
$result = $conexao->query($sql);
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<title>SISTEMA | GN</title>
<style>
body{
background: linear-gradient(to right, rgb(20, 147, 220), rgb(17, 54, 71));
color: white;
text-align: center;
}
.table-bg{
background: rgba(0, 0, 0, 0.3);
border-radius: 15px 15px 0 0;
}
.box-search{
display: flex;
justify-content: center;
gap: .1%;
}
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<div class="container-fluid">
<a class="navbar-brand" href="#">SISTEMA DO GN</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
</div>
<div class="d-flex">
<a href="sair.php" class="btn btn-danger me-5">Sair</a>
</div>
</nav>
<br>
<?php
echo "<h1>Bem vindo <u>$logado</u></h1>";
?>
<br>
<div class="box-search">
<input type="search" class="form-control w-25" placeholder="Pesquisar" id="pesquisar">
<button onclick="searchData()" class="btn btn-primary">
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search" viewBox="0 0 16 16">
<path d="M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.1zM12 6.5a5.5 5.5 0 1 1-11 0 5.5 5.5 0 0 1 11 0z"/>
</svg>
</button>
</div>
<div class="m-5">
<table class="table text-white table-bg">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Nome</th>
<th scope="col">Senha</th>
<th scope="col">Email</th>
<th scope="col">Telefone</th>
<th scope="col">Sexo</th>
<th scope="col">Data de Nascimento</th>
<th scope="col">Cidade</th>
<th scope="col">Estado</th>
<th scope="col">Endereço</th>
<th scope="col">...</th>
</tr>
</thead>
<tbody>
<?php
while($user_data = mysqli_fetch_assoc($result)) {
echo "<tr>";
echo "<td>".$user_data['id']."</td>";
echo "<td>".$user_data['nome']."</td>";
echo "<td>".$user_data['senha']."</td>";
echo "<td>".$user_data['email']."</td>";
echo "<td>".$user_data['telefone']."</td>";
echo "<td>".$user_data['sexo']."</td>";
echo "<td>".$user_data['data_nasc']."</td>";
echo "<td>".$user_data['cidade']."</td>";
echo "<td>".$user_data['estado']."</td>";
echo "<td>".$user_data['endereco']."</td>";
echo "<td>
<a class='btn btn-sm btn-primary' href='edit.php?id=$user_data[id]' title='Editar'>
<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-pencil' viewBox='0 0 16 16'>
<path d='M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168l10-10zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207 11.207 2.5zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293l6.5-6.5zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325z'/>
</svg>
</a>
<a class='btn btn-sm btn-danger' href='delete.php?id=$user_data[id]' title='Deletar'>
<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='currentColor' class='bi bi-trash-fill' viewBox='0 0 16 16'>
<path d='M2.5 1a1 1 0 0 0-1 1v1a1 1 0 0 0 1 1H3v9a2 2 0 0 0 2 2h6a2 2 0 0 0 2-2V4h.5a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H10a1 1 0 0 0-1-1H7a1 1 0 0 0-1 1H2.5zm3 4a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5zM8 5a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7A.5.5 0 0 1 8 5zm3 .5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 1 0z'/>
</svg>
</a>
</td>";
echo "</tr>";
}
?>
</tbody>
</table>
</div>
</body>
<script>
var search = document.getElementById('pesquisar');
search.addEventListener("keydown", function(event) {
if (event.key === "Enter")
{
searchData();
}
});
function searchData()
{
window.location = 'sistema.php?search='+search.value;
}
</script>
</html>