savescore
This commit is contained in:
parent
cb96761ae8
commit
2764e7a36c
84
save_score.php
Normal file
84
save_score.php
Normal file
@ -0,0 +1,84 @@
|
||||
<?php
|
||||
require_once 'db.php';
|
||||
|
||||
$sql = "
|
||||
SELECT username, difficulty, time_seconds
|
||||
FROM leaderboard_sudoku
|
||||
ORDER BY difficulty,
|
||||
time_seconds ASC
|
||||
";
|
||||
|
||||
$result = $conn->query($sql);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Leaderboard Sudoku</title>
|
||||
<style>
|
||||
body {
|
||||
font-family: Arial;
|
||||
background: #1e1e1e;
|
||||
color: #fff;
|
||||
padding: 40px;
|
||||
}
|
||||
table {
|
||||
border-collapse: collapse;
|
||||
width: 600px;
|
||||
margin: auto;
|
||||
background: #2b2b2b;
|
||||
}
|
||||
th, td {
|
||||
padding: 12px;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #444;
|
||||
}
|
||||
th {
|
||||
background: #3b3b3b;
|
||||
}
|
||||
h1 {
|
||||
text-align: center;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
.back {
|
||||
display: block;
|
||||
margin: 30px auto;
|
||||
width: 200px;
|
||||
text-align: center;
|
||||
padding: 10px;
|
||||
background: #4caf50;
|
||||
color: white;
|
||||
text-decoration: none;
|
||||
border-radius: 6px;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>🏆 Leaderboard Sudoku</h1>
|
||||
|
||||
<table>
|
||||
<tr>
|
||||
<th>Username</th>
|
||||
<th>Difficulty</th>
|
||||
<th>Time (mm:ss)</th>
|
||||
</tr>
|
||||
|
||||
<?php while ($row = $result->fetch(PDO::FETCH_ASSOC)): ?>
|
||||
<tr>
|
||||
<td><?= htmlspecialchars($row['username']) ?></td>
|
||||
<td><?= strtoupper($row['difficulty']) ?></td>
|
||||
<td>
|
||||
<?= sprintf("%02d:%02d",
|
||||
floor($row['time_seconds'] / 60),
|
||||
$row['time_seconds'] % 60
|
||||
) ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endwhile; ?>
|
||||
|
||||
</table>
|
||||
|
||||
<a href="index.php" class="back">⬅ Kembali</a>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user