-
Notifications
You must be signed in to change notification settings - Fork 0
/
dashboard.php
123 lines (121 loc) · 4.76 KB
/
dashboard.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
<?php
session_start();
// print_r($_SESSION);
include_once('config.php');
if((!isset($_SESSION['email']) == true) and (!isset($_SESSION['password']) == true))
{
unset($_SESSION['email']);
unset($_SESSION['password']);
header('Location: login.php');
}
$logged = $_SESSION['email'];
if(!empty($_GET['search']))
{
$data = $_GET['search'];
$sql = "SELECT * FROM user WHERE id LIKE '%$data%' or name LIKE '%$data%' or email LIKE '%$data%' ORDER BY id DESC";
}
else
{
$sql = "SELECT * FROM user 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=devide-width, initial-scale=1.0">
<!-- <link rel="stylesheet" type="text/css" href="dashboard.css"> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<title>Sample Dashboard</title>
<style>
body {
background-image: 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="#">DASHBOARD LESSION</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="logout.php" class="btn btn-danger me-5">LOGOUT</a>
</nav>
<br />
<?php
echo "<h1>Welcome, $logged to the Dashboard!</h1>"
?>
<br />
<div class="box-search">
<input type="search" class="form-control w-25" placeholder="Search" id="searchbox">
<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 table-bg">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">Name</th>
<th scope="col">Email</th>
<th scope="col">Phone</th>
<th scope="col">Gender</th>
<th scope="col">Date of Birth</th>
<th scope="col">City</th>
<th scope="col">State</th>
<th scope="col">Address</th>
<th scope="col">Action</th>
</tr>
</thead>
<tbody>
<?php
while($user_data = mysqli_fetch_assoc($result))
{
echo "<tr>";
echo "<td>".$user_data['id']."</td>";
echo "<td>".$user_data['name']."</td>";
echo "<td>".$user_data['email']."</td>";
echo "<td>".$user_data['phone']."</td>";
echo "<td>".$user_data['gender']."</td>";
echo "<td>".$user_data['date_of_birth']."</td>";
echo "<td>".$user_data['city']."</td>";
echo "<td>".$user_data['state']."</td>";
echo "<td>".$user_data['address']."</td>";
echo "<td>
<a class='btn btn-sm btn-primary' href='edit.php?id=$user_data[id]'>
<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]'>
<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 src="search.js"></script>
</html>