-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
101 lines (92 loc) · 2.72 KB
/
index.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
<?php
require_once "koneksi.php";
session_start();
if (!isset($_SESSION['user_fullname'])) {
header('location: login.php');
exit();
}
$userID = $_SESSION['user_id'];
$query = "SELECT * FROM user_detail WHERE id = $userID";
$result = mysqli_query($koneksi, $query);
if (!$result) {
die("Query error: " . mysqli_error($koneksi));
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Home</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container mt-5">
<div class="row">
<div class="col-md-12">
<h2>Selamat datang, <?php echo $_SESSION['user_fullname']; ?></h2>
<h3>Data dari Database</h3>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Email</th>
<th>Nama</th>
<th>Level</th>
</tr>
</thead>
<tbody>
<?php while ($row = mysqli_fetch_assoc($result)) { ?>
<tr>
<td><?php echo $row['id']; ?></td>
<td><?php echo $row['user_email']; ?></td>
<td><?php echo $row['user_fullname']; ?></td>
<td><?php echo $row['level']; ?></td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap/dist/js/bootstrap.min.js"></script>
</body>
</html>
<!-- <?php
require("koneksi.php");
$email = $_GET['user_fullname'];
?>
<html>
<head>
<title>Home</title>
</head>
<body>
<h1>Selamat Datang <?php echo $email; ?></h1>
<table border='1'>
<tr>
<td>No</td>
<td>Email</td>
<td>Nama</td>
<td></td>
</tr>
<?php
$query = "SELECT * FROM user_detail";
$result = mysqli_query($koneksi, $query);
$no = 1;
while ($row = mysqli_fetch_array($result)) {
$userMail = $row['user_email'];
$userName = $row['user_fullname'];
?>
<tr>
<td><?php echo $no; ?></td>
<td><?php echo $userMail; ?></td>
<td><?php echo $userName; ?></td>
<td></td>
</tr>
<?php
$no++;
}
?>
</table>
</body>
</html> -->