Compare commits

...

2 Commits

4 changed files with 14 additions and 27 deletions

View File

@ -18,10 +18,6 @@
window.location.href = "Leaderboard.html"; window.location.href = "Leaderboard.html";
}); });
document.getElementById("logoutBtn").addEventListener("click", () => {
alert("Logout berhasil!");
});
// OVERLAY CREDITS // OVERLAY CREDITS
function openCredits() { function openCredits() {
document.getElementById('creditsOverlay').style.display = 'flex'; document.getElementById('creditsOverlay').style.display = 'flex';

7
logout.php Normal file
View File

@ -0,0 +1,7 @@
<?php
session_start();
session_destroy();
header('index.php')
?>

View File

@ -6,24 +6,19 @@
<title>Memory Flip Card Game</title> <title>Memory Flip Card Game</title>
<style> <style>
/* ================================
1. BODY (KUNCI ANTI-SCROLL)
================================== */
body { body {
margin: 0; margin: 0;
font-family: Poppins, Arial, sans-serif; font-family: Poppins, Arial, sans-serif;
background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd); background: linear-gradient(135deg, #d9a7ff, #fbc2eb, #a1c4fd);
height: 100vh; /* Kunci tinggi layar */ height: 100vh;
overflow: hidden; /* Hilangkan scrollbar */ overflow: hidden;
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
position: relative; position: relative;
} }
/* ================================
2. CONTAINER (UKURAN TETAP / STAY)
================================== */
.container { .container {
width: 90%; width: 90%;
max-width: 800px; max-width: 800px;
@ -43,7 +38,6 @@ body {
to { opacity: 1; transform: translateY(0); } to { opacity: 1; transform: translateY(0); }
} }
/* Header & Tombol */
.header { .header {
background: rgba(255,255,255,0.65); background: rgba(255,255,255,0.65);
padding: 15px 22px; padding: 15px 22px;
@ -93,10 +87,7 @@ body {
border: none; border: none;
} }
.icon { font-size: 40px; display: block; } .icon { font-size: 40px; display: block; }
/*Background*/
/* ================================
3. BACKGROUND FRUITS
================================== */
.fruit { .fruit {
position: absolute; position: absolute;
width: 90px; width: 90px;
@ -115,15 +106,13 @@ body {
50% { transform: translateY(-20px) rotate(5deg); } 50% { transform: translateY(-20px) rotate(5deg); }
} }
/* ================================ /* overlay animation*/
4. OVERLAY CREDITS (ANIMASI JALAN)
================================== */
.credits-overlay { .credits-overlay {
position: fixed; position: fixed;
top: 0; left: 0; width: 100%; height: 100%; top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0, 0, 0, 0.95); background: rgba(0, 0, 0, 0.95);
backdrop-filter: blur(10px); backdrop-filter: blur(10px);
display: none; /* Muncul lewat JS */ display: none;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
@ -244,7 +233,7 @@ body {
</div> </div>
<script> <script>
// LOGIKA MUSIK
const musicBtn = document.getElementById('musicBtn'); const musicBtn = document.getElementById('musicBtn');
const bgMusic = document.getElementById('bgMusic'); const bgMusic = document.getElementById('bgMusic');
let isMusicPlaying = false; let isMusicPlaying = false;
@ -255,7 +244,6 @@ body {
isMusicPlaying = !isMusicPlaying; isMusicPlaying = !isMusicPlaying;
}); });
// NAVIGATION
function selectStage(stage) { function selectStage(stage) {
window.location.href = "gameboard-" + stage + ".html"; window.location.href = "gameboard-" + stage + ".html";
} }
@ -268,7 +256,6 @@ body {
alert("Logout berhasil!"); alert("Logout berhasil!");
}); });
// OVERLAY CREDITS
function openCredits() { function openCredits() {
document.getElementById('creditsOverlay').style.display = 'flex'; document.getElementById('creditsOverlay').style.display = 'flex';
} }

View File

@ -1,16 +1,13 @@
<?php <?php
session_start(); session_start();
// --- 1. CEK LOGIN (SATPAM) ---
if (!isset($_SESSION['user'])) { if (!isset($_SESSION['user'])) {
header("Location: index.php"); header("Location: index.php");
exit(); exit();
} }
// --- 2. SIAPKAN DATA USER (ANTI ERROR) ---
$user = $_SESSION['user']; $user = $_SESSION['user'];
$username = isset($user['username']) ? $user['username'] : 'Player'; $username = isset($user['username']) ? $user['username'] : 'Player';
// Cek role, jika admin beri mahkota, jika player beri stik game
$roleRaw = isset($user['role']) ? $user['role'] : 'player'; $roleRaw = isset($user['role']) ? $user['role'] : 'player';
$roleDisplay = ($roleRaw === 'admin') ? 'Administrator' : 'Player'; $roleDisplay = ($roleRaw === 'admin') ? 'Administrator' : 'Player';
$roleIcon = ($roleRaw === 'admin') ? '👑' : '🎮'; $roleIcon = ($roleRaw === 'admin') ? '👑' : '🎮';