restore and fix ingame
This commit is contained in:
commit
201ae29582
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
*.html
|
||||
*.txt
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 94 KiB |
@ -1,317 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Hit & Run</title>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
||||
<link
|
||||
href="https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;800&family=Playfair+Display:wght@600&display=swap"
|
||||
rel="stylesheet"
|
||||
/>
|
||||
|
||||
<style>
|
||||
:root {
|
||||
--bg: #071827;
|
||||
--table: #0b2a2f;
|
||||
--felt: #0e3b33;
|
||||
--accent: #f6c64f;
|
||||
--muted: #8fb3b0;
|
||||
--glass: rgba(255, 255, 255, 0.04);
|
||||
--card: #ffffff;
|
||||
--shadow: 0 10px 30px rgba(2, 6, 23, 0.6);
|
||||
--radius: 14px;
|
||||
}
|
||||
|
||||
* {
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
html,
|
||||
body {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
font-family: 'Montserrat', system-ui, sans-serif;
|
||||
background: linear-gradient(180deg, var(--bg) 0%, #03212b 100%);
|
||||
color: #e6f7f2;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
padding: 32px;
|
||||
}
|
||||
|
||||
.menu-wrap {
|
||||
width: 100%;
|
||||
max-width: 1100px;
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 420px;
|
||||
gap: 28px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.table-card {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(255, 255, 255, 0.02),
|
||||
rgba(255, 255, 255, 0.01)
|
||||
);
|
||||
border-radius: 18px;
|
||||
padding: 28px;
|
||||
box-shadow: var(--shadow);
|
||||
border: 1px solid rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.table-stage {
|
||||
background: var(--table);
|
||||
border-radius: 12px;
|
||||
padding: 28px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.table-top {
|
||||
background: radial-gradient(
|
||||
circle at 30% 20%,
|
||||
rgba(255, 255, 255, 0.02),
|
||||
transparent 30%
|
||||
),
|
||||
linear-gradient(180deg, rgba(255, 255, 255, 0.01), transparent);
|
||||
border-radius: 10px;
|
||||
padding: 24px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 18px;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.table-name {
|
||||
font-family: 'Playfair Display';
|
||||
font-size: 28px;
|
||||
color: var(--accent);
|
||||
}
|
||||
|
||||
.felt {
|
||||
background: linear-gradient(180deg, var(--felt), #0b3f32);
|
||||
width: 100%;
|
||||
height: 180px;
|
||||
border-radius: 8px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.card-stack {
|
||||
position: absolute;
|
||||
left: 28px;
|
||||
top: 40px;
|
||||
transform: rotate(-12deg);
|
||||
}
|
||||
|
||||
.card {
|
||||
width: 92px;
|
||||
height: 128px;
|
||||
border-radius: 8px;
|
||||
background: #fff;
|
||||
box-shadow: 0 6px 20px rgba(2, 6, 23, 0.6);
|
||||
padding: 8px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: space-between;
|
||||
border: 1px solid rgba(0, 0, 0, 0.06);
|
||||
}
|
||||
|
||||
.card.small {
|
||||
width: 72px;
|
||||
height: 96px;
|
||||
}
|
||||
|
||||
.chip-stack {
|
||||
position: absolute;
|
||||
right: 32px;
|
||||
bottom: 22px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: flex-end;
|
||||
}
|
||||
|
||||
.chip {
|
||||
width: 56px;
|
||||
height: 56px;
|
||||
border-radius: 50%;
|
||||
background: linear-gradient(180deg, #ffdd7a, #d4a018);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: 800;
|
||||
color: #002;
|
||||
box-shadow: 0 6px 18px rgba(2, 6, 23, 0.5);
|
||||
}
|
||||
|
||||
.menu-box {
|
||||
background: linear-gradient(
|
||||
180deg,
|
||||
rgba(255, 255, 255, 0.02),
|
||||
rgba(255, 255, 255, 0.01)
|
||||
);
|
||||
border-radius: 12px;
|
||||
padding: 22px;
|
||||
border: 1px solid rgba(255, 255, 255, 0.03);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 22px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
color: var(--muted);
|
||||
font-size: 13px;
|
||||
margin-bottom: 18px;
|
||||
}
|
||||
|
||||
.btn {
|
||||
padding: 14px 20px;
|
||||
border-radius: 12px;
|
||||
font-weight: 700;
|
||||
cursor: pointer;
|
||||
width: 100%;
|
||||
border: none;
|
||||
box-shadow: 0 6px 18px rgba(2, 6, 23, 0.5);
|
||||
}
|
||||
|
||||
.btn-primary {
|
||||
background: linear-gradient(180deg, var(--accent), #e3b33b);
|
||||
color: #052426;
|
||||
}
|
||||
|
||||
.btn-ghost {
|
||||
background: transparent;
|
||||
border: 1px solid rgba(255, 255, 255, 0.06);
|
||||
color: var(--muted);
|
||||
}
|
||||
|
||||
.info-row {
|
||||
display: flex;
|
||||
gap: 12px;
|
||||
margin-top: 14px;
|
||||
}
|
||||
|
||||
.stat {
|
||||
background: var(--glass);
|
||||
padding: 10px;
|
||||
border-radius: 10px;
|
||||
min-width: 120px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.num {
|
||||
font-size: 18px;
|
||||
font-weight: 800;
|
||||
}
|
||||
|
||||
.modal {
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
background: rgba(2, 6, 23, 0.5);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
opacity: 0;
|
||||
pointer-events: none;
|
||||
transition: 0.18s;
|
||||
}
|
||||
|
||||
.modal.open {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
.modal-card {
|
||||
background: linear-gradient(180deg, #06222b, #0b2b2f);
|
||||
border-radius: 12px;
|
||||
padding: 20px;
|
||||
width: 420px;
|
||||
}
|
||||
|
||||
@media (max-width: 880px) {
|
||||
.menu-wrap {
|
||||
grid-template-columns: 1fr;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="menu-wrap">
|
||||
<div class="table-card">
|
||||
<div class="table-stage">
|
||||
<div class="table-top">
|
||||
<div class="table-name">Hit & Run • Hit or you Lose.</div>
|
||||
|
||||
<div class="felt">
|
||||
<div class="card-stack">
|
||||
<div class="card small"
|
||||
style="
|
||||
transform: rotate(-6deg);
|
||||
background-image: url('Ace\ Spade.png');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
">
|
||||
</div>
|
||||
|
||||
<div class="card"
|
||||
style="
|
||||
transform: translateY(-28px) rotate(-4deg);
|
||||
background-image: url('King\ Hearts.jpg');
|
||||
background-size: cover;
|
||||
background-position: center;
|
||||
">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="chip-stack">
|
||||
<div class="chip">100</div>
|
||||
<div class="chip" style="width: 46px; height: 46px; font-size: 12px">
|
||||
25
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<aside class="menu-box">
|
||||
<div class="player-profile" style="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)">
|
||||
<div class="avatar" style="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)">P</div>
|
||||
<div style="display:flex; flex-direction:column; line-height:1.25">
|
||||
<div style="font-weight:800; font-size:17px">Pemain Utama</div>
|
||||
<div style="font-size:13px; color:var(--muted)">Saldo: <span style="color:var(--accent); font-weight:700">1,250</span></div>
|
||||
<div style="font-size:12px; color:var(--muted)">Status: Masih Pemula Banghh....</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="title">Selamat Datang, Player</div>
|
||||
<div class="subtitle">
|
||||
Dalam permainan Hit & Run. Satu kartu bisa menyelamatkanmu... atau menjatuhkanmu Siap berjudi dengan nasib?
|
||||
</div>
|
||||
|
||||
<button class="btn btn-primary" id="playBtn">▶️ MAINKAN</button>
|
||||
|
||||
</div>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const playBtn = document.getElementById('playBtn');
|
||||
|
||||
playBtn.addEventListener('click', () => {
|
||||
alert('Memulai permainan...');
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 95 KiB |
53
Login.html
53
Login.html
@ -1,53 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Hit or Run — Login</title>
|
||||
<style>
|
||||
body{
|
||||
margin:0; font-family:Inter, sans-serif; background:#071827;
|
||||
display:flex; align-items:center; justify-content:center; min-height:100vh;
|
||||
color:white;
|
||||
}
|
||||
.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{
|
||||
text-align:center; margin-bottom:12px; font-size:100px;
|
||||
filter:drop-shadow(0 0 8px #00000088);
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<div class="logo">🂡</div>
|
||||
<h2>Login — Hit or Run</h2>
|
||||
|
||||
<label>Username</label>
|
||||
<input type="text" placeholder="Masukkan username" />
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" placeholder="Masukkan password" />
|
||||
|
||||
<button>Login</button>
|
||||
|
||||
<div class="note">Belum punya akun? <a href="regis.html">Register</a></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
48
Regis.html
48
Regis.html
@ -1,48 +0,0 @@
|
||||
<!doctype html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Hit or Run — Register</title>
|
||||
<style>
|
||||
body{
|
||||
margin:0; font-family:Inter, sans-serif; background:#071827;
|
||||
display:flex; align-items:center; justify-content:center; min-height:100vh;
|
||||
color:white;
|
||||
}
|
||||
.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}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="card">
|
||||
<h2>Register — Hit or Run</h2>
|
||||
|
||||
<label>Username</label>
|
||||
<input type="text" placeholder="Masukkan username" />
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" placeholder="Masukkan password" />
|
||||
|
||||
<button onclick="window.location.href='login.html'">Daftar</button>
|
||||
|
||||
<div class="note">Sudah punya akun? <a href="login.html">Login</a></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
23
database/hitnrun.sql
Normal file
23
database/hitnrun.sql
Normal file
@ -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
|
||||
);
|
||||
21
dump.txt
21
dump.txt
@ -1,12 +1,15 @@
|
||||
<?php
|
||||
require "../includes/config.php";
|
||||
INSERT INTO bets (uid, bet, created_at)
|
||||
VALUES (1, 5000, CURRENT_TIMESTAMP())
|
||||
ON DUPLICATE KEY UPDATE
|
||||
bet = GREATEST(bet, VALUES(bet)),
|
||||
created_at = CURRENT_TIMESTAMP();
|
||||
|
||||
if (!isset($_SESSION["user_id"])) {
|
||||
header("Location: login.php");
|
||||
exit;
|
||||
}
|
||||
?>
|
||||
# log biggest bets
|
||||
|
||||
<h2>Welcome <?php echo $_SESSION["username"]; ?>!</h2>
|
||||
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();
|
||||
|
||||
<a href="logout.php">Logout</a>
|
||||
# log biggest bets
|
||||
@ -2,7 +2,7 @@
|
||||
$host = "localhost";
|
||||
$user = "root";
|
||||
$pass = "";
|
||||
$db = "mydatabase";
|
||||
$db = "hitnrun";
|
||||
|
||||
$conn = new mysqli($host, $user, $pass, $db);
|
||||
|
||||
|
||||
@ -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]
|
||||
|
||||
@ -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 */
|
||||
}
|
||||
27
public/assets/js/menu.js
Normal file
27
public/assets/js/menu.js
Normal file
@ -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;
|
||||
});
|
||||
@ -1,3 +1,31 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
require_once "../includes/config.php";
|
||||
|
||||
// Top 10 bets
|
||||
$stmt = $conn->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();
|
||||
|
||||
?>
|
||||
<!doctype html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
@ -6,19 +34,18 @@
|
||||
<title>Hit and Run — Leaderboard</title>
|
||||
<link rel="stylesheet" href="assets/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<body style="width: 100%;">
|
||||
<div class="container w80">
|
||||
<div class="header">
|
||||
<div class="logo">🂡</div>
|
||||
<div class="title">
|
||||
<h2>Hit Or Run — Leaderboard</h2>
|
||||
<p>Daftar pemain terbaik dari meja Hit Or Run. Tema: felt table, kartu, dan nuansa kasino.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="board">
|
||||
<div class="board mb16">
|
||||
<div class="panel">
|
||||
<h3>Top Players</h3>
|
||||
<h3>Top Rich Mans</h3>
|
||||
<div id="leaderboard-wrap">
|
||||
<table id="leaderboard">
|
||||
<thead>
|
||||
@ -29,11 +56,65 @@
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="board-body">
|
||||
<?php foreach ($users as $index => $user): ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?= htmlspecialchars($user['username']) ?></td>
|
||||
<td><?= htmlspecialchars($user['money']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="board mb16">
|
||||
<div class="panel">
|
||||
<h3>Top Crazy Mans</h3>
|
||||
<div id="leaderboard-wrap">
|
||||
<table id="leaderboard">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Tepen</td>
|
||||
<td>100</td>
|
||||
<th class="rank">#</th>
|
||||
<th>Player</th>
|
||||
<th>Bets</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="board-body">
|
||||
<?php foreach ($bets as $index => $bet): ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?= htmlspecialchars($bet['username']) ?></td>
|
||||
<td><?= htmlspecialchars($bet['bet']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="board mb16">
|
||||
<div class="panel">
|
||||
<h3>Top Lucky Mans</h3>
|
||||
<div id="leaderboard-wrap">
|
||||
<table id="leaderboard">
|
||||
<thead>
|
||||
<tr>
|
||||
<th class="rank">#</th>
|
||||
<th>Player</th>
|
||||
<th>Earnings</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="board-body">
|
||||
<?php foreach ($wins as $index => $win): ?>
|
||||
<tr>
|
||||
<td><?= $index + 1 ?></td>
|
||||
<td><?= htmlspecialchars($win['username']) ?></td>
|
||||
<td><?= htmlspecialchars($win['win']) ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
65
public/index.php
Normal file
65
public/index.php
Normal file
@ -0,0 +1,65 @@
|
||||
<?php
|
||||
require "../includes/config.php";
|
||||
|
||||
if (!isset($_SESSION["data"])) {
|
||||
header("Location: signin");
|
||||
exit;
|
||||
}
|
||||
|
||||
// Get money
|
||||
$stmt = $conn->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'];
|
||||
?>
|
||||
|
||||
<!doctype html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Hit & Run</title>
|
||||
<link rel="stylesheet" href="assets/css/style.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div style="padding-right: 32px;">
|
||||
<div class="gamename card">
|
||||
Hit & Run <br>
|
||||
Hit or you Lose.
|
||||
</div>
|
||||
<div style="padding-top: 32px; display:flex; flex-direction:column; align-items:center;">
|
||||
<div class="num-box">
|
||||
<button class="btn minus">-</button>
|
||||
<input min="1000" max="<?php echo $_SESSION['data']['money']; ?>"type="number" value="1000" style="margin-bottom: -1px;">
|
||||
<button class="btn plus">+</button>
|
||||
</div>
|
||||
<button class="btn btn-primary" id="playBtn">▶️ MAINKAN</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div class="userbox">
|
||||
<div class="avatar">P</div>
|
||||
|
||||
<div class="info">
|
||||
<div class="name"><?php echo $_SESSION['data']["username"]; ?></div>
|
||||
<div class="saldo">Saldo: <span><?php echo $_SESSION['data']["money"]; ?></span></div>
|
||||
<div class="status">Status: Masih Pemula Banghh....</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const playBtn = document.getElementById('playBtn');
|
||||
console.log("Startgame");
|
||||
</script>
|
||||
</body>
|
||||
<script src="assets/js/menu.js"></script>
|
||||
</html>
|
||||
@ -1,5 +1,5 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
header("Location: login.php");
|
||||
header("Location: signin.php");
|
||||
exit;
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
<?php
|
||||
require_once "../includes/config.php";
|
||||
|
||||
@ -7,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();
|
||||
|
||||
@ -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 @@
|
||||
|
||||
<form action="" method="post">
|
||||
<label>Username</label>
|
||||
<input type="text" id="username" placeholder="Masukkan username" />
|
||||
<input type="text" id="username" name="username" placeholder="Masukkan username" />
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" id="password" placeholder="Masukkan password" />
|
||||
<input type="password" id="password" name="password" placeholder="Masukkan password" />
|
||||
|
||||
<button type="submit">Sign In</button>
|
||||
</form>
|
||||
|
||||
<div class="note">Belum punya akun? <a href="signup.html">Sign Up!</a></div>
|
||||
<div class="note">Belum punya akun? <a href="signup.php">Sign Up!</a></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@ -1,5 +1,9 @@
|
||||
<?php
|
||||
ini_set('display_errors', 1);
|
||||
ini_set('display_startup_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
require_once "../includes/config.php";
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] === "POST") {
|
||||
$username = trim($_POST["username"]);
|
||||
$password = password_hash($_POST["password"], PASSWORD_DEFAULT);
|
||||
@ -8,12 +12,16 @@
|
||||
$stmt = $conn->prepare("INSERT INTO users (username, password) VALUES (?, ?)");
|
||||
$stmt->bind_param("ss", $username, $password);
|
||||
|
||||
if ($stmt->execute()) {
|
||||
echo "Account created! <a href='login.php'>Login here</a>";
|
||||
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 @@
|
||||
|
||||
<form action="" method="post">
|
||||
<label>Username</label>
|
||||
<input type="text" placeholder="Masukkan username" />
|
||||
<input type="text" id="username" name="username" placeholder="Masukkan username" />
|
||||
|
||||
<label>Password</label>
|
||||
<input type="password" placeholder="Masukkan password" />
|
||||
<input type="password" id="password" name="password" placeholder="Masukkan password" />
|
||||
|
||||
<button type="submit">Sign Up</button>
|
||||
</form>
|
||||
|
||||
<div class="note">Sudah punya akun? <a href="signin.html">Sign In!</a></div>
|
||||
<div class="note">Sudah punya akun? <a href="signin.php">Sign In!</a></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
x
Reference in New Issue
Block a user