38451-vm/includes/header.php
2026-02-16 02:49:59 +00:00

229 lines
7.5 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();
}
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">
<title>Byro | Professional Digital Asset Exchange</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="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<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: '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-icon {
width: 32px;
height: 32px;
background: var(--primary);
border-radius: 6px;
display: flex;
align-items: center;
justify-content: center;
margin-right: 10px;
}
.logo-text {
font-size: 24px;
font-weight: 800;
color: #fff;
letter-spacing: -0.5px;
}
nav {
display: flex;
gap: 24px;
flex: 1;
}
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;
}
</style>
</head>
<body>
<header>
<a href="/" class="logo-container">
<div class="logo-icon">
<svg width="22" height="22" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2L2 7L12 12L22 7L12 2Z" fill="white"/>
<path d="M12 22L2 17L12 12L22 17L12 22Z" fill="rgba(255,255,255,0.3)"/>
<path d="M2 12L12 17L22 12" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
</div>
<span class="logo-text" style="letter-spacing: 1px;">BYRO</span>
</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>
</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>中文</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">
简体中文
</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="btn btn-outline-light btn-sm me-2"><i class="bi bi-person-circle me-1"></i> <?= __('personal') ?></a>
<a href="/auth/logout.php" class="btn btn-link btn-sm text-muted text-decoration-none"><?= __('logout') ?></a>
</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>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>