-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreport.php
129 lines (122 loc) · 5.05 KB
/
report.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
<?php
include("backend/connection.php");
try {
$conn = new PDO("mysql:host=$servername;dbname=$dbname", $username, $password);
//Set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
//Define sql query
$sql = "SELECT name, email, phone, cpf, dtm_register FROM register";
$stmt = $conn->prepare($sql);
$stmt->execute();
//Set the resulting array to associative
$results = $stmt->setFetchMode(PDO::FETCH_ASSOC);
$results = $stmt->fetchAll();
}
catch(PDOException $e) {
echo "Error: " . $e->getMessage();
}
$conn = null;
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"/>
<meta name="description" content="Cadastro de usuário"/>
<meta name="author" content="Raphael Alves"/>
<title>Site</title>
<link rel="icon" href="favicon.png" sizes="32x32" type="image/png"/>
<!-- Lato and Montserrat fonts -->
<link href="frontend/css/fonts.css" rel="stylesheet" type="text/css"/>
<!-- Bootstrap core CSS -->
<link href="components/bootstrap/css/bootstrap.min.css" rel="stylesheet"/>
<!-- Custom style -->
<link rel="stylesheet" href="frontend/css/style.css"/>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/font/bootstrap-icons.css">
</head>
<body>
<!-- Navigation section-->
<?php include("nav.php") ?>
<!-- Search section -->
<section class="mt-4">
<div class="container">
<form id="formRegister" novalidate>
<div class="row input-group input-group-lg">
<div class="col-12 col-sm-5">
<label for="type">Selecione o campo para pesquisa:</label>
<div class="input-group input-group-lg">
<select name="type" id="type" class="form-control input-lg searchRegister">
<option value="name" selected>Nome</option>
<option value="email">Email</option>
<option value="phone">Telefone</option>
<option value="cpf">CPF</option>
</select>
</div>
</div>
<div class="col-12 col-sm-7">
<div class="input-group input-group-lg mt-4 pt-2">
<input type="text" id="change" class="form-control searchRegister" name="change" placeholder="Digite seu nome" autofocus="autofocus">
<div class="input-group-btn">
<button class="btn btn-success btn-lg" type="submit"><i class="bi-search"></i></button>
</div>
</div>
</div>
</div>
</form>
</div>
</section>
<!-- Report section -->
<section>
<div class="container">
<div id="txtHint"></div>
<div class="row mt-5">
<div class="col-lg-12 mx-auto">
<div class="table-responsive-md">
<table class="table table-striped table-hover">
<thead>
<tr>
<th scope="col">Nome</th>
<th scope="col">Email</th>
<th scope="col">Telefone</th>
<th scope="col">CPF</th>
<th scope="col">Editar</th>
</tr>
</thead>
<tbody id="responseTable">
<?php
foreach($results as $register){
$phone = "(".substr($register[phone],0,2).") ".substr($register[phone],2,4)."-".substr($register[phone],6,4);
$cpf = substr($register[cpf],0,3).".".substr($register[cpf],3,3).".".substr($register[cpf],6,3)."-".substr($register[cpf],9,2);
echo '<tr>
<td>'.$register[name].'</td>
<td>'.$register[email].'</td>
<td>'.$phone.'</td>
<td>'.$cpf.'</td>
<td class="text"><a href="registerView.php?email='.$register[email].'"><i class="bi-eye-fill text-info mr-3"></i></a>
<a href="registerEdit.php?email='.$register[email].'"><i class="bi-pencil-fill text-info mr-3"></i></a>
<a id="'.$register[email].'" href="" onclick="deletert(this.id)"><i class="bi-trash-fill text-danger"></i></a></td>
</tr>';
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</section>
<!-- End section -->
<!-- Footer section-->
<?php include("footer.php") ?>
<!-- Jquery -->
<script src="components/jquery/jquery.min.js"></script>
<!-- Bootstrap javascript base -->
<script src="components/bootstrap/js/bootstrap.bundle.min.js"></script>
<!-- ImaskJS plugin -->
<script src="https://unpkg.com/imask"></script>
<!-- Bootstrap form validation -->
<script src="form-validation.js"></script>
<!-- Custom scripts -->
<script src="frontend/js/scriptReport.js"></script>
</body>
</html>