-
Notifications
You must be signed in to change notification settings - Fork 0
/
categoriaall.php
167 lines (147 loc) · 5.64 KB
/
categoriaall.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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
<?php
session_start();
if(isset($_SESSION["user"]) && is_array($_SESSION["user"])){
include("basedados/config.php");
$nivelsession = $_SESSION["user"][4];
$passwordsession = $_SESSION["user"][3];
$emailsession = $_SESSION["user"][2];
$namesession = $_SESSION["user"][1];
$idsession = $_SESSION["user"][0];
$sql = ("SELECT * FROM `loginregister`");
// executa a query
$result = mysqli_query($conn, $sql);
// transforma os dados em um array
$linha = mysqli_fetch_array($result);
// calcula quantos dados retornaram
$total = mysqli_num_rows($result);
}else{
echo "<script>window.location = 'login.php'</script>";
}
?>
<!DOCTYPE html>
<html>
<head>
<link rel="shortcut icon" href="img/lifestyleStore.png" />
<title>Contas</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<style type="text/css">
body{
padding-top:0px;
padding-bottom:50px;
margin-bottom: 20px;
text-align:center;
border: 0px solid black;
padding: 25px;
background: url('img/dashboard.jpg') center center no-repeat fixed;
background-repeat: no-repeat;
background-size: 100% 100%;
}
.container {
width: 600px;
min-height: 400px;
background: #FFF;
border-radius: 10px;
box-shadow: 0 0 5px rgba(0,0,0,.3);
padding: 40px 30px;
}
.container .login-text{
color: #111;
font-weight: 500;
font-size: 1.1rem;
text-align: center;
margin-bottom: 20px;
display: block;
text-transform: capitalize;
}
.container .login-email .input-group {
width: 100%;
height: 50px;
margin-bottom: 25px;
}
.container .login-email .input-group input {
width: 100%;
height: 100%;
border: 2px solid #e7e7e7;
padding: 15px 20px;
font-size: 1.5rem;
border-radius: 30px;
background: transparent;
outline: none;
transition: .3s;
}
.container .login-email .input-group input:focus, .container .login-email .input-group input:valid {
border-color: #a29bfe;
}
.container .input-group .btn {
display: block;
width: 100%;
padding: 15px 20px;
text-align: center;
border: none;
background: #a29bfe;
outline: none;
border-radius: 30px;
font-size: 1.5rem;
color: #FFF;
cursor: pointer;
transition: .3s;
}
</style>
</head>
<body>
<?php
require 'dashboardnav.php';
?>
<?php if($nivelsession ==1): ?>
<center>
<div class="container">
<table width="40%" class="login-email">
<tbody>
<?php
$query = "SELECT * FROM categoria ";
if(isset($_POST['submit'])){
$search_term = mysqli_real_escape_string($conn, $_POST['search']);
$query .= "WHERE categoria LIKE '%{$search_term}%'";
}
if (isset($_POST["back"])){
$query = "SELECT * FROM categoria ";
}
$result = mysqli_query($conn, $query);
if(mysqli_num_rows($result) > 0){
?>
<tr style="font-weight: bold">
<td>ID</td>
<td>Categoria</td>
</tr>
<?php
foreach ($result as $linha) {
?>
<tr>
<td><?=$linha["id"]; ?></td>
<td><?=$linha["categoria"]; ?></td>
</tr>
<?php
}
}else{
?>
<tr>
<td colspan="6">Sem Categorias registradas</td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</center>
<?php endif; ?>
<br>
<?php
require 'footer.php';
?>
</body>
</html>