diff --git a/.gitignore b/.gitignore index 0b84df0..b160fc1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*.html \ No newline at end of file +*.html +*.txt \ No newline at end of file diff --git a/public/assets/css/style.css b/public/assets/css/style.css index 0f40ee5..d3e51ef 100644 --- a/public/assets/css/style.css +++ b/public/assets/css/style.css @@ -27,7 +27,6 @@ body, html{ .container{ width:100%; - max-width:980px; background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); border-radius:16px; padding:20px; @@ -102,6 +101,10 @@ a{ margin-bottom:14px } +.w80{ + width: 80%; +} + table{ width:100%; border-collapse:collapse; @@ -248,4 +251,21 @@ footer{ .plus, .minus { margin-top: 0 !important; +} + +.mb16 { + margin-bottom: 16px; +} + +/* Chrome, Edge, Safari */ +input::-webkit-outer-spin-button, +input::-webkit-inner-spin-button { + -webkit-appearance: none; + margin: 0; +} + +/* Firefox */ +input[type="number"] { + -moz-appearance: textfield; /* old syntax */ + appearance: textfield; /* standard property */ } \ No newline at end of file diff --git a/public/assets/js/menu.js b/public/assets/js/menu.js index 6373640..ffc4b52 100644 --- a/public/assets/js/menu.js +++ b/public/assets/js/menu.js @@ -1,11 +1,27 @@ document.querySelector(".plus").addEventListener("click", () => { const input = document.querySelector(".num-box input"); - const step = Number(input.step) || 1; - input.value = Number(input.value) + step; + const step = Number(input.step) || 1000; + const max = Number(input.max); + + let newValue = Number(input.value) + step; + + if (!isNaN(max)) {https://git-eng.ukwms.ac.id/2526-web/Kelompok_13.git + newValue = Math.min(newValue, max); + } + + input.value = newValue; }); document.querySelector(".minus").addEventListener("click", () => { const input = document.querySelector(".num-box input"); - const step = Number(input.step) || 1; - input.value = Math.max(1000, Number(input.value) - step); -}); \ No newline at end of file + const step = Number(input.step) || 1000; + const min = Number(input.min); + + let newValue = Number(input.value) - step; + + if (!isNaN(min)) { + newValue = Math.max(newValue, min); + } + + input.value = newValue; +}); diff --git a/public/board.php b/public/board.php index bf10ca7..6b07a80 100644 --- a/public/board.php +++ b/public/board.php @@ -1,3 +1,31 @@ +prepare("SELECT b.bet, u.username FROM bets b JOIN users u ON b.uid = u.uid ORDER BY b.bet DESC LIMIT 10;"); + $stmt->execute(); + $result = $stmt->get_result(); + $bets = $result->fetch_all(MYSQLI_ASSOC); + $stmt->close(); + + // Top 10 wins + $stmt = $conn->prepare("SELECT b.win, u.username FROM wins b JOIN users u ON b.uid = u.uid ORDER BY b.win DESC LIMIT 10;"); + $stmt->execute(); + $result = $stmt->get_result(); + $wins = $result->fetch_all(MYSQLI_ASSOC); + $stmt->close(); + + // Top 10 users by money + $stmt = $conn->prepare("SELECT * FROM users ORDER BY money DESC LIMIT 10"); + $stmt->execute(); + $result = $stmt->get_result(); + $users = $result->fetch_all(MYSQLI_ASSOC); + $stmt->close(); + +?> @@ -6,19 +34,18 @@ Hit and Run — Leaderboard - -
+ +

Hit Or Run — Leaderboard

-

Daftar pemain terbaik dari meja Hit Or Run. Tema: felt table, kartu, dan nuansa kasino.

-
+
-

Top Players

+

Top Rich Mans

@@ -29,11 +56,65 @@ + $user): ?> + + + + + + + +
+
+
+
+ +
+
+

Top Crazy Mans

+
+ + - - - + + + + + + $bet): ?> + + + + + + + +
1Tepen100#PlayerBets
+
+
+
+ +
+
+

Top Lucky Mans

+
+ + + + + + + + + + $win): ?> + + + + + +
#PlayerEarnings
diff --git a/public/index.php b/public/index.php index 211c7eb..f05cf3f 100644 --- a/public/index.php +++ b/public/index.php @@ -1,15 +1,23 @@ prepare("SELECT money FROM users WHERE uid = ?"); + $stmt->bind_param("i", $_SESSION['data']['uid']); + $stmt->execute(); + $result = $stmt->get_result(); + $user = $result->fetch_assoc(); + $stmt->close(); + + // Update session + $_SESSION['data']['money'] = $user['money']; ?> -Logout - -?> @@ -27,8 +35,8 @@
- - + +
@@ -40,8 +48,8 @@
P
-
-
Saldo:
+
+
Saldo:
Status: Masih Pemula Banghh....
diff --git a/public/signin.php b/public/signin.php index 5407edf..94bf352 100644 --- a/public/signin.php +++ b/public/signin.php @@ -5,7 +5,7 @@ $username = trim($_POST["username"]); $password = $_POST["password"]; - $stmt = $conn->prepare("SELECT id, username, password FROM users WHERE username = ?"); + $stmt = $conn->prepare("SELECT * FROM users WHERE username = ?"); $stmt->bind_param("s", $username); $stmt->execute(); @@ -15,8 +15,8 @@ $user = $result->fetch_assoc(); if (password_verify($password, $user["password"])) { - $_SESSION["uid"] = $user["uid"]; - header("Location: home.php"); + $_SESSION["data"] = $user; + header("Location: home"); exit; } else { $error = "Wrong Username or Password."; diff --git a/public/signup.php b/public/signup.php index 703e763..7ddca55 100644 --- a/public/signup.php +++ b/public/signup.php @@ -1,5 +1,9 @@ prepare("INSERT INTO users (username, password) VALUES (?, ?)"); $stmt->bind_param("ss", $username, $password); - if ($stmt->execute()) { - echo "Account created! Login here"; + try { + $stmt->execute(); + header("Location: signin.php"); exit; - } else { - echo "Username already exists."; + } catch (mysqli_sql_exception $e) { + if ($e->getCode() == 1062) { + $error = "Username already exists."; + } } + } ?>