Compare commits
No commits in common. "1b0d7019eb87ab54315f28746cc94f084a0dd9c7" and "034e71546358d1709edc3df62da8342c7a9fa647" have entirely different histories.
1b0d7019eb
...
034e715463
45
login.css
45
login.css
@ -1,48 +1,4 @@
|
||||
body {
|
||||
<<<<<<< HEAD
|
||||
font-family: Arial, sans-serif;
|
||||
background: #1e90ff;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
height: 100vh;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.container {
|
||||
background: #fff;
|
||||
padding: 25px;
|
||||
border-radius: 10px;
|
||||
width: 300px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
margin: 10px 0;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 10px;
|
||||
background: #1e90ff;
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background: #0c65b2;
|
||||
}
|
||||
|
||||
#error {
|
||||
color: red;
|
||||
margin-top: 10px;
|
||||
}
|
||||
=======
|
||||
font-family: Arial, sans-serif;
|
||||
background: #f7f6ff;
|
||||
}
|
||||
@ -136,4 +92,3 @@ input {
|
||||
border-radius: 10px;
|
||||
}
|
||||
}
|
||||
>>>>>>> 034e71546358d1709edc3df62da8342c7a9fa647
|
||||
|
||||
57
login.php
57
login.php
@ -1,60 +1,4 @@
|
||||
<?php
|
||||
<<<<<<< HEAD
|
||||
session_start();
|
||||
|
||||
// untuk halaman login
|
||||
include "koneksi.php";
|
||||
|
||||
$username = isset($_POST['username']) ? $_POST['username'] : '';
|
||||
$password = isset($_POST['password']) ? $_POST['password'] : '';
|
||||
|
||||
// Pastikan kedua field terisi
|
||||
if ($username != '' && $password != '') {
|
||||
$stmt = mysqli_prepare($conn, "select * from user where username=? and password=?");
|
||||
$enc = md5($password);
|
||||
mysqli_stmt_bind_param($stmt, "ss", $username, $enc);
|
||||
mysqli_stmt_execute($stmt);
|
||||
|
||||
$result = mysqli_stmt_get_result($stmt);
|
||||
if ($row = mysqli_fetch_assoc($result)) {
|
||||
// Simpan session dengan nama yang benar
|
||||
$_SESSION['firstname'] = $row['firstname'];
|
||||
$_SESSION['lastname'] = $row['lastname'];
|
||||
|
||||
// Jika request AJAX, kembalikan JSON, jika bukan, redirect ke dashboard
|
||||
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
|
||||
if ($isAjax) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['success' => true, 'message' => 'Login sukses']);
|
||||
exit;
|
||||
} else {
|
||||
header("Location: dashboard.php");
|
||||
exit;
|
||||
}
|
||||
} else {
|
||||
$isAjax = !empty($_SERVER['HTTP_X_REQUESTED_WITH']) && strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) === 'xmlhttprequest';
|
||||
if ($isAjax) {
|
||||
header('Content-Type: application/json');
|
||||
echo json_encode(['success' => false, 'message' => 'Username/password salah']);
|
||||
exit;
|
||||
} else {
|
||||
echo "Username/password salah";
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html>
|
||||
<body>
|
||||
<form method="POST">
|
||||
Username: <input type="text" name="username"><br>
|
||||
Password:<input type="password" name="password"><br>
|
||||
<input type="submit">
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
=======
|
||||
include "koneksi.php";
|
||||
|
||||
$username = $_POST['username'];
|
||||
@ -81,4 +25,3 @@ echo json_encode([
|
||||
"role" => $user["role"]
|
||||
]);
|
||||
?>
|
||||
>>>>>>> 034e71546358d1709edc3df62da8342c7a9fa647
|
||||
|
||||
@ -1,44 +0,0 @@
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: Arial, sans-serif;
|
||||
background: linear-gradient(135deg, #7b2ff7, #f107a3);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.container { padding: 20px; max-width: 1000px; margin: auto; }
|
||||
|
||||
.header {
|
||||
display: flex; justify-content: space-between; align-items: center;
|
||||
padding: 15px 20px; border-radius: 20px; margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.user-info { display: flex; align-items: center; gap: 15px; }
|
||||
.user-icon {
|
||||
width: 50px; height: 50px; border-radius: 50%;
|
||||
background: #fff; color: #000; display:flex; align-items:center; justify-content:center;
|
||||
font-size: 20px; font-weight: bold;
|
||||
}
|
||||
|
||||
.actions button { margin-left: 10px; }
|
||||
|
||||
.btn {
|
||||
padding: 10px 20px; border: none; border-radius: 10px;
|
||||
font-size: 15px; cursor: pointer;
|
||||
}
|
||||
.gold { background: gold; }
|
||||
.gray { background: #444; color: white; }
|
||||
|
||||
.title { text-align: center; margin-top: 40px; margin-bottom: 40px; }
|
||||
|
||||
.stage-grid {
|
||||
display: grid; grid-template-columns: repeat(3, 1fr);
|
||||
gap: 20px;
|
||||
}
|
||||
|
||||
.stage-btn {
|
||||
background: white; color: black; padding: 30px; border-radius: 20px;
|
||||
cursor: pointer; transition: .3s; text-align: center;
|
||||
}
|
||||
.stage-btn:hover { transform: scale(1.05); }
|
||||
|
||||
.icon { font-size: 40px; margin-bottom: 10px; display:block; }
|
||||
@ -1,60 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Memory Game</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
|
||||
<!-- HEADER -->
|
||||
<header class="header glass">
|
||||
<div class="user-info">
|
||||
<div class="user-icon">A</div>
|
||||
<div>
|
||||
<h2 id="username">Player</h2>
|
||||
<p id="role">🎮 Player</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button id="leaderboardBtn" class="btn gold">🏆 Leaderboard</button>
|
||||
<button id="logoutBtn" class="btn gray">🚪 Logout</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<!-- TITLE -->
|
||||
<div class="title">
|
||||
<h1>🎮 Memory Card Game</h1>
|
||||
<p>Pilih tingkat kesulitan untuk memulai permainan</p>
|
||||
</div>
|
||||
|
||||
<!-- STAGE SELECTION -->
|
||||
<div class="stage-grid">
|
||||
<button class="stage-btn easy" onclick="selectStage('easy')">
|
||||
<span class="icon">😊</span>
|
||||
<h3>Easy Mode</h3>
|
||||
<p>Grid 3x4 (12 kartu)</p>
|
||||
</button>
|
||||
|
||||
<button class="stage-btn medium" onclick="selectStage('medium')">
|
||||
<span class="icon">🤔</span>
|
||||
<h3>Medium Mode</h3>
|
||||
<p>Grid 5x4 (20 kartu)</p>
|
||||
</button>
|
||||
|
||||
<button class="stage-btn hard" onclick="selectStage('hard')">
|
||||
<span class="icon">😤</span>
|
||||
<h3>Hard Mode</h3>
|
||||
<p>Grid 6x6 (36 kartu)</p>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script src="mainboard.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
11
mainboard.js
11
mainboard.js
@ -1,11 +0,0 @@
|
||||
function selectStage(stage) {
|
||||
alert("Stage dipilih: " + stage);
|
||||
}
|
||||
|
||||
document.getElementById("leaderboardBtn").addEventListener("click", () => {
|
||||
alert("Menuju Leaderboard");
|
||||
});
|
||||
|
||||
document.getElementById("logoutBtn").addEventListener("click", () => {
|
||||
alert("Logout berhasil!");
|
||||
});
|
||||
@ -1,59 +0,0 @@
|
||||
<?php
|
||||
session_start();
|
||||
if (!isset($_SESSION['user'])) {
|
||||
header("Location: login.php");
|
||||
exit();
|
||||
}
|
||||
|
||||
$user = $_SESSION['user']; // id, username, role
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>MainBoard</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<header class="header">
|
||||
<div class="user-info">
|
||||
<div class="avatar"><?php echo strtoupper(substr($user['username'], 0, 1)); ?></div>
|
||||
<div>
|
||||
<h2><?php echo $user['username']; ?>
|
||||
<?php if ($user['role'] === 'admin') echo "👑"; ?>
|
||||
</h2>
|
||||
<p><?php echo $user['role'] === 'admin' ? "Administrator" : "Player"; ?></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="btn-group">
|
||||
<button onclick="location.href='leaderboard.php'">🏆 Leaderboard</button>
|
||||
<button onclick="location.href='logout.php'">🚪 Logout</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<h1>🎮 Memory Card Game</h1>
|
||||
<p>Pilih tingkat kesulitan untuk memulai permainan</p>
|
||||
|
||||
<div class="stage-grid">
|
||||
<button class="stage" onclick="selectStage('easy')">
|
||||
<h3>Easy Mode</h3>
|
||||
<p>Grid 3x4 (12 kartu)</p>
|
||||
</button>
|
||||
|
||||
<button class>"stage" onclick="selectStage('medium')">
|
||||
<h3>Medium Mode</h3>
|
||||
<p>Grid 4x4 (16 kartu)</p>
|
||||
</button>
|
||||
|
||||
<button class="stage" onclick="selectStage('hard')">
|
||||
<h3>Hard Mode</h3>
|
||||
<p>Grid 5x4 (20 kartu)</p>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user