From 3c906dfa0032db92293378f7cfd427ab0767e512 Mon Sep 17 00:00:00 2001 From: Evelyn Date: Mon, 24 Nov 2025 14:46:23 +0700 Subject: [PATCH] fear:mainboard --- login.css | 43 +++++++++++++++++++++++ login.html | 94 +++++++++++++++++++++++++++++++++++--------------- login.php | 70 +++++++++++++++++++++---------------- mainboard.css | 44 +++++++++++++++++++++++ mainboard.html | 60 ++++++++++++++++++++++++++++++++ mainboard.js | 11 ++++++ mainboard.php | 59 +++++++++++++++++++++++++++++++ 7 files changed, 323 insertions(+), 58 deletions(-) create mode 100644 mainboard.css create mode 100644 mainboard.html create mode 100644 mainboard.js create mode 100644 mainboard.php diff --git a/login.css b/login.css index e69de29..2795fbc 100644 --- a/login.css +++ b/login.css @@ -0,0 +1,43 @@ +body { + 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; +} diff --git a/login.html b/login.html index 2320925..d8ac1d7 100644 --- a/login.html +++ b/login.html @@ -1,34 +1,72 @@ - - - - - - - Halaman Login - - - -
-

Masuk ke Akun Anda

-

Masukkan email dan kata sandi.

+ + + + + + Login Page + + + +
-
-
- - -
+ +
+
+
+
+
+ + +
- + + + + + + + \ No newline at end of file diff --git a/login.php b/login.php index 4832e8c..1c3ba62 100644 --- a/login.php +++ b/login.php @@ -1,39 +1,49 @@ ";//kalo di file yang sama - echo "lastname:".$row['lastname']."
"; - } - else echo "Username/password salah"; + +$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"; + } + } } ?> +
diff --git a/mainboard.css b/mainboard.css new file mode 100644 index 0000000..4420527 --- /dev/null +++ b/mainboard.css @@ -0,0 +1,44 @@ +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; } diff --git a/mainboard.html b/mainboard.html new file mode 100644 index 0000000..e99b825 --- /dev/null +++ b/mainboard.html @@ -0,0 +1,60 @@ + + + + + + Memory Game + + + + +
+ + +
+ + +
+ + +
+
+ + +
+

🎮 Memory Card Game

+

Pilih tingkat kesulitan untuk memulai permainan

+
+ + +
+ + + + + +
+ +
+ + + + diff --git a/mainboard.js b/mainboard.js new file mode 100644 index 0000000..2f9e784 --- /dev/null +++ b/mainboard.js @@ -0,0 +1,11 @@ +function selectStage(stage) { + alert("Stage dipilih: " + stage); +} + +document.getElementById("leaderboardBtn").addEventListener("click", () => { + alert("Menuju Leaderboard"); +}); + +document.getElementById("logoutBtn").addEventListener("click", () => { + alert("Logout berhasil!"); +}); diff --git a/mainboard.php b/mainboard.php new file mode 100644 index 0000000..b43b7b8 --- /dev/null +++ b/mainboard.php @@ -0,0 +1,59 @@ + + + + + + + MainBoard + + + + + +
+
+ + +
+ + +
+
+ +

🎮 Memory Card Game

+

Pilih tingkat kesulitan untuk memulai permainan

+ +
+ + + + + +
+
+