diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..b160fc1 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*.html +*.txt \ No newline at end of file diff --git a/Bagian menu/Ace Spade.png b/Bagian menu/Ace Spade.png deleted file mode 100644 index 06e48da..0000000 Binary files a/Bagian menu/Ace Spade.png and /dev/null differ diff --git a/Bagian menu/Bagian menu.html b/Bagian menu/Bagian menu.html deleted file mode 100644 index ad94805..0000000 --- a/Bagian menu/Bagian menu.html +++ /dev/null @@ -1,317 +0,0 @@ - - - - - - Hit & Run - - - - - - - - - - - - - - - - diff --git a/Bagian menu/King Hearts.jpg b/Bagian menu/King Hearts.jpg deleted file mode 100644 index c3c74ba..0000000 Binary files a/Bagian menu/King Hearts.jpg and /dev/null differ diff --git a/Login.html b/Login.html deleted file mode 100644 index 7177e9e..0000000 --- a/Login.html +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - Hit or Run — Login - - - -
- -

Login — Hit or Run

- - - - - - - - - -
Belum punya akun? Register
-
- - \ No newline at end of file diff --git a/Regis.html b/Regis.html deleted file mode 100644 index ab7565e..0000000 --- a/Regis.html +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - Hit or Run — Register - - - -
-

Register — Hit or Run

- - - - - - - - - -
Sudah punya akun? Login
-
- - \ No newline at end of file diff --git a/database/hitnrun.sql b/database/hitnrun.sql new file mode 100644 index 0000000..9e3be52 --- /dev/null +++ b/database/hitnrun.sql @@ -0,0 +1,23 @@ +CREATE DATABASE IF NOT EXISTS hitnrun; + +USE hitnrun; + +CREATE TABLE IF NOT EXISTS users ( + uid INT AUTO_INCREMENT PRIMARY KEY, + username VARCHAR(50) NOT NULL, + password VARCHAR(255) NOT NULL, + money INT NOT NULL DEFAULT 2500, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS bets ( + uid int PRIMARY KEY, + bet INT NOT NULL DEFAULT 0, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); + +CREATE TABLE IF NOT EXISTS wins ( + uid int PRIMARY KEY, + win INT NOT NULL DEFAULT 0, + created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP +); \ No newline at end of file diff --git a/dump.txt b/dump.txt index 00d4023..ea3ae6c 100644 --- a/dump.txt +++ b/dump.txt @@ -1,12 +1,15 @@ - +# log biggest bets -

Welcome !

+INSERT INTO wins (uid, win, created_at) +VALUES (1, 5000, CURRENT_TIMESTAMP()) +ON DUPLICATE KEY UPDATE + win = GREATEST(bet, VALUES(win)), + created_at = CURRENT_TIMESTAMP(); -Logout +# log biggest bets \ No newline at end of file diff --git a/includes/config.php b/includes/config.php index e591f73..94c9f0c 100644 --- a/includes/config.php +++ b/includes/config.php @@ -2,7 +2,7 @@ $host = "localhost"; $user = "root"; $pass = ""; -$db = "mydatabase"; +$db = "hitnrun"; $conn = new mysqli($host, $user, $pass, $db); diff --git a/public/.htaccess b/public/.htaccess index 24ab2d3..f8fbdcd 100644 --- a/public/.htaccess +++ b/public/.htaccess @@ -1,11 +1,8 @@ -# Turn on rewrite engine RewriteEngine On -# If the request is NOT a real file… +# Don't rewrite existing files or directories RewriteCond %{REQUEST_FILENAME} !-f - -# …and NOT a real folder… RewriteCond %{REQUEST_FILENAME} !-d -# Rewrite /something → something.php -RewriteRule ^(.+)$ $1.php [L,QSA] +# Redirect everything else to index.php +RewriteRule ^(.*)$ index.php [L] diff --git a/public/assets/css/style.css b/public/assets/css/style.css index a9f3693..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; @@ -134,3 +137,135 @@ footer{ color:rgba(255,255,255,0.45); text-align:center } + +.userbox { + display: flex; + align-items: center; + gap: 14px; + margin-bottom: 20px; + background: rgba(255, 255, 255, 0.04); + padding: 14px; + border-radius: 14px; + border: 1px solid rgba(255, 255, 255, 0.06); + box-shadow: 0 8px 24px rgba(2, 6, 23, 0.45); +} + +.userbox .avatar { + width: 58px; + height: 58px; + border-radius: 50%; + background: linear-gradient(180deg, #0e3b33, #0b2a2f); + display: flex; + align-items: center; + justify-content: center; + font-size: 22px; + font-weight: 800; + color: var(--accent); + border: 2px solid rgba(246,198,79,0.4); + box-shadow: 0 6px 14px rgba(0,0,0,0.5); +} + +.userbox .info { + display: flex; + flex-direction: column; + line-height: 1.25; +} + +.userbox .name { + font-weight: 800; + font-size: 24px; +} + +.userbox .saldo { + margin-top: 4px; + font-size: 18px; + color: var(--muted); +} + +.userbox .saldo span { + color: var(--accent); + font-weight: 700; +} + +.userbox .status { + margin-top: 2px; + font-size: 16px; + color: var(--muted); +} + +.gamename { + font-size: 36px; +} + +.num-box { + display: inline-flex; + align-items: center; + border: 1px solid #444; + border-radius: 12px; + overflow: hidden; + background: #1e1e1e; + height: 50px; +} + +.num-box input { + height: 50px; + width: 100px; + font-size: 18px; + background: transparent; + border: none; + color: white; + text-align: center; + outline: none; + line-height: 50px; /* base centering */ + display: flex; /* optical fix */ + align-items: center; /* optical fix */ + justify-content: center; /* ensures centered horizontally */ +} + +.num-box input::-webkit-inner-spin-button, +.num-box input::-webkit-outer-spin-button { + -webkit-appearance: none; +} + +.num-box .btn { + width: 50px; + height: 50px; + border: none; + background: #2b2b2b; + color: white; + font-size: 22px; + cursor: pointer; + + display: flex; + justify-content: center; + align-items: center; +} + +.num-box .btn:hover { + background: #3a3a3a; +} + +.num-box .btn:active { + background: #555; +} + +.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 new file mode 100644 index 0000000..ffc4b52 --- /dev/null +++ b/public/assets/js/menu.js @@ -0,0 +1,27 @@ +document.querySelector(".plus").addEventListener("click", () => { + const input = document.querySelector(".num-box input"); + 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) || 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 new file mode 100644 index 0000000..f05cf3f --- /dev/null +++ b/public/index.php @@ -0,0 +1,65 @@ +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']; +?> + + + + + + + Hit & Run + + + + +
+
+ Hit & Run
+ Hit or you Lose. +
+
+
+ + + +
+ +
+
+ +
+
+
P
+ +
+
+
Saldo:
+
Status: Masih Pemula Banghh....
+
+
+ +
+ + + + + diff --git a/public/logout.php b/public/logout.php index 7649023..8ba2a2e 100644 --- a/public/logout.php +++ b/public/logout.php @@ -1,5 +1,5 @@ prepare("SELECT id, username, password FROM users WHERE username = ?"); + $stmt = $conn->prepare("SELECT * FROM users WHERE username = ?"); $stmt->bind_param("s", $username); $stmt->execute(); @@ -17,8 +15,8 @@ $user = $result->fetch_assoc(); if (password_verify($password, $user["password"])) { - $_SESSION["username"] = $user["username"]; - header("Location: home.php"); + $_SESSION["data"] = $user; + header("Location: home"); exit; } else { $error = "Wrong Username or Password."; @@ -46,15 +44,15 @@
- + - +
-
Belum punya akun? Sign Up!
+
Belum punya akun? Sign Up!
\ No newline at end of file diff --git a/public/signup.php b/public/signup.php index 6cb6559..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."; + } } + } ?> @@ -34,15 +42,15 @@
- + - +
-
Sudah punya akun? Sign In!
+
Sudah punya akun? Sign In!
\ No newline at end of file