From db356f55bea1fb2bf45a64091faf0c732a417e32 Mon Sep 17 00:00:00 2001 From: 5803025056 Date: Mon, 15 Dec 2025 21:16:27 -0500 Subject: [PATCH] Upload files to "/" --- db.php | 12 +++ db.sql | 8 ++ game.php | 295 +++++++++++++++++++++++++++++++++++++++++++++++++++++ index.php | 45 ++++++++ logout.php | 4 + 5 files changed, 364 insertions(+) create mode 100644 db.php create mode 100644 db.sql create mode 100644 game.php create mode 100644 index.php create mode 100644 logout.php diff --git a/db.php b/db.php new file mode 100644 index 0000000..bd5da08 --- /dev/null +++ b/db.php @@ -0,0 +1,12 @@ +connect_error) { + die("Koneksi gagal: " . $conn->connect_error); +} +?> diff --git a/db.sql b/db.sql new file mode 100644 index 0000000..d5b6cc4 --- /dev/null +++ b/db.sql @@ -0,0 +1,8 @@ + +USE dodge_game; + +CREATE TABLE users ( + id INT AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(50) UNIQUE, + password VARCHAR(255) +); diff --git a/game.php b/game.php new file mode 100644 index 0000000..1f90569 --- /dev/null +++ b/game.php @@ -0,0 +1,295 @@ +query("SELECT skin FROM users WHERE username='$username'"); +$skinColor = $q->fetch_assoc()["skin"]; + +// Daftar warna skin +$skinList = [ + "cyan" => "#00ffff", + "blue" => "#0066ff", + "yellow" => "#ffee00", + "purple" => "#ff55ff", + "green" => "#33ff55" +]; + +// Warna player yang dipakai +$playerColor = $skinList[$skinColor]; + +?> + + + + + Hindari Block + + + + + +
+

Hindari Block

+

Player:

+
Score: 0
+ +
+
+
+
+

Credits: Haekal Adi Rendra & Gerrad

+
+ +
+

Leaderboard

+ + + + + + + query("SELECT username, score FROM leaderboard ORDER BY score DESC LIMIT 20"); + while ($row = $result->fetch_assoc()) { + echo ""; + } + ?> +
UserScore
{$row['username']}{$row['score']}
+
+ + +
+ +
+ + + + + + + + + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..2e2882b --- /dev/null +++ b/index.php @@ -0,0 +1,45 @@ +query("SELECT * FROM users WHERE username='$username'"); + + if ($query->num_rows > 0) { + $row = $query->fetch_assoc(); + if (password_verify($password, $row['password'])) { + $_SESSION['user'] = $row['username']; + header("Location: menu.php"); // ⬅ KE MENU BUKAN GAME + exit; + } else { + $message = "Password salah!"; + } + } else { + $message = "Username tidak ditemukan!"; + } +} +?> + + + +Login + + + +
+

Login

+
+
+
+ +
+

+Register +
+ + diff --git a/logout.php b/logout.php new file mode 100644 index 0000000..509b777 --- /dev/null +++ b/logout.php @@ -0,0 +1,4 @@ +