-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdashboard.php
More file actions
156 lines (133 loc) · 3.42 KB
/
dashboard.php
File metadata and controls
156 lines (133 loc) · 3.42 KB
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
<?php
session_start();
if (!isset($_SESSION['email'])) {
header("Location: index.php");
exit;
}
$email = $_SESSION['email'];
$conn = new mysqli("localhost", "root", "", "tetris");
if ($conn->connect_error) {
die("Koneksi gagal: " . $conn->connect_error);
}
$query = $conn->prepare("SELECT skor, waktu_bermain, waktu_pencapaian FROM dashboard WHERE email = ? ORDER BY waktu_pencapaian DESC");
$query->bind_param("s", $email);
$query->execute();
$result = $query->get_result();
?>
<!DOCTYPE html>
<html lang="id">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Dashboard - Riwayat Permainan</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html,
body {
height: 100%;
font-family: 'Segoe UI', sans-serif;
background-color: #e8f0ff;
/* biru muda */
}
.container {
max-width: 900px;
margin: 0 auto;
padding: 40px 20px;
background-color: white;
border-radius: 12px;
box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
margin-top: 60px;
}
h1 {
text-align: center;
color: #1e3a8a;
margin-bottom: 24px;
}
.email-info {
font-size: 16px;
text-align: center;
margin-bottom: 24px;
}
.email-info span {
font-weight: bold;
color: #1e40af;
}
.back-link {
text-align: right;
margin-bottom: 20px;
}
.back-link a {
display: inline-block;
padding: 10px 18px;
background-color: #1e40af;
color: white;
text-decoration: none;
border-radius: 6px;
transition: background-color 0.3s ease;
}
.back-link a:hover {
background-color: #2563eb;
}
table {
width: 100%;
border-collapse: collapse;
}
table th,
table td {
border: 1px solid #d1d5db;
padding: 12px;
text-align: center;
}
table thead {
background-color: #dbeafe;
/* biru sangat muda */
}
table tbody tr:nth-child(even) {
background-color: #f0f9ff;
}
.empty-row td {
padding: 20px;
color: #555;
}
</style>
</head>
<body>
<div class="container">
<h1>Profil Anda - Riwayat Permainan</h1>
<div class="back-link">
<a href="index.php">← Kembali ke Beranda</a>
</div>
<div class="email-info">
Email: <span><?= htmlspecialchars($email) ?></span>
</div>
<table>
<thead>
<tr>
<th>Skor</th>
<th>Waktu Bermain (detik)</th>
<th>Waktu Pencapaian</th>
</tr>
</thead>
<tbody>
<?php if ($result->num_rows > 0): ?>
<?php while ($row = $result->fetch_assoc()): ?>
<tr>
<td><?= $row['skor'] ?></td>
<td><?= $row['waktu_bermain'] ?></td>
<td><?= $row['waktu_pencapaian'] ?></td>
</tr>
<?php endwhile; ?>
<?php else: ?>
<tr class="empty-row">
<td colspan="3">Belum ada riwayat permainan.</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</body>
</html>