diff --git a/includes/.htaccess b/includes/.htaccess new file mode 100644 index 0000000..3418e55 --- /dev/null +++ b/includes/.htaccess @@ -0,0 +1 @@ +deny from all \ No newline at end of file diff --git a/includes/config.php b/includes/config.php new file mode 100644 index 0000000..94c9f0c --- /dev/null +++ b/includes/config.php @@ -0,0 +1,13 @@ +connect_error) { + die("Connection failed: " . $conn->connect_error); +} + +session_start(); diff --git a/public/.htaccess b/public/.htaccess new file mode 100644 index 0000000..f8fbdcd --- /dev/null +++ b/public/.htaccess @@ -0,0 +1,8 @@ +RewriteEngine On + +# Don't rewrite existing files or directories +RewriteCond %{REQUEST_FILENAME} !-f +RewriteCond %{REQUEST_FILENAME} !-d + +# Redirect everything else to index.php +RewriteRule ^(.*)$ index.php [L] diff --git a/public/assets/css/style.css b/public/assets/css/style.css new file mode 100644 index 0000000..d3e51ef --- /dev/null +++ b/public/assets/css/style.css @@ -0,0 +1,271 @@ +body, html{ + font-family: Inter, ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial; + margin:0; + background: radial-gradient(circle at 10% 10%, rgba(255,255,255,0.03), transparent 5%), + linear-gradient(180deg, #000 0%, #071827 100%), + var(--bg); + color:var(--muted); + -webkit-font-smoothing:antialiased; + -moz-osx-font-smoothing:grayscale; + padding:24px; + display:flex; + align-items:center; + justify-content:center; + height:100%; + overflow: hidden; +} + +:root{ + --bg:#071827; + --card:#071827; + --accent:#ffd54a; + --muted:#cfe8d6; + --glass: rgba(255,255,255,0.04); + --shadow: 0 6px 18px rgba(2,8,3,0.6); + --glass-2: rgba(0,0,0,0.35); +} + +.container{ + width:100%; + background:linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.01)); + border-radius:16px; + padding:20px; + box-shadow:var(--shadow); + backdrop-filter: blur(6px); +} + +.card{ + background:rgba(255,255,255,0.05); + padding:28px; + border-radius:16px; + width:320px; + box-shadow:0 8px 30px rgba(0,0,0,0.5); + backdrop-filter:blur(8px); +} + +h2{ + margin-top:0; + text-align:center +} + +label{ + display:block; + margin:10px 0 4px; + font-size:14px +} + +input{ + width:100%; + padding:10px; + border-radius:8px; + border:0; + margin-bottom:10px; + background:#ffffff12; + color:white; +} + +button{ + width:100%; + padding:10px; + border-radius:8px; + border:0; + cursor:pointer; + background:linear-gradient(90deg,#ffd54a); + color:black; + font-weight:600; + margin-top:10px; +} + +.note{ + text-align:center; + margin-top:10px; + font-size:14px +} + +a{ + color:#4ade80; + text-decoration:none +} + +.logo{ + font-size: 96px; + display:flex; + align-items:center; + justify-content:center; +} + +.header{ + display:flex; + gap:16px; + align-items:center; + margin-bottom:14px +} + +.w80{ + width: 80%; +} + +table{ + width:100%; + border-collapse:collapse; + font-size:14px +} + +thead th{ + font-size:12px; + text-align:left; + padding:8px 10px; + color:var(--muted); + opacity:0.9 +} + +tbody td{ + padding:10px; + border-top:1px dashed rgba(255,255,255,0.03) +} + +.panel{ + background:var(--card); + padding:16px; + border-radius:12px; + border:1px solid var(--glass-2) +} + +footer{ + margin-top:14px; + font-size:12px; + 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 - Copy.php b/public/board - Copy.php deleted file mode 100644 index 555098b..0000000 --- a/public/board - Copy.php +++ /dev/null @@ -1,127 +0,0 @@ -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(); - -?> - - - - - - Hit and Run — Leaderboard - - - -
-
- -
-

Hit Or Run — Leaderboard

-
-
- -
-
-

Top Rich Mans

-
- - - - - - - - - - $user): ?> - - - - - - - -
#PlayerEarnings
-
-
-
- -
-
-

Top Crazy Mans

-
- - - - - - - - - - - - -
#Player - $bet): ?> -
-
-
-
- -
-
-

Top Lucky Mans

-
- - - - - - - - - - $win): ?> - - - - - - - -
#PlayerEarnings
-
-
-
- - -
- - diff --git a/public/board.php b/public/board.php index 555098b..6b07a80 100644 --- a/public/board.php +++ b/public/board.php @@ -50,17 +50,17 @@ - - - + + + - + $user): ?> - - + + @@ -76,12 +76,12 @@
#PlayerEarnings#PlayerEarnings
- - - + + - + $bet): ?> @@ -102,12 +102,12 @@
#Player#PlayerBets
- - - + + + - + $win): ?> 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 new file mode 100644 index 0000000..8ba2a2e --- /dev/null +++ b/public/logout.php @@ -0,0 +1,5 @@ +prepare("SELECT * FROM users WHERE username = ?"); + $stmt->bind_param("s", $username); + $stmt->execute(); + + $result = $stmt->get_result(); + + if ($result->num_rows === 1) { + $user = $result->fetch_assoc(); + + if (password_verify($password, $user["password"])) { + $_SESSION["data"] = $user; + header("Location: home"); + exit; + } else { + $error = "Wrong Username or Password."; + } + } else { + $error = "Username not found."; + } + } +?> + + + + + + + Hit or Run — Sign In + + + +
+ +

Hit or Run

+ + $error

"; ?> + +
+ + + + + + + + + +
Belum punya akun? Sign Up!
+
+ + \ No newline at end of file diff --git a/public/signup.php b/public/signup.php new file mode 100644 index 0000000..7ddca55 --- /dev/null +++ b/public/signup.php @@ -0,0 +1,56 @@ +prepare("INSERT INTO users (username, password) VALUES (?, ?)"); + $stmt->bind_param("ss", $username, $password); + + try { + $stmt->execute(); + header("Location: signin.php"); + exit; + } catch (mysqli_sql_exception $e) { + if ($e->getCode() == 1062) { + $error = "Username already exists."; + } + } + + } +?> + + + + + + + Hit or Run — Sign Up + + + +
+ +

Hit or Run

+ + $error

"; ?> + +
+ + + + + + + + + +
Sudah punya akun? Sign In!
+
+ + \ No newline at end of file
#PlayerEarnings#PlayerEarnings