412 lines
11 KiB
PHP
412 lines
11 KiB
PHP
<?php
|
|
include 'koneksi.php';
|
|
session_start();
|
|
// If not logged in, redirect to login
|
|
if (!isset($_SESSION['username'])) {
|
|
header('Location: loginn.php');
|
|
exit;
|
|
}
|
|
|
|
// Fetch latest balance from database
|
|
$username = mysqli_real_escape_string($conn, $_SESSION['username']);
|
|
$res = mysqli_query($conn, "SELECT balance FROM users WHERE username = '$username'");
|
|
if ($res && mysqli_num_rows($res) > 0) {
|
|
$row = mysqli_fetch_assoc($res);
|
|
$_SESSION['balance'] = (int)$row['balance'];
|
|
}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="id">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
<title>Blackjack Pro - OCA GameHub</title>
|
|
|
|
<!-- Fonts -->
|
|
<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=Outfit:wght@400;600;700&display=swap" rel="stylesheet">
|
|
|
|
<style>
|
|
:root {
|
|
--bg-color: #0a3a1a; /* Fallback */
|
|
--panel-bg: rgba(0, 60, 20, 0.6);
|
|
--accent: #00FF00;
|
|
--accent-hover: #00CC00;
|
|
--danger: #FF6B6B;
|
|
--text-main: #e8ffe8;
|
|
--text-highlight: #00FF00;
|
|
--text-muted: #88FF88;
|
|
--card-bg: #ffffff;
|
|
--gold: #f59e0b;
|
|
}
|
|
|
|
* { box-sizing: border-box; }
|
|
|
|
body {
|
|
margin: 0;
|
|
min-height: 100vh;
|
|
background: linear-gradient(135deg, #0a3a1a 0%, #0d5a2a 50%, #0f7a3a 100%);
|
|
font-family: 'Outfit', sans-serif;
|
|
color: var(--text-main);
|
|
display: flex;
|
|
justify-content: center;
|
|
align-items: center;
|
|
padding: 20px;
|
|
}
|
|
|
|
.table {
|
|
width: 100%;
|
|
max-width: 1000px;
|
|
background: rgba(0, 40, 10, 0.4);
|
|
backdrop-filter: blur(12px);
|
|
-webkit-backdrop-filter: blur(12px);
|
|
border: 1px solid rgba(0, 255, 0, 0.3);
|
|
border-radius: 24px;
|
|
padding: 30px;
|
|
box-shadow: 0 0 40px rgba(0, 255, 0, 0.1);
|
|
}
|
|
|
|
header {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
margin-bottom: 30px;
|
|
border-bottom: 1px solid rgba(255, 255, 255, 0.1);
|
|
padding-bottom: 20px;
|
|
}
|
|
|
|
.header-top {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
}
|
|
|
|
h1 {
|
|
margin: 0;
|
|
font-size: 28px;
|
|
font-weight: 700;
|
|
color: var(--text-highlight);
|
|
text-shadow: 0 0 15px rgba(0, 255, 0, 0.5);
|
|
background: none;
|
|
-webkit-background-clip: unset;
|
|
-webkit-text-fill-color: unset;
|
|
}
|
|
|
|
.user-actions {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 15px;
|
|
}
|
|
|
|
.user-badge {
|
|
background: rgba(0, 255, 0, 0.15);
|
|
border: 1px solid rgba(0, 255, 0, 0.3);
|
|
padding: 8px 16px;
|
|
border-radius: 50px;
|
|
font-size: 14px;
|
|
color: var(--text-highlight);
|
|
}
|
|
|
|
.btn-link {
|
|
text-decoration: none;
|
|
padding: 8px 16px;
|
|
border-radius: 12px;
|
|
font-weight: 600;
|
|
font-size: 14px;
|
|
transition: all 0.2s;
|
|
}
|
|
|
|
.btn-topup {
|
|
background: linear-gradient(135deg, #00FF00, #00CC00);
|
|
color: #000;
|
|
}
|
|
.btn-topup:hover {
|
|
box-shadow: 0 0 20px rgba(0, 255, 0, 0.6);
|
|
transform: translateY(-2px);
|
|
}
|
|
.btn-logout { background: transparent; border: 1px solid var(--danger); color: var(--danger); }
|
|
.btn-logout:hover { background: var(--danger); color: white; box-shadow: 0 0 15px rgba(255, 107, 107, 0.4); }
|
|
|
|
.game-stats {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
align-items: center;
|
|
background: rgba(0, 0, 0, 0.25);
|
|
border: 1px solid rgba(0, 255, 0, 0.1);
|
|
padding: 15px 20px;
|
|
border-radius: 16px;
|
|
}
|
|
|
|
.stat-group {
|
|
display: flex;
|
|
gap: 20px;
|
|
}
|
|
|
|
.stat-item {
|
|
display: flex;
|
|
flex-direction: column;
|
|
}
|
|
|
|
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 1px; }
|
|
.stat-value { font-size: 20px; font-weight: 700; color: var(--gold); }
|
|
|
|
.bet-controls {
|
|
display: flex;
|
|
gap: 10px;
|
|
align-items: center;
|
|
}
|
|
|
|
input[type="number"] {
|
|
background: rgba(0, 100, 0, 0.2);
|
|
border: 1px solid rgba(0, 255, 0, 0.3);
|
|
color: var(--text-highlight);
|
|
padding: 10px;
|
|
border-radius: 8px;
|
|
width: 100px;
|
|
font-family: inherit;
|
|
font-size: 16px;
|
|
text-align: center;
|
|
}
|
|
|
|
input[type="number"]:focus {
|
|
outline: none;
|
|
border-color: #00FF00;
|
|
box-shadow: 0 0 10px rgba(0, 255, 0, 0.3);
|
|
}
|
|
|
|
/* Game Board */
|
|
main {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 20px;
|
|
}
|
|
|
|
.board-section {
|
|
background: rgba(0, 20, 5, 0.3);
|
|
border-radius: 20px;
|
|
padding: 20px;
|
|
min-height: 300px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
position: relative;
|
|
border: 1px solid rgba(0, 255, 0, 0.1);
|
|
}
|
|
|
|
.section-title {
|
|
font-size: 14px;
|
|
text-transform: uppercase;
|
|
letter-spacing: 2px;
|
|
color: var(--text-muted);
|
|
margin-bottom: 20px;
|
|
}
|
|
|
|
.hand {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
flex-wrap: wrap;
|
|
gap: 12px;
|
|
min-height: 140px;
|
|
}
|
|
|
|
/* Card Styling */
|
|
.card {
|
|
width: 90px;
|
|
height: 130px;
|
|
background: var(--card-bg);
|
|
border-radius: 12px;
|
|
color: #333;
|
|
position: relative;
|
|
display: flex;
|
|
flex-direction: column;
|
|
justify-content: space-between;
|
|
padding: 10px;
|
|
font-family: system-ui, sans-serif;
|
|
font-weight: bold;
|
|
font-size: 24px;
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);
|
|
transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
|
|
animation: dealCard 0.4s ease-out backwards;
|
|
}
|
|
|
|
.card:hover { transform: translateY(-10px) scale(1.05); z-index: 10; }
|
|
|
|
@keyframes dealCard {
|
|
from { opacity: 0; transform: translateY(-50px) scale(0.5); }
|
|
to { opacity: 1; transform: none; }
|
|
}
|
|
|
|
.card.red { color: #e11d48; }
|
|
.card.back {
|
|
background: linear-gradient(135deg, #052e16 0%, #14532d 100%);
|
|
color: transparent;
|
|
border: 2px solid rgba(0,255,0,0.2);
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
.card.back::after {
|
|
content: "♠";
|
|
color: rgba(0,255,0,0.2);
|
|
font-size: 40px;
|
|
}
|
|
|
|
.values {
|
|
margin-top: auto;
|
|
background: rgba(0, 0, 0, 0.3);
|
|
border: 1px solid rgba(0, 255, 0, 0.2);
|
|
padding: 5px 15px;
|
|
border-radius: 50px;
|
|
font-size: 18px;
|
|
font-weight: 600;
|
|
color: var(--text-highlight);
|
|
}
|
|
|
|
/* Action Buttons */
|
|
.actions-container {
|
|
grid-column: 1 / -1;
|
|
display: flex;
|
|
flex-direction: column;
|
|
align-items: center;
|
|
gap: 20px;
|
|
margin-top: 20px;
|
|
}
|
|
|
|
.action-buttons {
|
|
display: flex;
|
|
gap: 15px;
|
|
}
|
|
|
|
.btn-game {
|
|
padding: 12px 30px;
|
|
border: none;
|
|
border-radius: 12px;
|
|
font-size: 16px;
|
|
font-weight: 600;
|
|
color: white;
|
|
cursor: pointer;
|
|
transition: transform 0.1s, filter 0.2s;
|
|
box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
|
|
font-family: 'Outfit', sans-serif;
|
|
}
|
|
|
|
.btn-game:active { transform: scale(0.95); }
|
|
.btn-hit {
|
|
background: linear-gradient(to bottom, #00FF00, #00CC00);
|
|
color: #000;
|
|
}
|
|
.btn-stand { background: linear-gradient(to bottom, #ef4444, #dc2626); }
|
|
.btn-double { background: linear-gradient(to bottom, #f59e0b, #d97706); }
|
|
.btn-bet {
|
|
background: linear-gradient(to bottom, #00FF00, #00CC00);
|
|
color: #000;
|
|
}
|
|
.btn-secondary {
|
|
background: rgba(0, 255, 0, 0.1);
|
|
color: var(--text-highlight);
|
|
border: 1px solid var(--text-highlight);
|
|
}
|
|
|
|
.btn-game:hover { filter: brightness(1.1); transform: translateY(-2px); box-shadow: 0 0 15px rgba(0, 255, 0, 0.3); }
|
|
.btn-game:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(1); transform: none; box-shadow: none;}
|
|
|
|
#message {
|
|
height: 40px;
|
|
font-size: 24px;
|
|
font-weight: 700;
|
|
text-align: center;
|
|
margin-top: 10px;
|
|
}
|
|
|
|
.win { color: #4ade80; text-shadow: 0 0 20px rgba(74, 222, 128, 0.5); }
|
|
.lose { color: #f87171; text-shadow: 0 0 20px rgba(248, 113, 113, 0.5); }
|
|
|
|
footer {
|
|
text-align: center;
|
|
margin-top: 40px;
|
|
color: var(--text-muted);
|
|
font-size: 13px;
|
|
}
|
|
|
|
/* Responsive */
|
|
@media (max-width: 768px) {
|
|
main { grid-template-columns: 1fr; }
|
|
.header-top { flex-direction: column; gap: 15px; }
|
|
.game-stats { flex-direction: column; gap: 15px; align-items: stretch; }
|
|
.bet-controls { justify-content: center; }
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<div class="table" role="application" aria-label="Blackjack Game">
|
|
|
|
<header>
|
|
<div class="header-top">
|
|
<h1>Blackjack [21]</h1>
|
|
<div class="user-actions">
|
|
<div class="user-badge">
|
|
User: <strong><?php echo htmlspecialchars($_SESSION['username']); ?></strong>
|
|
</div>
|
|
<a href="topup.php" class="btn-link btn-topup">Top Up</a>
|
|
<a href="logout.php" class="btn-link btn-logout">Logout</a>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="game-stats">
|
|
<div class="stat-group">
|
|
<div class="stat-item">
|
|
<span class="stat-label">Bank</span>
|
|
<span class="stat-value" id="balance"><?php echo isset($_SESSION['balance']) ? (int)$_SESSION['balance'] : 0; ?></span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label">Taruhan Saat Ini</span>
|
|
<span class="stat-value" id="current-bet">0</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bet-controls">
|
|
<input id="bet-input" type="number" min="1" value="50" placeholder="Bet" />
|
|
<button id="bet-btn" class="btn-game btn-bet">Pasang Taruhan</button>
|
|
<button id="new-round" class="btn-game btn-secondary">Reset</button>
|
|
</div>
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<!-- Dealer Area -->
|
|
<div class="board-section" id="dealer-area">
|
|
<div class="section-title">Dealer's Hand</div>
|
|
<div class="hand" id="dealer-hand"></div>
|
|
<div class="values" id="dealer-value"></div>
|
|
</div>
|
|
|
|
<!-- Player Area -->
|
|
<div class="board-section" id="player-area">
|
|
<div class="section-title">Your Hand</div>
|
|
<div class="hand" id="player-hand"></div>
|
|
<div class="values" id="player-value"></div>
|
|
</div>
|
|
|
|
<!-- Action Area -->
|
|
<div class="actions-container">
|
|
<div id="message"></div>
|
|
<div class="action-buttons" id="action-buttons">
|
|
<button id="hit" class="btn-game btn-hit">Hit</button>
|
|
<button id="stand" class="btn-game btn-stand">Stand</button>
|
|
<button id="double" class="btn-game btn-double">Double</button>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<footer>
|
|
OCA GameHub © 2025 - <span style="opacity:0.6">Semoga menang bosq!</span>
|
|
</footer>
|
|
</div>
|
|
|
|
<script src="ody git.js?v=<?php echo time(); ?>"></script>
|
|
</body>
|
|
</html>
|