420 lines
15 KiB
PHP
420 lines
15 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../db/config.php';
|
|
require_once __DIR__ . '/lang.php';
|
|
|
|
$user = null;
|
|
if (isset($_SESSION['user_id'])) {
|
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$_SESSION['user_id']]);
|
|
$user = $stmt->fetch();
|
|
}
|
|
|
|
if (!function_exists('getSetting')) {
|
|
function getSetting($key, $default = null) {
|
|
$stmt = db()->prepare("SELECT setting_value FROM system_settings WHERE setting_key = ?");
|
|
$stmt->execute([$key]);
|
|
$row = $stmt->fetch();
|
|
return $row ? $row['setting_value'] : $default;
|
|
}
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="<?= $lang ?>">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<?php
|
|
$site_logo = getSetting('site_logo', '/assets/images/logo.png');
|
|
$site_name = getSetting('site_name', 'BYRO');
|
|
?>
|
|
<title><?= $site_name ?> | <?= __('site_title') ?></title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
|
|
<link rel="stylesheet" href="/assets/css/style.css?v=<?= time() ?>">
|
|
<link rel="icon" href="<?= $site_logo ?>">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
|
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/4.1.1/animate.min.css">
|
|
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans+SC:wght@400;500;700;900&family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--primary: #0062ff;
|
|
--bg: #0b0e11;
|
|
--surface: #1e2329;
|
|
--text: #eaecef;
|
|
--text-muted: #9ba3af;
|
|
--border: #2b3139;
|
|
--success: #26a69a;
|
|
--danger: #ef5350;
|
|
}
|
|
body {
|
|
background-color: var(--bg);
|
|
color: var(--text);
|
|
font-family: 'Noto Sans SC', 'Inter', system-ui, -apple-system, sans-serif;
|
|
margin: 0;
|
|
padding: 0;
|
|
}
|
|
header {
|
|
height: 70px;
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 0 24px;
|
|
border-bottom: 1px solid var(--border);
|
|
position: sticky;
|
|
top: 0;
|
|
background: rgba(0,0,0,0.9);
|
|
backdrop-filter: blur(10px);
|
|
z-index: 1000;
|
|
}
|
|
.logo-container {
|
|
display: flex;
|
|
align-items: center;
|
|
text-decoration: none;
|
|
margin-right: 40px;
|
|
}
|
|
.logo-container img {
|
|
height: 44px;
|
|
width: auto;
|
|
object-fit: contain;
|
|
}
|
|
.logo-icon {
|
|
width: 32px;
|
|
height: 32px;
|
|
background: var(--primary);
|
|
border-radius: 6px;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
margin-right: 10px;
|
|
}
|
|
.logo-text {
|
|
display: none;
|
|
font-size: 24px;
|
|
font-weight: 800;
|
|
color: #fff;
|
|
letter-spacing: -0.5px;
|
|
}
|
|
nav {
|
|
display: flex;
|
|
gap: 24px;
|
|
flex: 1;
|
|
}
|
|
@media (max-width: 992px) {
|
|
nav {
|
|
display: none;
|
|
}
|
|
.logo-container {
|
|
margin-right: auto;
|
|
}
|
|
.profile-trigger span {
|
|
display: none;
|
|
}
|
|
.profile-trigger {
|
|
padding: 8px;
|
|
}
|
|
}
|
|
nav a {
|
|
color: var(--text);
|
|
text-decoration: none;
|
|
font-size: 15px;
|
|
font-weight: 500;
|
|
transition: color 0.2s;
|
|
}
|
|
nav a:hover {
|
|
color: var(--primary);
|
|
}
|
|
.header-right {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 20px;
|
|
}
|
|
.lang-switcher {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
cursor: pointer;
|
|
position: relative;
|
|
padding: 8px 12px;
|
|
border-radius: 8px;
|
|
border: 1px solid var(--border);
|
|
background: rgba(255,255,255,0.05);
|
|
transition: all 0.2s;
|
|
}
|
|
.lang-switcher:hover {
|
|
background: rgba(255,255,255,0.1);
|
|
border-color: var(--primary);
|
|
}
|
|
.flag-icon {
|
|
width: 20px;
|
|
height: 15px;
|
|
object-fit: cover;
|
|
border-radius: 2px;
|
|
}
|
|
.lang-dropdown {
|
|
display: none;
|
|
position: absolute;
|
|
top: calc(100% + 10px);
|
|
right: 0;
|
|
background: #121212;
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
padding: 8px;
|
|
min-width: 160px;
|
|
box-shadow: 0 10px 30px rgba(0,0,0,0.8);
|
|
z-index: 1100;
|
|
}
|
|
.lang-switcher:hover .lang-dropdown {
|
|
display: block;
|
|
}
|
|
.lang-dropdown a {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 10px;
|
|
padding: 12px 16px;
|
|
color: var(--text);
|
|
text-decoration: none;
|
|
font-size: 14px;
|
|
border-radius: 8px;
|
|
transition: background 0.2s;
|
|
}
|
|
.lang-dropdown a:hover {
|
|
background: var(--primary);
|
|
color: #fff;
|
|
}
|
|
.auth-btns a {
|
|
font-size: 14px;
|
|
text-decoration: none;
|
|
color: var(--text);
|
|
padding: 10px 20px;
|
|
border-radius: 6px;
|
|
font-weight: 600;
|
|
}
|
|
.btn-login:hover {
|
|
background: #222;
|
|
}
|
|
.btn-register {
|
|
background: var(--primary);
|
|
color: #fff !important;
|
|
}
|
|
.btn-register:hover {
|
|
background: #0056e0;
|
|
}
|
|
|
|
/* User Dropdown */
|
|
.user-center {
|
|
position: relative;
|
|
}
|
|
.profile-trigger {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
color: var(--text);
|
|
text-decoration: none;
|
|
padding: 8px 12px;
|
|
border-radius: 8px;
|
|
transition: background 0.2s;
|
|
border: 1px solid transparent;
|
|
}
|
|
.profile-trigger:hover {
|
|
background: rgba(255,255,255,0.05);
|
|
border-color: var(--border);
|
|
color: var(--primary);
|
|
}
|
|
.user-dropdown {
|
|
display: none;
|
|
position: absolute;
|
|
top: calc(100% + 10px);
|
|
right: 0;
|
|
background: var(--surface);
|
|
border: 1px solid var(--border);
|
|
border-radius: 12px;
|
|
width: 260px;
|
|
padding: 16px;
|
|
box-shadow: 0 10px 40px rgba(0,0,0,0.8);
|
|
z-index: 1200;
|
|
}
|
|
.user-center:hover .user-dropdown {
|
|
display: block;
|
|
}
|
|
.user-info-header {
|
|
padding-bottom: 12px;
|
|
border-bottom: 1px solid var(--border);
|
|
margin-bottom: 12px;
|
|
}
|
|
.uid-tag {
|
|
font-size: 12px;
|
|
color: var(--text-muted);
|
|
margin-bottom: 4px;
|
|
}
|
|
.user-stats {
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 8px;
|
|
font-size: 13px;
|
|
}
|
|
.stat-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
}
|
|
.stat-label { color: var(--text-muted); }
|
|
.stat-value { color: var(--text); font-weight: 500; }
|
|
.stat-value.success { color: var(--success); }
|
|
|
|
.dropdown-links {
|
|
display: grid;
|
|
grid-template-columns: 1fr 1fr;
|
|
gap: 8px;
|
|
margin-top: 12px;
|
|
}
|
|
.dropdown-links a {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
gap: 6px;
|
|
padding: 10px;
|
|
background: rgba(255,255,255,0.05);
|
|
border-radius: 8px;
|
|
font-size: 13px;
|
|
color: var(--text);
|
|
text-decoration: none;
|
|
transition: all 0.2s;
|
|
}
|
|
.dropdown-links a:hover {
|
|
background: var(--primary);
|
|
color: #fff;
|
|
}
|
|
.logout-link {
|
|
display: block;
|
|
text-align: center;
|
|
margin-top: 16px;
|
|
padding-top: 12px;
|
|
border-top: 1px solid var(--border);
|
|
color: var(--danger);
|
|
text-decoration: none;
|
|
font-size: 13px;
|
|
font-weight: 600;
|
|
}
|
|
</style>
|
|
<script>
|
|
window.coinIcons = {
|
|
'BTC': '1/small/bitcoin.png',
|
|
'ETH': '279/small/ethereum.png',
|
|
'USDT': '325/small/tether.png',
|
|
'BNB': '825/small/binance-coin-logo.png',
|
|
'SOL': '4128/small/solana.png',
|
|
'XRP': '44/small/xrp-symbol-white-128.png',
|
|
'ADA': '975/small/cardano.png',
|
|
'DOGE': '5/small/dogecoin.png',
|
|
'DOT': '12171/small/polkadot.png',
|
|
'MATIC': '4713/small/matic-network.png',
|
|
'AVAX': '12559/small/avalanche.png',
|
|
'LINK': '877/small/chainlink.png',
|
|
'SHIB': '11939/small/shiba-inu.png',
|
|
'TRX': '1094/small/tron.png',
|
|
'BCH': '153/small/bitcoin-cash.png',
|
|
'LTC': '2/small/litecoin.png',
|
|
'UNI': '12504/small/uniswap.png',
|
|
'ARB': '29359/small/arbitrum.png',
|
|
'OP': '25244/small/optimism.png',
|
|
'APT': '27355/small/aptos.png',
|
|
'USDC': '6319/small/usdc.png',
|
|
'PEPE': '31386/small/pepe.png',
|
|
'FIL': '12817/small/filecoin.png',
|
|
'NEAR': '10365/small/near.png',
|
|
'ATOM': '1481/small/cosmos.png',
|
|
'IMX': '17233/small/immutable-x.png',
|
|
'KAS': '26851/small/kaspa.png',
|
|
};
|
|
function getCoinIconJs(symbol) {
|
|
const id = window.coinIcons[symbol.toUpperCase()] || '1/small/bitcoin.png';
|
|
return "https://assets.coingecko.com/coins/images/" + id;
|
|
}
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<header>
|
|
<a href="/" class="logo-container">
|
|
<img src="<?= $site_logo ?>" alt="BYRO">
|
|
</a>
|
|
<nav>
|
|
<a href="/"><?= __('home') ?></a>
|
|
<a href="/market.php"><?= __('market') ?></a>
|
|
<a href="/binary.php"><?= __('second_contract') ?></a>
|
|
<a href="/trade.php"><?= __('spot') ?></a>
|
|
<a href="/contract.php"><?= __('contract') ?></a>
|
|
<a href="/mining.php"><?= __('mining') ?></a>
|
|
<a href="/swap.php"><?= __('swap') ?></a>
|
|
<a href="/app.php"><?= __('app_download') ?></a>
|
|
</nav>
|
|
<div class="header-right">
|
|
<div class="lang-switcher">
|
|
<?php if ($lang === 'zh'): ?>
|
|
<img src="https://flagcdn.com/w40/cn.png" class="flag-icon" alt="CN">
|
|
<span><?= __('chinese') ?></span>
|
|
<?php else: ?>
|
|
<img src="https://flagcdn.com/w40/us.png" class="flag-icon" alt="US">
|
|
<span><?= __('english') ?></span>
|
|
<?php endif; ?>
|
|
<div class="lang-dropdown">
|
|
<a href="?lang=zh">
|
|
<img src="https://flagcdn.com/w40/cn.png" class="flag-icon" alt="CN">
|
|
<?= __('chinese') ?>
|
|
</a>
|
|
<a href="?lang=en">
|
|
<img src="https://flagcdn.com/w40/us.png" class="flag-icon" alt="US">
|
|
<?= __('english') ?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<?php if ($user): ?>
|
|
<div class="user-center">
|
|
<a href="/profile.php" class="profile-trigger">
|
|
<i class="bi bi-person-circle fs-5"></i>
|
|
<span><?= htmlspecialchars($user['username']) ?></span>
|
|
</a>
|
|
<div class="user-dropdown">
|
|
<div class="user-info-header">
|
|
<div class="uid-tag"><?= __('uid') ?>: <?= $user['uid'] ?? 'N/A' ?></div>
|
|
<div class="fw-bold"><?= htmlspecialchars($user['username']) ?></div>
|
|
</div>
|
|
<div class="user-stats">
|
|
<div class="stat-item">
|
|
<span class="stat-label"><?= __('real_name') ?></span>
|
|
<span class="stat-value <?= ($user['kyc_status'] ?? 0) == 2 ? 'success' : 'text-warning' ?>">
|
|
<?php
|
|
$statusMap = [0 => __('unverified'), 1 => __('pending'), 2 => __('verified'), 3 => __('rejected')];
|
|
echo $statusMap[$user['kyc_status'] ?? 0] ?? __('unverified');
|
|
?>
|
|
</span>
|
|
</div>
|
|
<div class="stat-item">
|
|
<span class="stat-label"><?= __('credit_score') ?></span>
|
|
<span class="stat-value text-primary"><?= $user['credit_score'] ?? 80 ?></span>
|
|
</div>
|
|
<?php
|
|
$stmt = db()->prepare("SELECT available FROM user_balances WHERE user_id = ? AND symbol = 'USDT'");
|
|
$stmt->execute([$user['id']]);
|
|
$bal = $stmt->fetch();
|
|
?>
|
|
<div class="stat-item">
|
|
<span class="stat-label"><?= __('assets') ?></span>
|
|
<span class="stat-value"><?= number_format($bal['available'] ?? 0, 2) ?> <?= __('USDT') ?></span>
|
|
</div>
|
|
</div>
|
|
<div class="dropdown-links">
|
|
<a href="/profile.php"><i class="bi bi-person"></i> <?= __('personal') ?></a>
|
|
<a href="/recharge.php"><i class="bi bi-wallet2"></i> <?= __('recharge') ?></a>
|
|
<a href="/withdraw.php"><i class="bi bi-cash-stack"></i> <?= __('withdraw') ?></a>
|
|
<a href="/orders.php"><i class="bi bi-list-check"></i> <?= __('orders') ?></a>
|
|
</div>
|
|
<a href="/auth/logout.php" class="logout-link"><?= __('logout') ?></a>
|
|
</div>
|
|
</div>
|
|
<?php else: ?>
|
|
<div class="auth-btns">
|
|
<a href="/auth/login.php" class="btn-login"><?= __('login') ?></a>
|
|
<a href="/auth/register.php" class="btn-register"><?= __('register') ?></a>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</header>
|