-
Notifications
You must be signed in to change notification settings - Fork 0
/
tampil_user.php
76 lines (74 loc) · 2.98 KB
/
tampil_user.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
<?php
session_start();
if (empty($_SESSION['username']) || empty($_SESSION['password']) || $_SESSION['level'] !== 'admin') {
echo "<script>
setTimeout(function() {
alert('Anda tidak memiliki akses');
window.location = 'login.php';
}, 1000); // Delay 1 detik
</script>";
} else {
// Ambil level pengguna dari sesi
$level = $_SESSION['level'];
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Data Pengguna</title>
<link href="bootstrap-5.3.2-dist/css/bootstrap.min.css" rel="stylesheet">
<script src="bootstrap-5.3.2-dist/js/bootstrap.bundle.min.js"></script>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-12 mb-4">
<?php include "menu.php"; ?>
</div>
</div>
<div class="card border-info mb-4">
<div class="card-header bg-info text-white">
<h4 class="m-0">Data Pengguna</h4>
</div>
<div class="card-body text-success">
<div class="row">
<div class="col-md-12">
<table class="table table-bordered table-striped table-hover">
<thead>
<tr>
<th>No</th>
<th>Username</th>
<th>Nama Lengkap</th>
<th>Level</th>
</tr>
</thead>
<tbody>
<?php
include "config/koneksi.php";
$i = 0;
$tampil = mysqli_query($koneksi, "SELECT username, nama_lengkap, level FROM tbl_user");
while ($data = mysqli_fetch_array($tampil)) {
$i++;
?>
<tr>
<td><?= $i ?></td>
<td><?= $data['username'] ?></td>
<td><?= $data['nama_lengkap'] ?></td>
<td><?= $data['level'] ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
<?php
}
?>