Compare commits

..

No commits in common. "ai-dev" and "master" have entirely different histories.

68 changed files with 438 additions and 7836 deletions

View File

@ -1,67 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 1000px; margin: 0 auto;">
<h1 style="font-size: 3.5rem; font-weight: 800; margin-bottom: 30px; background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">
About NovaEx
</h1>
<p style="font-size: 1.4rem; color: var(--text-muted); line-height: 1.8; margin-bottom: 60px;">
Founded in 2017, NovaEx has grown from a visionary startup to a global leader in the cryptocurrency exchange industry. Our mission is to accelerate the world's transition to a more open, efficient, and inclusive financial system through blockchain technology.
</p>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-bottom: 80px;">
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139;">
<i class="fas fa-rocket" style="font-size: 2rem; color: #4facfe; margin-bottom: 20px;"></i>
<h3 style="font-size: 1.8rem; margin-bottom: 15px;">Our Mission</h3>
<p style="color: var(--text-muted); line-height: 1.6;">To empower individuals and institutions with secure, intuitive, and high-performance tools for trading and managing digital assets.</p>
</div>
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139;">
<i class="fas fa-eye" style="font-size: 2rem; color: #00f2fe; margin-bottom: 20px;"></i>
<h3 style="font-size: 1.8rem; margin-bottom: 15px;">Our Vision</h3>
<p style="color: var(--text-muted); line-height: 1.6;">A world where decentralized finance is accessible to everyone, creating a borderless economy based on transparency and trust.</p>
</div>
</div>
<section style="margin-bottom: 80px;">
<h2 style="font-size: 2.2rem; margin-bottom: 30px;">Our Journey</h2>
<div style="display: flex; flex-direction: column; gap: 30px;">
<div style="display: flex; gap: 20px;">
<div style="width: 80px; font-weight: bold; color: #4facfe;">2017</div>
<div style="flex: 1; border-left: 2px solid #2b3139; padding-left: 20px;">
<h4 style="font-size: 1.2rem; margin-bottom: 10px;">The Beginning</h4>
<p style="color: var(--text-muted);">NovaEx was founded by a team of veteran financiers and blockchain experts with a focus on security and transparency.</p>
</div>
</div>
<div style="display: flex; gap: 20px;">
<div style="width: 80px; font-weight: bold; color: #4facfe;">2019</div>
<div style="flex: 1; border-left: 2px solid #2b3139; padding-left: 20px;">
<h4 style="font-size: 1.2rem; margin-bottom: 10px;">Global Expansion</h4>
<p style="color: var(--text-muted);">Achieved 1 million registered users and launched professional trading tools and mobile applications.</p>
</div>
</div>
<div style="display: flex; gap: 20px;">
<div style="width: 80px; font-weight: bold; color: #4facfe;">2021</div>
<div style="flex: 1; border-left: 2px solid #2b3139; padding-left: 20px;">
<h4 style="font-size: 1.2rem; margin-bottom: 10px;">Institutional Grade</h4>
<p style="color: var(--text-muted);">Integrated advanced security features and custodial solutions for institutional investors worldwide.</p>
</div>
</div>
<div style="display: flex; gap: 20px;">
<div style="width: 80px; font-weight: bold; color: #4facfe;">Today</div>
<div style="flex: 1; border-left: 2px solid #2b3139; padding-left: 20px;">
<h4 style="font-size: 1.2rem; margin-bottom: 10px;">Market Leader</h4>
<p style="color: var(--text-muted);">Processing billions in daily volume with users across 180+ countries, leading the way in crypto innovation.</p>
</div>
</div>
</div>
</section>
<section style="text-align: center; background: linear-gradient(135deg, #161a1e 0%, #0b0e11 100%); padding: 60px; border-radius: 32px; border: 1px solid #2b3139;">
<h2 style="font-size: 2rem; margin-bottom: 20px;">Security is Our DNA</h2>
<p style="color: var(--text-muted); margin-bottom: 30px; max-width: 600px; margin-left: auto; margin-right: auto;">We utilize state-of-the-art encryption, multi-signature cold storage, and 24/7 monitoring to ensure your assets are always safe.</p>
<a href="register.php" class="btn-primary" style="padding: 15px 40px; font-size: 1.1rem; border-radius: 12px;">Join the Revolution</a>
</section>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,254 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
// Handle Actions
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action'])) {
$action = $_POST['action'];
if ($action == 'add_agent') {
$username = $_POST['username'];
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$role = 'agent';
$remark = $_POST['remark'] ?? '';
$permissions = isset($_POST['perms']) ? json_encode($_POST['perms']) : '[]';
$stmt = $pdo->prepare("INSERT INTO admins (username, password, role, permissions, remark) VALUES (?, ?, ?, ?, ?)");
$stmt->execute([$username, $password, $role, $permissions, $remark]);
} elseif ($action == 'update_agent') {
$id = $_POST['id'];
$username = $_POST['username'];
$remark = $_POST['remark'] ?? '';
$permissions = isset($_POST['perms']) ? json_encode($_POST['perms']) : '[]';
$sql = "UPDATE admins SET username = ?, permissions = ?, remark = ? WHERE id = ?";
$params = [$username, $permissions, $remark, $id];
if (!empty($_POST['password'])) {
$sql = "UPDATE admins SET username = ?, permissions = ?, remark = ?, password = ? WHERE id = ?";
$params = [$username, $permissions, $remark, password_hash($_POST['password'], PASSWORD_DEFAULT), $id];
}
$pdo->prepare($sql)->execute($params);
} elseif ($action == 'delete_agent') {
$id = $_POST['id'];
$pdo->prepare("DELETE FROM admins WHERE id = ? AND role = 'agent'")->execute([$id]);
}
header("Location: agents.php");
exit;
}
$agents = $pdo->query("SELECT * FROM admins WHERE role = 'agent' ORDER BY id DESC")->fetchAll();
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>代理管理 - NovaEx 管理后台</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root { --primary: #f0b90b; --bg: #ffffff; --text: #1e2329; --border: #eaecef; }
body { background: #f4f6f9; color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 0; }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #ffffff; border-right: 1px solid var(--border); padding: 1.5rem; }
.main-content { flex: 1; padding: 2rem; background: #ffffff; }
.menu-item { padding: 12px 15px; color: #474d57; text-decoration: none; display: flex; align-items: center; gap: 12px; border-radius: 8px; margin-bottom: 8px; transition: 0.2s; }
.menu-item:hover, .menu-item.active { background: #f5f5f5; color: var(--primary); font-weight: bold; }
.badge { background: #f6465d; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.card { background: white; border-radius: 12px; border: 1px solid var(--border); padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
.table th, .table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.table th { background: #f9fafb; color: #707a8a; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; }
.btn { padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; border: none; cursor: pointer; font-weight: 500; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn-primary { background: var(--primary); color: black; }
.btn-danger { background: #f6465d; color: white; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-content { background: white; width: 600px; padding: 30px; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); max-height: 90vh; overflow-y: auto; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #474d57; }
.form-group input, .form-group select, .form-group textarea { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; outline: none; box-sizing: border-box; }
.perms-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 10px; border: 1px solid var(--border); padding: 15px; border-radius: 8px; }
.perm-item { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
</style>
</head>
<body>
<div class="admin-layout">
<div class="sidebar">
<h2 style="color: var(--primary); margin-bottom: 2rem;">NovaEx Admin</h2>
<a href="index.php" class="menu-item"><i class="fas fa-home"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="agents.php" class="menu-item active"><i class="fas fa-user-shield"></i> 代理管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核</a>
<a href="chat.php" class="menu-item">
<i class="fas fa-comments"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="options_orders.php" class="menu-item"><i class="fas fa-clock"></i> 秒合约</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;">
<h1>代理管理</h1>
<button class="btn btn-primary" onclick="showModal('addAgentModal')"><i class="fas fa-plus"></i> 添加子管理员/代理</button>
</div>
<div class="card">
<table class="table">
<thead>
<tr>
<th>ID / 账号</th>
<th>角色</th>
<th>备注</th>
<th>权限范围</th>
<th>创建时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($agents as $agent): ?>
<tr>
<td>
<div style="font-weight: bold;"><?php echo $agent['id']; ?></div>
<div style="font-size: 0.9rem; color: #474d57;"><?php echo htmlspecialchars($agent['username']); ?></div>
</td>
<td><span style="background: #eef2f7; padding: 4px 8px; border-radius: 4px; font-size: 0.8rem;">分管理代理</span></td>
<td style="color: #707a8a; font-size: 0.85rem;"><?php echo htmlspecialchars($agent['remark'] ?: '-'); ?></td>
<td>
<?php
$perms = json_decode($agent['permissions'] ?: '[]', true);
if(empty($perms)) echo '<span style="color: #ccc;">无权限</span>';
else echo '<span style="font-size: 0.75rem; color: #00c087;">' . count($perms) . ' 项权限</span>';
?>
</td>
<td style="font-size: 0.8rem; color: #848e9c;"><?php echo $agent['created_at']; ?></td>
<td>
<div style="display: flex; gap: 8px;">
<button class="btn btn-primary btn-sm" onclick='editAgent(<?php echo json_encode($agent); ?>)'><i class="fas fa-edit"></i></button>
<form method="POST" style="display: inline;" onsubmit="return confirm('确定要删除此代理吗?')">
<input type="hidden" name="id" value="<?php echo $agent['id']; ?>">
<input type="hidden" name="action" value="delete_agent">
<button type="submit" class="btn btn-danger btn-sm"><i class="fas fa-trash"></i></button>
</form>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Add Agent Modal -->
<div id="addAgentModal" class="modal">
<div class="modal-content">
<div class="modal-header" style="display: flex; justify-content: space-between; margin-bottom: 20px;">
<h3>添加代理管理员</h3>
<i class="fas fa-times" onclick="hideModal('addAgentModal')" style="cursor: pointer;"></i>
</div>
<form method="POST">
<input type="hidden" name="action" value="add_agent">
<div class="form-group">
<label>登录账号</label>
<input type="text" name="username" required placeholder="输入代理登录用户名">
</div>
<div class="form-group">
<label>登录密码</label>
<input type="password" name="password" required placeholder="输入登录密码">
</div>
<div class="form-group">
<label>代理备注</label>
<textarea name="remark" rows="2" placeholder="备注该代理的线下明确信息..."></textarea>
</div>
<div class="form-group">
<label>设置权限</label>
<div class="perms-grid">
<div class="perm-item"><input type="checkbox" name="perms[]" value="users"> 用户管理</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="kyc"> KYC 审核</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="chat"> 客服管理</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="options"> 秒合约订单</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="spot"> 现货订单</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="futures"> 合约订单</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="orders"> 充值记录</div>
</div>
</div>
<div style="text-align: right; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('addAgentModal')">取消</button>
<button type="submit" class="btn btn-primary">确认添加</button>
</div>
</form>
</div>
</div>
<!-- Edit Agent Modal -->
<div id="editAgentModal" class="modal">
<div class="modal-content">
<div class="modal-header" style="display: flex; justify-content: space-between; margin-bottom: 20px;">
<h3>编辑代理权限</h3>
<i class="fas fa-times" onclick="hideModal('editAgentModal')" style="cursor: pointer;"></i>
</div>
<form method="POST">
<input type="hidden" name="action" value="update_agent">
<input type="hidden" name="id" id="edit_agent_id">
<div class="form-group">
<label>登录账号</label>
<input type="text" name="username" id="edit_agent_username" required>
</div>
<div class="form-group">
<label>修改密码 (不填则不修改)</label>
<input type="password" name="password" placeholder="留空保持原密码">
</div>
<div class="form-group">
<label>代理备注</label>
<textarea name="remark" id="edit_agent_remark" rows="2"></textarea>
</div>
<div class="form-group">
<label>权限设置</label>
<div class="perms-grid" id="edit_perms_grid">
<div class="perm-item"><input type="checkbox" name="perms[]" value="users"> 用户管理</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="kyc"> KYC 审核</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="chat"> 客服管理</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="options"> 秒合约订单</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="spot"> 现货订单</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="futures"> 合约订单</div>
<div class="perm-item"><input type="checkbox" name="perms[]" value="orders"> 充值记录</div>
</div>
</div>
<div style="text-align: right; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('editAgentModal')">取消</button>
<button type="submit" class="btn btn-primary">保存修改</button>
</div>
</form>
</div>
</div>
<script>
function showModal(id) { document.getElementById(id).style.display = 'flex'; }
function hideModal(id) { document.getElementById(id).style.display = 'none'; }
function editAgent(agent) {
document.getElementById('edit_agent_id').value = agent.id;
document.getElementById('edit_agent_username').value = agent.username;
document.getElementById('edit_agent_remark').value = agent.remark || '';
const perms = JSON.parse(agent.permissions || '[]');
const checkboxes = document.querySelectorAll('#edit_perms_grid input[type="checkbox"]');
checkboxes.forEach(cb => {
cb.checked = perms.includes(cb.value);
});
showModal('editAgentModal');
}
</script>
</body>
</html>

View File

@ -1,158 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
// Handle deletion of chat
if (isset($_GET['action']) && $_GET['action'] === 'delete' && isset($_GET['delete_user_id'])) {
$del_id = $_GET['delete_user_id'];
// Delete messages
$pdo->prepare("DELETE FROM messages WHERE user_id = ?")->execute([$del_id]);
// Optionally update orders to not show in chat
$pdo->prepare("UPDATE fiat_orders SET status = 'rejected' WHERE user_id = ? AND status IN ('matching', 'submitting')")->execute([$del_id]);
header("Location: chat.php");
exit;
}
$user_id = $_GET['user_id'] ?? null;
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
// Fetch users with messages or active recharge orders
$chat_users = $pdo->query("
SELECT DISTINCT u.id, u.username, u.uid,
(SELECT message FROM messages WHERE user_id = u.id ORDER BY id DESC LIMIT 1) as last_msg,
(SELECT created_at FROM messages WHERE user_id = u.id ORDER BY id DESC LIMIT 1) as last_time,
(SELECT COUNT(*) FROM messages WHERE user_id = u.id AND sender = 'user' AND is_read = 0) as unread_count,
(SELECT status FROM fiat_orders WHERE user_id = u.id AND status IN ('matching', 'submitting') LIMIT 1) as recharge_status
FROM users u
JOIN messages m ON u.id = m.user_id
UNION
SELECT DISTINCT u.id, u.username, u.uid,
'发起充值申请' as last_msg,
o.created_at as last_time,
0 as unread_count,
o.status as recharge_status
FROM users u
JOIN fiat_orders o ON u.id = o.user_id
WHERE o.status IN ('matching', 'submitting')
ORDER BY last_time DESC
")->fetchAll();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>客服管理 - NovaEx 管理后台</title>
<link rel="stylesheet" href="../assets/css/custom.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #1E2329; border-right: 1px solid #2B3139; padding: 1rem; }
.chat-container { flex: 1; display: flex; background: #0B0E11; height: 100vh; overflow: hidden; }
.user-list { width: 300px; border-right: 1px solid #2B3139; background: #1E2329; overflow-y: auto; }
.chat-main { flex: 1; display: flex; flex-direction: column; }
.menu-item { padding: 12px; color: #848E9C; text-decoration: none; display: flex; align-items: center; gap: 10px; border-radius: 4px; margin-bottom: 5px; }
.menu-item:hover, .menu-item.active { background: #2B3139; color: white; }
.badge { background: #f6465d; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.user-item { padding: 15px; border-bottom: 1px solid #2B3139; cursor: pointer; position: relative; display: flex; flex-direction: column; }
.user-item:hover, .user-item.active { background: #2B3139; }
.user-info-row { display: flex; justify-content: space-between; align-items: center; width: 100%; }
.user-name { font-weight: bold; color: white; font-size: 0.9rem; flex: 1; }
.delete-btn { color: #848E9C; font-size: 0.9rem; padding: 5px; cursor: pointer; z-index: 10; }
.delete-btn:hover { color: #f6465d; }
.last-msg { color: #848E9C; font-size: 0.75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 5px; width: 90%; }
.dot { width: 10px; height: 10px; background: #f6465d; border-radius: 50%; }
.recharge-label { font-size: 0.7rem; background: rgba(240, 185, 11, 0.2); color: #f0b90b; padding: 2px 5px; border-radius: 3px; margin-left: 5px; }
.back-btn { color: #848E9C; text-decoration: none; font-size: 0.9rem; padding: 15px; border-bottom: 1px solid #2B3139; display: block; }
.back-btn:hover { color: white; background: #2B3139; }
/* Custom alert */
#custom-alert { display: none; position: fixed; top: 20px; right: 20px; background: #f0b90b; color: black; padding: 20px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); z-index: 10000; animation: slideIn 0.5s; width: 300px; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
</style>
</head>
<body>
<div id="custom-alert">
<div style="display: flex; align-items: center; gap: 12px; margin-bottom: 10px;">
<i class="fas fa-bell fa-lg"></i>
<strong style="font-size: 1.1rem;">新通知 / NEW NOTIFICATION</strong>
</div>
<div id="alert-msg">您有新的充值申请或用户消息。</div>
<button onclick="location.reload()" style="margin-top: 15px; width: 100%; padding: 8px; background: black; color: white; border: none; border-radius: 6px; cursor: pointer; font-weight: bold;">立即查看</button>
</div>
<div class="admin-layout">
<div class="sidebar">
<h3 style="color: white; margin-bottom: 2rem;">NovaEx 管理员</h3>
<a href="index.php" class="menu-item"><i class="fas fa-chart-pie"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核</a>
<a href="chat.php" class="menu-item active">
<i class="fas fa-headset"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="chat-container">
<div class="user-list">
<a href="index.php" class="back-btn"><i class="fas fa-arrow-left"></i> 返回</a>
<div style="padding: 15px; color: #848E9C; font-size: 0.8rem; border-bottom: 1px solid #2B3139;">最近联系人 / 充值申请</div>
<?php foreach($chat_users as $u): ?>
<div class="user-item <?php echo $user_id == $u['id'] ? 'active' : ''; ?>" onclick="if(event.target.closest('.delete-btn')) return; location.href='chat.php?user_id=<?php echo $u['id']; ?>'">
<div class="user-info-row">
<div class="user-name">
<?php echo htmlspecialchars($u['username']); ?>
<?php if($u['recharge_status']): ?><span class="recharge-label">充值申请</span><?php endif; ?>
</div>
<div style="display: flex; align-items: center; gap: 10px;">
<?php if($u['unread_count'] > 0 || $u['recharge_status'] == 'matching'): ?><div class="dot"></div><?php endif; ?>
<i class="fas fa-trash delete-btn" title="删除记录" onclick="if(confirm('确定要删除与该用户的聊天及充值申请吗?')) window.location.href='chat.php?action=delete&delete_user_id=<?php echo $u['id']; ?>'"></i>
</div>
</div>
<div class="last-msg"><?php echo htmlspecialchars($u['last_msg']); ?></div>
</div>
<?php endforeach; ?>
</div>
<div class="chat-main">
<?php if($user_id): ?>
<iframe src="chat_iframe.php?user_id=<?php echo $user_id; ?>" style="width: 100%; height: 100%; border: none;"></iframe>
<?php else: ?>
<div style="flex: 1; display: flex; align-items: center; justify-content: center; color: #5e6673; flex-direction: column;">
<i class="fas fa-comments" style="font-size: 4rem; margin-bottom: 20px;"></i>
<p>请在左侧选择一个用户或处理中的充值申请</p>
</div>
<?php endif; ?>
</div>
</div>
</div>
<audio id="notif-sound" src="https://assets.mixkit.co/active_storage/sfx/2869/2869-preview.mp3" preload="auto"></audio>
<script>
let lastTotal = <?php echo ($unread_msgs + $pending_orders); ?>;
function checkNotifications() {
fetch('../api/get_messages.php?action=count_unread')
.then(res => res.json())
.then(data => {
if (data.total > lastTotal) {
document.getElementById('notif-sound').play().catch(e => {});
document.getElementById('custom-alert').style.display = 'block';
document.getElementById('alert-msg').innerText = "您有新的充值申请或用户消息 (当前未读: " + data.total + ")";
}
lastTotal = data.total;
});
}
setInterval(checkNotifications, 5000);
</script>
</body>
</html>

View File

@ -1,241 +0,0 @@
<?php
require_once '../db/config.php';
require_once '../includes/currency_helper.php';
session_start();
$pdo = db();
$user_id = $_GET['user_id'] ?? null;
if (!$user_id) die("User ID required");
// Mark as read
$pdo->prepare("UPDATE messages SET is_read = 1 WHERE user_id = ? AND sender = 'user'")->execute([$user_id]);
// Handle Message Sending
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['message'])) {
$msg = $_POST['message'];
$pdo->prepare("INSERT INTO messages (user_id, sender, message, type) VALUES (?, 'admin', ?, 'text')")->execute([$user_id, $msg]);
exit;
}
// Handle Recharge Actions
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action'])) {
$oid = $_POST['order_id'];
if ($_POST['action'] == 'match') {
$bank = $_POST['bank_name'] ?? '';
$name = $_POST['account_name'] ?? '';
$number = $_POST['account_number'] ?? '';
$remarks = $_POST['remarks'] ?? '';
$info = "🏦 银行名称:$bank\n👤 收款姓名:$name\n💳 收款账号:$number\n📝 备注说明:$remarks";
$pdo->prepare("UPDATE fiat_orders SET status = 'matched', bank_account_info = ? WHERE id = ?")->execute([$info, $oid]);
// Send the info as a chat message
$pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, $info]);
$notif = "✅ 匹配成功!收款账户已下发。请在页面强制弹窗中查看详细信息并进行转账。";
$pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, $notif]);
} elseif ($_POST['action'] == 'complete') {
$stmt = $pdo->prepare("SELECT amount, currency, exchange_rate FROM fiat_orders WHERE id = ?");
$stmt->execute([$oid]);
$order = $stmt->fetch();
$amt = $order['amount'];
$cur = $order['currency'];
$fiat_rates = get_fiat_rates();
$real_time_rate = $fiat_rates[$cur] ?? $order['exchange_rate'];
$usdt_amt = ($real_time_rate > 0) ? ($amt / $real_time_rate) : $amt;
$pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$usdt_amt, $user_id]);
$pdo->prepare("UPDATE fiat_orders SET status = 'completed', usdt_amount = ?, exchange_rate = ? WHERE id = ?")
->execute([$usdt_amt, $real_time_rate, $oid]);
$notif = "🎉 充值已确认到账!\n金额:" . number_format($amt, 2) . " $cur\n实时汇率1 USDT = " . number_format($real_time_rate, 4) . " $cur\n入账" . number_format($usdt_amt, 2) . " USDT";
$pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, $notif]);
} elseif ($_POST['action'] == 'reject') {
$pdo->prepare("UPDATE fiat_orders SET status = 'rejected' WHERE id = ?")->execute([$oid]);
$pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$user_id, "❌ 您的充值申请 #$oid 已被拒绝。"]);
}
}
$user = $pdo->prepare("SELECT * FROM users WHERE id = ?");
$user->execute([$user_id]);
$userData = $user->fetch();
$messages = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY created_at ASC");
$messages->execute([$user_id]);
$msgs = $messages->fetchAll();
$orders = $pdo->prepare("SELECT * FROM fiat_orders WHERE user_id = ? AND status IN ('matching', 'submitting', 'matched') ORDER BY id DESC");
$orders->execute([$user_id]);
$pending_orders = $orders->fetchAll();
$current_rates = get_fiat_rates();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; background: #0B0E11; color: white; display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.chat-header { padding: 15px 20px; background: #1E2329; border-bottom: 1px solid #2B3139; display: flex; justify-content: space-between; align-items: center; z-index: 10; }
.main-content { flex: 1; display: flex; flex-direction: column; overflow-y: auto; }
.chat-box { flex: 1; padding: 20px; display: flex; flex-direction: column; gap: 15px; }
.msg { max-width: 85%; padding: 12px 16px; border-radius: 12px; font-size: 14px; line-height: 1.6; position: relative; }
.msg.admin { align-self: flex-end; background: #f0b90b; color: black; border-bottom-right-radius: 2px; }
.msg.user { align-self: flex-start; background: #2B3139; color: #EAECEF; border-bottom-left-radius: 2px; }
.msg-time { font-size: 10px; color: #848E9C; margin-top: 5px; display: block; text-align: right; }
.recharge-panel { background: #1E2329; border-bottom: 1px solid #2B3139; padding: 15px 20px; }
.order-card { background: #161A1E; border: 1px solid #2B3139; border-radius: 16px; padding: 15px; margin-bottom: 12px; }
.input-area { padding: 15px 20px; background: #1E2329; border-top: 1px solid #2B3139; display: flex; gap: 12px; }
input[type="text"], input[type="number"], textarea { width: 100%; background: #0B0E11; border: 1px solid #2B3139; color: white; padding: 10px; border-radius: 8px; outline: none; margin-bottom: 8px; font-size: 13px; }
button { background: #f0b90b; border: none; color: black; padding: 10px 20px; border-radius: 8px; cursor: pointer; font-weight: bold; }
.status-badge { font-size: 10px; padding: 4px 10px; border-radius: 6px; font-weight: 800; }
.matching { background: rgba(240, 185, 11, 0.1); color: #f0b90b; }
.submitting { background: rgba(0, 192, 135, 0.1); color: #00c087; }
.btn-complete { background: #00c087; color: white; }
.btn-reject { background: #f6465d; color: white; }
</style>
</head>
<body>
<div class="chat-header">
<div>
<span style="font-weight: 800;"><?php echo htmlspecialchars($userData['username'] ?? 'User'); ?></span>
<span style="color: #848E9C; font-size: 11px; margin-left: 8px;">UID: <?php echo $userData['uid'] ?? 'N/A'; ?></span>
<span style="color: #848E9C; font-size: 11px; margin-left: 8px;">IP: <?php echo $userData['last_ip'] ?: '127.0.0.1'; ?></span>
</div>
<div style="text-align: right;">
<div style="font-size: 11px; color: #848E9C;">余额: <span style="color: #00c087;"><?php echo number_format($userData['balance'] ?? 0, 2); ?> USDT</span></div>
</div>
</div>
<div class="main-content">
<?php if (!empty($pending_orders)): ?>
<div class="recharge-panel">
<div style="font-weight: bold; color: #F0B90B; margin-bottom: 10px; font-size: 12px;">待处理充值</div>
<?php foreach($pending_orders as $o):
$is_matching = ($o['status'] == 'matching');
$live_rate = $current_rates[$o['currency']] ?? $o['exchange_rate'];
$live_usdt = ($live_rate > 0) ? ($o['amount'] / $live_rate) : $o['amount'];
?>
<div class="order-card">
<div style="display: flex; justify-content: space-between; margin-bottom: 10px;">
<div>
<div style="font-size: 1rem; font-weight: 900;"><?php echo number_format($o['amount'], 2); ?> <?php echo $o['currency']; ?></div>
<div style="font-size: 11px; color: #848E9C;"> <?php echo number_format($live_usdt, 2); ?> USDT (汇率: <?php echo number_format($live_rate, 4); ?>)</div>
</div>
<span class="status-badge <?php echo $o['status']; ?>">
<?php
if($o['status'] == 'matching') echo '等待分配账户';
elseif($o['status'] == 'matched') echo '已分配/待支付';
elseif($o['status'] == 'submitting') echo '已提交凭证';
?>
</span>
</div>
<?php if($is_matching): ?>
<form method="POST">
<input type="hidden" name="order_id" value="<?php echo $o['id']; ?>">
<input type="hidden" name="action" value="match">
<input type="text" name="bank_name" placeholder="银行名称 (如: 中国工商银行)" required>
<input type="text" name="account_name" placeholder="收款人姓名" required>
<input type="text" name="account_number" placeholder="银行账号" required>
<textarea name="remarks" placeholder="注意事项 (可选)" style="height: 50px;"></textarea>
<button type="submit" style="width: 100%;">确认匹配账户</button>
</form>
<?php else:
?>
<div style="background: rgba(255,255,255,0.03); padding: 10px; border-radius: 8px; margin-bottom: 10px; font-size: 12px;">
<?php echo nl2br(htmlspecialchars($o['bank_account_info'])); ?>
</div>
<div style="display: flex; gap: 10px; align-items: center;">
<?php if($o['proof_image']): ?>
<a href="../<?php echo $o['proof_image']; ?>" target="_blank" style="color: #00c087; font-size: 12px; text-decoration: none; border: 1px solid #00c087; padding: 5px 10px; border-radius: 5px;">查看凭证</a>
<?php endif; ?>
<div style="flex: 1; display: flex; gap: 5px; justify-content: flex-end;">
<form method="POST">
<input type="hidden" name="order_id" value="<?php echo $o['id']; ?>">
<input type="hidden" name="action" value="complete">
<button type="submit" class="btn-complete" style="padding: 5px 10px; font-size: 12px;">同意</button>
</form>
<form method="POST">
<input type="hidden" name="order_id" value="<?php echo $o['id']; ?>">
<input type="hidden" name="action" value="reject">
<button type="submit" class="btn-reject" style="padding: 5px 10px; font-size: 12px;">拒绝</button>
</form>
</div>
</div>
<?php endif; ?>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="chat-box" id="chat-box">
<?php foreach($msgs as $m): ?>
<?php if (strpos($m['message'], '[RECHARGE_NOTIFICATION]') !== false):
?>
<div style="align-self: center; background: rgba(240, 185, 11, 0.1); color: #f0b90b; padding: 10px 20px; border-radius: 10px; font-size: 12px; border: 1px dashed #f0b90b; margin: 10px 0; text-align: center;">
<i class="fas fa-bell"></i> <?php echo nl2br(htmlspecialchars($m['message'])); ?>
</div>
<?php else:
?>
<div class="msg <?php echo $m['sender']; ?>">
<?php if ($m['type'] === 'image'): ?>
<img src="../<?php echo $m['message']; ?>" style="max-width: 100%; border-radius: 8px; cursor: pointer;" onclick="window.open(this.src)">
<?php else:
?>
<?php echo nl2br(htmlspecialchars($m['message'])); ?>
<?php endif;
?>
<span class="msg-time"><?php echo date('H:i', strtotime($m['created_at'])); ?></span>
</div>
<?php endif;
?>
<?php endforeach;
?>
</div>
</div>
<form class="input-area" id="msg-form">
<input type="text" id="msg-input" placeholder="输入消息..." autocomplete="off">
<button type="submit"><i class="fas fa-paper-plane"></i></button>
</form>
<script>
const chatBox = document.getElementById('chat-box');
chatBox.scrollTop = chatBox.scrollHeight;
document.getElementById('msg-form').onsubmit = async (e) => {
e.preventDefault();
const input = document.getElementById('msg-input');
const msg = input.value.trim();
if (!msg) return;
const formData = new FormData();
formData.append('message', msg);
input.value = '';
const msgDiv = document.createElement('div');
msgDiv.className = 'msg admin';
msgDiv.innerHTML = msg.replace(/\n/g, '<br>') + `<span class="msg-time">${new Date().getHours()}:${new Date().getMinutes()}</span>`;
chatBox.appendChild(msgDiv);
chatBox.scrollTop = chatBox.scrollHeight;
await fetch(window.location.href, { method: 'POST', body: formData });
};
let lastCount = <?php echo count($msgs); ?>;
setInterval(async () => {
const res = await fetch('../api/get_messages.php?user_id=<?php echo $user_id; ?>');
const data = await res.json();
if (data && data.count > lastCount) {
location.reload();
}
}, 4000);
</script>
</body>
</html>

View File

@ -1,164 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
$faceValue = 10;
if (isset($_POST['action']) && isset($_POST['order_id'])) {
$oid = $_POST['order_id'];
$action = $_POST['action'];
$orderStmt = $pdo->prepare("SELECT o.*, u.balance FROM trading_orders o JOIN users u ON o.user_id = u.id WHERE o.id = ?");
$orderStmt->execute([$oid]);
$order = $orderStmt->fetch();
if ($order && $order['status'] == 'open') {
$user_id = $order['user_id'];
$margin = $order['total'] / $order['leverage'];
if ($action == 'approve') {
// "WIN": Approve and settle at TP price (if set) or current manual price
$exit_price = (float)($order['tp_price'] ?: $order['price']);
$entry_price = (float)$order['price'];
$nominal = (float)$order['amount'] * $faceValue;
$profit = 0;
if ($order['side'] == 'buy') {
$profit = ($exit_price / $entry_price - 1) * $nominal;
} else {
$profit = (1 - $exit_price / $entry_price) * $nominal;
}
$payout = $margin + $profit;
if ($payout < 0) $payout = 0;
$pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$payout, $user_id]);
$pdo->prepare("UPDATE trading_orders SET status = 'closed', admin_status = 'approved', win_loss = 'win' WHERE id = ?")->execute([$oid]);
} elseif ($action == 'reject') {
// "LOSS": Reject. Margin is already deducted and not returned.
$pdo->prepare("UPDATE trading_orders SET status = 'cancelled', admin_status = 'rejected', win_loss = 'loss' WHERE id = ?")->execute([$oid]);
}
}
}
$orders = $pdo->query("SELECT o.*, u.username, u.uid FROM trading_orders o JOIN users u ON o.user_id = u.id WHERE o.type = 'futures' ORDER BY o.id DESC")->fetchAll();
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>合约交易管理 - NovaEx 管理后台</title>
<link rel="stylesheet" href="../assets/css/custom.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #FFFFFF; border-right: 1px solid #EAECEF; padding: 1rem; }
.main-content { flex: 1; padding: 2rem; background: #FFFFFF; color: #1E2329; }
.menu-item { padding: 12px; color: #474D57; text-decoration: none; display: flex; align-items: center; gap: 10px; border-radius: 4px; margin-bottom: 5px; }
.menu-item:hover, .menu-item.active { background: #F5F5F5; color: #F0B90B; }
.badge { background: #F6465D; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid #EAECEF; font-size: 0.8rem; color: #1E2329; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 4px; cursor: pointer; border: none; margin-right: 5px; }
.btn-approve { background: #00c087; color: white; }
.btn-reject { background: #f6465d; color: white; }
.back-btn { color: #707A8A; text-decoration: none; font-size: 0.9rem; margin-bottom: 20px; display: inline-block; }
.status-badge { padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.status-open { background: #fff3cd; color: #856404; }
.status-closed { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }
</style>
</head>
<body style="background: white;">
<div class="admin-layout">
<div class="sidebar">
<h3 style="color: #1E2329; margin-bottom: 2rem;">NovaEx 管理员</h3>
<a href="index.php" class="menu-item"><i class="fas fa-chart-pie"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核</a>
<a href="chat.php" class="menu-item">
<i class="fas fa-headset"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="options_orders.php" class="menu-item"><i class="fas fa-clock"></i> 秒合约</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item active"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<a href="index.php" class="back-btn"><i class="fas fa-arrow-left"></i> 返回</a>
<h2 style="color: #1E2329;">合约交易管理 (后台控赢/)</h2>
<p style="color: #707A8A; font-size: 0.9rem;">提示:同意结算将按用户设置的“止盈价”计算盈利并返还保证金;拒绝(亏损)将扣除全部保证金。</p>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>用户</th>
<th>币对</th>
<th>方向</th>
<th>杠杆</th>
<th>开仓价</th>
<th>张数</th>
<th>保证金</th>
<th>止盈价</th>
<th>止损价</th>
<th>状态</th>
<th>结果</th>
<th>下单时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($orders as $o): ?>
<tr>
<td><?php echo $o['id']; ?></td>
<td><?php echo htmlspecialchars($o['username']); ?> (<?php echo $o['uid']; ?>)</td>
<td><?php echo $o['symbol']; ?></td>
<td style="color: <?php echo $o['side'] == 'buy' ? '#00c087' : '#f6465d'; ?>">
<?php echo $o['side'] == 'buy' ? '做多' : '做空'; ?>
</td>
<td><?php echo $o['leverage']; ?>x</td>
<td><?php echo number_format($o['price'], 2); ?></td>
<td><?php echo $o['amount']; ?></td>
<td><?php echo number_format($o['total'] / $o['leverage'], 2); ?> USDT</td>
<td style="color: #00c087;"><?php echo $o['tp_price'] ?: '--'; ?></td>
<td style="color: #f6465d;"><?php echo $o['sl_price'] ?: '--'; ?></td>
<td>
<span class="status-badge status-<?php echo $o['status']; ?>">
<?php echo $o['status'] == 'open' ? '持仓中' : ($o['status'] == 'closed' ? '已平仓' : '已撤单'); ?>
</span>
</td>
<td>
<?php if($o['win_loss'] == 'win'): ?>
<span style="color: #00c087;">控赢</span>
<?php elseif($o['win_loss'] == 'loss'): ?>
<span style="color: #f6465d;">控亏</span>
<?php else: ?>
--
<?php endif; ?>
</td>
<td><?php echo $o['created_at']; ?></td>
<td>
<?php if($o['status'] == 'open'): ?>
<form method="POST" style="display: inline;">
<input type="hidden" name="order_id" value="<?php echo $o['id']; ?>">
<button type="submit" name="action" value="approve" class="btn-sm btn-approve">控赢</button>
<button type="submit" name="action" value="reject" class="btn-sm btn-reject">控亏</button>
</form>
<?php else: ?>
--
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>

View File

@ -1,99 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$db = db();
$total_users = $db->query("SELECT COUNT(*) FROM users")->fetchColumn();
$pending_kyc = $db->query("SELECT COUNT(*) FROM users WHERE kyc_status = 1")->fetchColumn();
$pending_orders = $db->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
$unread_msgs = $db->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>管理后台 - NovaEx</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root { --primary: #f0b90b; --bg: #ffffff; --text: #1e2329; --border: #eaecef; }
body { background: #f4f6f9; color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 0; }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #ffffff; border-right: 1px solid var(--border); padding: 1.5rem; }
.main-content { flex: 1; padding: 2rem; background: #ffffff; }
.menu-item { padding: 12px 15px; color: #474d57; text-decoration: none; display: flex; align-items: center; gap: 12px; border-radius: 8px; margin-bottom: 8px; transition: 0.2s; }
.menu-item:hover, .menu-item.active { background: #f5f5f5; color: var(--primary); font-weight: bold; }
.badge { background: #f6465d; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.stat-card { background: white; padding: 25px; border-radius: 12px; border: 1px solid var(--border); box-shadow: 0 2px 10px rgba(0,0,0,0.03); }
.stat-label { color: #707a8a; font-size: 0.85rem; margin-bottom: 10px; font-weight: 600; text-transform: uppercase; }
.stat-value { font-size: 2.2rem; font-weight: 800; color: #1e2329; }
</style>
</head>
<body>
<div class="admin-layout">
<div class="sidebar">
<h2 style="color: var(--primary); margin-bottom: 2rem;">NovaEx Admin</h2>
<a href="index.php" class="menu-item active"><i class="fas fa-home"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="agents.php" class="menu-item"><i class="fas fa-user-shield"></i> 代理管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核
<?php if($pending_kyc > 0): ?><span class="badge"><?php echo $pending_kyc; ?></span><?php endif; ?>
</a>
<a href="chat.php" class="menu-item"><i class="fas fa-comments"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="options_orders.php" class="menu-item"><i class="fas fa-clock"></i> 秒合约</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
<a href="../index.php" class="menu-item" style="margin-top: 2rem; color: #f0b90b;"><i class="fas fa-external-link-alt"></i> 前端首页</a>
</div>
<div class="main-content">
<h1 style="margin-bottom: 2rem;">系统概览</h1>
<div style="display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.5rem;">
<div class="stat-card">
<div class="stat-label">总注册用户</div>
<div class="stat-value"><?php echo $total_users; ?></div>
</div>
<div class="stat-card">
<div class="stat-label">待审核 KYC</div>
<div class="stat-value" style="color: #f0b90b;"><?php echo $pending_kyc; ?></div>
</div>
<div class="stat-card">
<div class="stat-label">待匹配充值</div>
<div class="stat-value" style="color: #f6465d;"><?php echo $pending_orders; ?></div>
</div>
<div class="stat-card">
<div class="stat-label">待回复消息</div>
<div class="stat-value" style="color: #00c087;"><?php echo $unread_msgs; ?></div>
</div>
</div>
<div style="margin-top: 3rem; background: #f9fafb; padding: 30px; border-radius: 16px; border: 1px solid var(--border);">
<h2 style="margin-bottom: 20px;">控制中心</h2>
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;">
<div style="background: white; padding: 25px; border-radius: 12px; border: 1px solid var(--border);">
<h3>充值与客服</h3>
<p style="color: #707a8a; font-size: 0.9rem;">实时处理充值申请并与用户在线沟通。</p>
<a href="chat.php" style="background: var(--primary); color: black; padding: 10px 20px; border-radius: 8px; text-decoration: none; display: inline-block; margin-top: 15px; font-weight: bold;">进入客服中心</a>
</div>
<div style="background: white; padding: 25px; border-radius: 12px; border: 1px solid var(--border);">
<h3>交易订单</h3>
<p style="color: #707a8a; font-size: 0.9rem;">监控秒合约、现货及合约交易流水。</p>
<div style="margin-top: 15px; display: flex; gap: 10px;">
<a href="options_orders.php" style="background: #f4f6f9; color: #474d57; padding: 8px 15px; border-radius: 6px; text-decoration: none; font-size: 0.85rem;">秒合约</a>
<a href="futures_orders.php" style="background: #f4f6f9; color: #474d57; padding: 8px 15px; border-radius: 6px; text-decoration: none; font-size: 0.85rem;">合约交易</a>
</div>
</div>
<div style="background: white; padding: 25px; border-radius: 12px; border: 1px solid var(--border);">
<h3>全局设置</h3>
<p style="color: #707a8a; font-size: 0.9rem;">修改系统参数、胜率及站点 LOGO。</p>
<a href="settings.php" style="color: var(--primary); text-decoration: none; display: block; margin-top: 15px; font-weight: bold;">立即配置 <i class="fas fa-arrow-right"></i></a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,91 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
if (isset($_POST['action']) && isset($_POST['user_id'])) {
$uid = $_POST['user_id'];
$status = $_POST['action'] == 'approve' ? 2 : 0;
$pdo->prepare("UPDATE users SET kyc_status = ? WHERE id = ?")->execute([$status, $uid]);
}
$kyc_list = $pdo->query("SELECT * FROM users WHERE kyc_status = 1 ORDER BY id DESC")->fetchAll();
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>KYC 审核 - NovaEx 管理后台</title>
<link rel="stylesheet" href="../assets/css/custom.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #FFFFFF; border-right: 1px solid #EAECEF; padding: 1rem; }
.main-content { flex: 1; padding: 2rem; background: #FFFFFF; color: #1E2329; }
.menu-item { padding: 12px; color: #474D57; text-decoration: none; display: flex; align-items: center; gap: 10px; border-radius: 4px; margin-bottom: 5px; }
.menu-item:hover, .menu-item.active { background: #F5F5F5; color: #F0B90B; }
.badge { background: #F6465D; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.kyc-card { background: #F9FAFB; border: 1px solid #EAECEF; padding: 20px; border-radius: 8px; margin-bottom: 20px; }
.kyc-img { width: 200px; height: 120px; object-fit: cover; border-radius: 4px; cursor: pointer; border: 1px solid #EAECEF; }
.back-btn { color: #707A8A; text-decoration: none; font-size: 0.9rem; margin-bottom: 20px; display: inline-block; }
.btn-primary { padding: 10px 20px; border-radius: 4px; border: none; cursor: pointer; color: white; font-weight: bold; }
</style>
</head>
<body style="background: white;">
<div class="admin-layout">
<div class="sidebar">
<h3 style="color: #1E2329; margin-bottom: 2rem;">NovaEx 管理员</h3>
<a href="index.php" class="menu-item"><i class="fas fa-chart-pie"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="kyc.php" class="menu-item active"><i class="fas fa-id-card"></i> KYC 审核</a>
<a href="chat.php" class="menu-item">
<i class="fas fa-headset"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<a href="index.php" class="back-btn"><i class="fas fa-arrow-left"></i> 返回</a>
<h2 style="color: #1E2329;">待审核 KYC</h2>
<?php if(empty($kyc_list)): ?>
<p style="color: #707A8A; margin-top: 2rem;">暂无待审核申请。</p>
<?php endif; ?>
<?php foreach($kyc_list as $k): ?>
<div class="kyc-card">
<div style="display: flex; justify-content: space-between; align-items: flex-start;">
<div>
<h4 style="margin-bottom: 10px; color: #1E2329;"><?php echo htmlspecialchars($k['kyc_name']); ?></h4>
<p style="color: #707A8A; font-size: 0.9rem;">身份证号: <?php echo htmlspecialchars($k['kyc_id_number']); ?></p>
<p style="color: #707A8A; font-size: 0.8rem; margin-top: 5px;">用户名: <?php echo htmlspecialchars($k['username']); ?> (UID: <?php echo $k['uid']; ?>)</p>
</div>
<div style="display: flex; gap: 10px;">
<form method="POST">
<input type="hidden" name="user_id" value="<?php echo $k['id']; ?>">
<input type="hidden" name="action" value="approve">
<button type="submit" class="btn-primary" style="background: #00c087;">通过审核</button>
</form>
<form method="POST">
<input type="hidden" name="user_id" value="<?php echo $k['id']; ?>">
<input type="hidden" name="action" value="reject">
<button type="submit" class="btn-primary" style="background: #f6465d;">拒绝申请</button>
</form>
</div>
</div>
<div style="display: flex; gap: 15px; margin-top: 20px;">
<img src="../<?php echo $k['kyc_id_front']; ?>" class="kyc-img" onclick="window.open(this.src)">
<img src="../<?php echo $k['kyc_id_back']; ?>" class="kyc-img" onclick="window.open(this.src)">
<img src="../<?php echo $k['kyc_id_handheld']; ?>" class="kyc-img" onclick="window.open(this.src)">
</div>
</div>
<?php endforeach; ?>
</div>
</div>
</body>
</html>

View File

@ -1,135 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action'])) {
$id = $_POST['id'];
$control = $_POST['control']; // 'none', 'win', 'loss'
$stmt = $pdo->prepare("UPDATE option_orders SET control = ? WHERE id = ? AND status = 'pending'");
$stmt->execute([$control, $id]);
header("Location: options_orders.php");
exit;
}
$orders = $pdo->query("SELECT o.*, u.username, u.win_loss_control as user_control FROM option_orders o JOIN users u ON o.user_id = u.id ORDER BY o.id DESC")->fetchAll();
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
$pending_kyc = $pdo->query("SELECT COUNT(*) FROM users WHERE kyc_status = 1")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>秒合约订单 - NovaEx 管理后台</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root { --primary: #f0b90b; --bg: #ffffff; --text: #1e2329; --border: #eaecef; }
body { background: #f4f6f9; color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 0; }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #ffffff; border-right: 1px solid var(--border); padding: 1.5rem; }
.main-content { flex: 1; padding: 2rem; background: #ffffff; }
.menu-item { padding: 12px 15px; color: #474d57; text-decoration: none; display: flex; align-items: center; gap: 12px; border-radius: 8px; margin-bottom: 8px; transition: 0.2s; }
.menu-item:hover, .menu-item.active { background: #f5f5f5; color: var(--primary); font-weight: bold; }
.badge { background: #f6465d; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.card { background: white; border-radius: 12px; border: 1px solid var(--border); padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; font-size: 0.85rem; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #f9fafb; color: #707a8a; font-weight: 600; text-transform: uppercase; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 4px; border: 1px solid transparent; cursor: pointer; }
.control-active { border: 2px solid #000 !important; font-weight: bold; }
</style>
</head>
<body>
<div class="admin-layout">
<div class="sidebar">
<h2 style="color: var(--primary); margin-bottom: 2rem;">NovaEx Admin</h2>
<a href="index.php" class="menu-item"><i class="fas fa-home"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="agents.php" class="menu-item"><i class="fas fa-user-shield"></i> 代理管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核
<?php if($pending_kyc > 0): ?><span class="badge"><?php echo $pending_kyc; ?></span><?php endif; ?>
</a>
<a href="chat.php" class="menu-item"><i class="fas fa-comments"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="options_orders.php" class="menu-item active"><i class="fas fa-clock"></i> 秒合约</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<h1>秒合约订单管理</h1>
<div class="card" style="margin-top: 20px;">
<table class="table">
<thead>
<tr>
<th>ID / 用户</th>
<th>交易对</th>
<th>方向</th>
<th>金额</th>
<th>周期</th>
<th>开仓价</th>
<th>状态</th>
<th>当前控制</th>
<th>时间</th>
<th>输赢干预</th>
</tr>
</thead>
<tbody>
<?php foreach ($orders as $o): ?>
<tr>
<td>
<div style="font-weight: bold;"><?php echo $o['id']; ?></div>
<div style="font-size: 0.75rem; color: #707a8a;"><?php echo htmlspecialchars($o['username']); ?></div>
</td>
<td><?php echo $o['symbol']; ?></td>
<td><span style="color: <?php echo $o['direction'] == 'up' ? '#00c087' : '#f6465d'; ?>; font-weight: bold;"><?php echo $o['direction'] == 'up' ? '买涨 ↑' : '买跌 ↓'; ?></span></td>
<td style="font-weight: bold;"><?php echo number_format($o['amount'], 2); ?></td>
<td><?php echo $o['duration']; ?>s</td>
<td><?php echo number_format($o['opening_price'], 2); ?></td>
<td>
<span style="background: #eef2f7; padding: 3px 8px; border-radius: 4px; font-size: 0.75rem;">
<?php echo $o['status'] == 'pending' ? '进行中' : '已结算'; ?>
</span>
</td>
<td>
<?php
$ctrl = $o['control'];
if ($o['status'] == 'pending') {
if ($ctrl != 'none') {
echo "<span style='color: ".($ctrl == 'win' ? '#00c087' : '#f6465d')."; font-weight: bold;'>单控: ".($ctrl == 'win' ? '赢' : '亏')."</span>";
} else {
$uc = $o['user_control'];
echo "<span style='color: #848e9c;'>".($uc == 'none' ? '默认' : ($uc == 'win' ? '全控赢' : '全控亏'))."</span>";
}
} else {
echo "<span style='color: ".($o['result'] == 'win' ? '#00c087' : '#f6465d')."; font-weight: bold;'>".($o['result'] == 'win' ? '盈利' : '亏损')."</span>";
}
?>
</td>
<td style="font-size: 0.75rem; color: #848e9c;"><?php echo $o['created_at']; ?></td>
<td>
<?php if($o['status'] == 'pending'): ?>
<form method="POST" style="display: flex; gap: 5px;">
<input type="hidden" name="id" value="<?php echo $o['id']; ?>">
<input type="hidden" name="action" value="control">
<button type="submit" name="control" value="win" class="btn-sm <?php echo $ctrl == 'win' ? 'control-active' : ''; ?>" style="background: #00c087; color: white;">控赢</button>
<button type="submit" name="control" value="loss" class="btn-sm <?php echo $ctrl == 'loss' ? 'control-active' : ''; ?>" style="background: #f6465d; color: white;">控亏</button>
<button type="submit" name="control" value="none" class="btn-sm <?php echo $ctrl == 'none' ? 'control-active' : ''; ?>" style="background: #eee; color: #333;">取消</button>
</form>
<?php else: ?>
<span style="color: #ccc;">已结单</span>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</body>
</html>

View File

@ -1,147 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
// Handle Actions
if (isset($_POST['action'])) {
$id = $_POST['order_id'];
$table = $_POST['order_table'] === 'fiat' ? 'fiat_orders' : 'orders';
if ($_POST['action'] == 'match') {
$info = $_POST['account_info'];
$column = ($table === 'fiat_orders') ? 'bank_account_info' : 'account_info';
$pdo->prepare("UPDATE $table SET status = 'matched', $column = ? WHERE id = ?")->execute([$info, $id]);
$orderStmt = $pdo->prepare("SELECT user_id FROM $table WHERE id = ?");
$orderStmt->execute([$id]);
$order = $orderStmt->fetch();
if ($order) {
$msg = "您的充值订单 #$id 匹配成功。请刷新支付页面查看收款账户详情并按要求完成转账。";
$pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$order['user_id'], $msg]);
}
} elseif ($_POST['action'] == 'complete') {
$orderStmt = $pdo->prepare("SELECT user_id, amount, currency FROM $table WHERE id = ?");
$orderStmt->execute([$id]);
$order = $orderStmt->fetch();
if ($order) {
$pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$order['amount'], $order['user_id']]);
$pdo->prepare("UPDATE $table SET status = 'completed' WHERE id = ?")->execute([$id]);
$msg = "您的充值 " . $order['amount'] . " " . ($order['currency'] ?? 'USDT') . " 已确认到账。";
$pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'admin', ?)")->execute([$order['user_id'], $msg]);
}
} elseif ($_POST['action'] == 'reject') {
$pdo->prepare("UPDATE $table SET status = 'rejected' WHERE id = ?")->execute([$id]);
}
}
$fiat_orders = $pdo->query("SELECT o.*, u.username, u.uid, 'fiat' as tbl FROM fiat_orders o JOIN users u ON o.user_id = u.id ORDER BY o.id DESC")->fetchAll();
$usdt_orders = $pdo->query("SELECT o.*, u.username, u.uid, 'usdt' as tbl FROM orders o JOIN users u ON o.user_id = u.id ORDER BY o.id DESC")->fetchAll();
$all_deposits = array_merge($fiat_orders, $usdt_orders);
usort($all_deposits, function($a, $b) {
$priority = ['matching' => 3, 'submitting' => 2, 'pending' => 2, 'matched' => 1, 'completed' => 0];
$pA = $priority[$a['status']] ?? 0;
$pB = $priority[$b['status']] ?? 0;
if ($pA != $pB) return $pB - $pA;
return $b['id'] - $a['id'];
});
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders_count = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>充值管理 - NovaEx 管理后台</title>
<link rel="stylesheet" href="../assets/css/custom.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #1E2329; border-right: 1px solid #2B3139; padding: 1rem; }
.main-content { flex: 1; padding: 2rem; background: #0B0E11; color: white; overflow-x: auto; }
.menu-item { padding: 12px; color: #848E9C; text-decoration: none; display: flex; align-items: center; gap: 10px; border-radius: 4px; margin-bottom: 5px; }
.menu-item:hover, .menu-item.active { background: #2B3139; color: white; }
.badge { background: var(--danger-color); color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; margin-bottom: 3rem; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid #2B3139; font-size: 0.85rem; }
.status-badge { padding: 3px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; }
.matching { background: rgba(255, 60, 0, 0.2); color: #ff3c00; border: 1px solid #ff3c00; animation: blink 1s infinite; }
.submitting { background: rgba(0, 192, 135, 0.2); color: #00c087; border: 1px solid #00c087; }
.matched { background: rgba(55, 122, 255, 0.1); color: #377aff; }
.completed { background: rgba(0, 192, 135, 0.1); color: #00c087; opacity: 0.6; }
@keyframes blink { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.back-btn { color: #848E9C; text-decoration: none; font-size: 0.9rem; margin-bottom: 20px; display: inline-block; }
</style>
</head>
<body>
<div class="admin-layout">
<div class="sidebar">
<h3 style="color: white; margin-bottom: 2rem;">NovaEx 管理员</h3>
<a href="index.php" class="menu-item"><i class="fas fa-chart-pie"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核</a>
<a href="chat.php" class="menu-item">
<i class="fas fa-headset"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders_count > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders_count); ?></span><?php endif; ?>
</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item active"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<a href="index.php" class="back-btn"><i class="fas fa-arrow-left"></i> 返回</a>
<h2>充值申请管理</h2>
<table class="table">
<thead>
<tr>
<th>ID</th><th>用户</th><th>类型</th><th>金额</th><th>凭证</th><th>状态</th><th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($all_deposits as $o): ?>
<tr>
<td>#<?php echo $o['id']; ?></td>
<td><?php echo htmlspecialchars($o['username']); ?> (UID: <?php echo $o['uid']; ?>)</td>
<td><span style="color: <?php echo $o['tbl'] == 'usdt' ? '#26a17b' : '#007bff'; ?>"><?php echo strtoupper($o['tbl']); ?></span></td>
<td><b><?php echo number_format($o['amount'], 2); ?> <?php echo $o['currency']; ?></b></td>
<td>
<?php
$img = ($o['tbl'] == 'fiat' ? ($o['proof_image'] ?? null) : ($o['proof_img'] ?? null));
if($img): ?>
<a href="../<?php echo $img; ?>" target="_blank" style="color: #00c087; font-weight: bold;"><i class="fas fa-image"></i> 查看凭证</a>
<?php else: ?>
<span style="color: #555;">未上传</span>
<?php endif; ?>
</td>
<td><span class="status-badge <?php echo $o['status']; ?>"><?php echo strtoupper($o['status']); ?></span></td>
<td>
<?php if($o['status'] == 'matching'): ?>
<form method="POST" style="display: flex; gap: 5px;">
<input type="hidden" name="order_id" value="<?php echo $o['id']; ?>">
<input type="hidden" name="order_table" value="<?php echo $o['tbl']; ?>">
<input type="hidden" name="action" value="match">
<input type="text" name="account_info" placeholder="收款账户信息" required style="padding: 8px; background: #1e2329; border: 1px solid #2b3139; color: white; border-radius: 4px;">
<button type="submit" class="btn-primary" style="background: #ff3c00;">分配账户</button>
</form>
<?php elseif($o['status'] == 'submitting' || $o['status'] == 'matched'): ?>
<form method="POST">
<input type="hidden" name="order_id" value="<?php echo $o['id']; ?>">
<input type="hidden" name="order_table" value="<?php echo $o['tbl']; ?>">
<input type="hidden" name="action" value="complete">
<button type="submit" class="btn-primary" style="background: #00c087;">确认入金</button>
</form>
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>

View File

@ -1,174 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$db = db();
// Basic security check (could be improved with a proper login session for admins)
if (!isset($_SESSION['user_id'])) {
// For now, if not logged in at all, redirect to main login
// In a real scenario, we'd have a separate admin login
}
$message = "";
$error = "";
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['settings'])) {
foreach ($_POST['settings'] as $name => $value) {
$stmt = $db->prepare("INSERT INTO settings (name, value) VALUES (?, ?) ON DUPLICATE KEY UPDATE value = ?");
$stmt->execute([$name, $value, $value]);
}
$message = "系统设置已成功更新。";
}
if (isset($_FILES['logo']) && $_FILES['logo']['error'] === UPLOAD_ERR_OK) {
$ext = pathinfo($_FILES['logo']['name'], PATHINFO_EXTENSION);
$filename = 'logo_' . time() . '.' . $ext;
$target = '../assets/images/' . $filename;
if (!is_dir('../assets/images')) {
mkdir('../assets/images', 0775, true);
}
if (move_uploaded_file($_FILES['logo']['tmp_name'], $target)) {
$logo_url = 'assets/images/' . $filename;
$stmt = $db->prepare("INSERT INTO settings (name, value) VALUES ('site_logo', ?) ON DUPLICATE KEY UPDATE value = ?");
$stmt->execute([$logo_url, $logo_url]);
$message = "LOGO 已成功上传。";
} else {
$error = "LOGO 上传失败。";
}
}
}
$settings_res = $db->query("SELECT * FROM settings")->fetchAll();
$settings = [];
foreach($settings_res as $s) $settings[$s['name']] = $s['value'];
$unread_msgs = $db->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $db->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>系统设置 - 管理后台</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root { --primary: #f0b90b; --bg: #ffffff; --text: #1e2329; --border: #eaecef; --card-bg: #f9fafb; }
body { background: #f4f6f9; color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 0; }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #ffffff; border-right: 1px solid var(--border); padding: 1.5rem; }
.main-content { flex: 1; padding: 2rem; background: #ffffff; }
.menu-item { padding: 12px 15px; color: #474d57; text-decoration: none; display: flex; align-items: center; gap: 12px; border-radius: 8px; margin-bottom: 8px; transition: 0.2s; }
.menu-item:hover, .menu-item.active { background: #f5f5f5; color: var(--primary); font-weight: bold; }
.badge { background: #f6465d; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.card { background: white; border-radius: 12px; border: 1px solid var(--border); padding: 25px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); margin-bottom: 2rem; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #474d57; }
input[type="text"], input[type="number"], select, textarea { width: 100%; padding: 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; outline: none; box-sizing: border-box; }
input:focus, textarea:focus { border-color: var(--primary); }
.btn { padding: 12px 30px; border-radius: 8px; font-weight: bold; cursor: pointer; border: none; transition: 0.2s; }
.btn-primary { background: var(--primary); color: #000; }
.btn-primary:hover { opacity: 0.9; }
.logo-preview { max-width: 200px; max-height: 100px; margin-bottom: 15px; border: 1px solid var(--border); padding: 10px; border-radius: 8px; background: #f0f0f0; }
</style>
</head>
<body>
<div class="admin-layout">
<div class="sidebar">
<h2 style="color: var(--primary); margin-bottom: 2rem;">NovaEx Admin</h2>
<a href="index.php" class="menu-item"><i class="fas fa-home"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="agents.php" class="menu-item"><i class="fas fa-user-shield"></i> 代理管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核</a>
<a href="chat.php" class="menu-item">
<i class="fas fa-comments"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="options_orders.php" class="menu-item"><i class="fas fa-clock"></i> 秒合约</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item active"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<h1 style="margin-bottom: 30px;">系统设置</h1>
<?php if($message): ?>
<div style="background: #e6fcf5; color: #00c087; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #00c087;"><i class="fas fa-check-circle"></i> <?php echo $message; ?></div>
<?php endif; ?>
<?php if($error): ?>
<div style="background: #fff5f5; color: #f6465d; padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid #f6465d;"><i class="fas fa-exclamation-circle"></i> <?php echo $error; ?></div>
<?php endif; ?>
<div class="card">
<h3>站点配置 (LOGO / 图标)</h3>
<form method="POST" enctype="multipart/form-data">
<div class="form-group">
<label>当前 LOGO</label>
<?php if(isset($settings['site_logo'])): ?>
<img src="../<?php echo $settings['site_logo']; ?>" class="logo-preview" alt="Logo">
<?php else: ?>
<div class="logo-preview" style="display: flex; align-items: center; justify-content: center; color: #ccc;">未设置 LOGO</div>
<?php endif; ?>
<input type="file" name="logo" accept="image/*">
<p style="font-size: 0.8rem; color: #707a8a; margin-top: 5px;">建议尺寸: 200x60 像素。上传后将同步更新前端 LOGO 和网站图标。</p>
</div>
<button type="submit" class="btn btn-primary">上传并更新 LOGO</button>
</form>
</div>
<form method="POST">
<div class="card">
<h3>1. 交易与胜率控制</h3>
<div class="form-group">
<label>全局胜率控制 (%)</label>
<input type="number" name="settings[win_rate]" value="<?php echo $settings['win_rate'] ?? 70; ?>" min="0" max="100">
</div>
</div>
<div class="card">
<h3>2. 价格操纵控制</h3>
<div class="form-group">
<label>价格控制模式</label>
<select name="settings[price_control]">
<option value="0" <?php echo ($settings['price_control'] ?? '0') == '0' ? 'selected' : ''; ?>>实时行情 (API 自动同步)</option>
<option value="1" <?php echo ($settings['price_control'] ?? '0') == '1' ? 'selected' : ''; ?>>强制控价 (所有用户看到指定价格)</option>
</select>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px;">
<div class="form-group">
<label>BTC 指定价格 ($)</label>
<input type="number" name="settings[manual_btc_price]" value="<?php echo $settings['manual_btc_price'] ?? 0; ?>" step="0.01">
</div>
<div class="form-group">
<label>BTC 插针价格 ($)</label>
<input type="number" name="settings[pin_btc_price]" value="<?php echo $settings['pin_btc_price'] ?? 0; ?>" step="0.01">
</div>
</div>
</div>
<div class="card">
<h3>3. 客服与公告</h3>
<div class="form-group">
<label>客服自动问候语</label>
<textarea name="settings[chat_greeting]" rows="3"><?php echo $settings['chat_greeting'] ?? '您好!欢迎咨询 NovaEx 官方客服。'; ?></textarea>
</div>
<div class="form-group">
<label>系统公告内容 (简体中文)</label>
<input type="text" name="settings[announcement_zh]" value="<?php echo $settings['announcement_zh'] ?? ''; ?>" placeholder="首页顶部公告...">
</div>
</div>
<div style="text-align: right;">
<button type="submit" class="btn btn-primary" style="font-size: 1.1rem; padding: 15px 60px;">保存所有系统设置</button>
</div>
</form>
</div>
</div>
</body>
</html>

View File

@ -1,150 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
if (isset($_POST['action']) && isset($_POST['order_id'])) {
$oid = $_POST['order_id'];
$action = $_POST['action'];
$orderStmt = $pdo->prepare("SELECT * FROM trading_orders WHERE id = ?");
$orderStmt->execute([$oid]);
$order = $orderStmt->fetch();
if ($order && $order['status'] == 'open') {
$user_id = $order['user_id'];
$symbol = $order['symbol'];
$coin_symbol = str_replace('USDT', '', $symbol);
if ($action == 'approve') {
// "WIN": Approve and settle
if ($order['side'] == 'buy') {
$stmt = $pdo->prepare("INSERT INTO user_assets (user_id, symbol, amount) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE amount = amount + ?");
$stmt->execute([$user_id, $coin_symbol, $order['amount'], $order['amount']]);
} else {
$pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$order['total'], $user_id]);
}
$pdo->prepare("UPDATE trading_orders SET status = 'closed', admin_status = 'approved', win_loss = 'win' WHERE id = ?")->execute([$oid]);
} elseif ($action == 'reject') {
// "LOSS": Reject. No assets returned.
$pdo->prepare("UPDATE trading_orders SET status = 'cancelled', admin_status = 'rejected', win_loss = 'loss' WHERE id = ?")->execute([$oid]);
}
}
}
$orders = $pdo->query("SELECT o.*, u.username, u.uid FROM trading_orders o JOIN users u ON o.user_id = u.id WHERE o.type = 'spot' ORDER BY o.id DESC")->fetchAll();
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>现货交易管理 - NovaEx 管理后台</title>
<link rel="stylesheet" href="../assets/css/custom.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #FFFFFF; border-right: 1px solid #EAECEF; padding: 1rem; }
.main-content { flex: 1; padding: 2rem; background: #FFFFFF; color: #1E2329; }
.menu-item { padding: 12px; color: #474D57; text-decoration: none; display: flex; align-items: center; gap: 10px; border-radius: 4px; margin-bottom: 5px; }
.menu-item:hover, .menu-item.active { background: #F5F5F5; color: #F0B90B; }
.badge { background: #F6465D; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.table { width: 100%; border-collapse: collapse; margin-top: 1rem; }
.table th, .table td { padding: 12px; text-align: left; border-bottom: 1px solid #EAECEF; font-size: 0.85rem; color: #1E2329; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; border-radius: 4px; cursor: pointer; border: none; margin-right: 5px; }
.btn-approve { background: #00c087; color: white; }
.btn-reject { background: #f6465d; color: white; }
.back-btn { color: #707A8A; text-decoration: none; font-size: 0.9rem; margin-bottom: 20px; display: inline-block; }
.status-badge { padding: 2px 6px; border-radius: 4px; font-size: 0.75rem; }
.status-open { background: #fff3cd; color: #856404; }
.status-closed { background: #d4edda; color: #155724; }
.status-cancelled { background: #f8d7da; color: #721c24; }
</style>
</head>
<body style="background: white;">
<div class="admin-layout">
<div class="sidebar">
<h3 style="color: #1E2329; margin-bottom: 2rem;">NovaEx 管理员</h3>
<a href="index.php" class="menu-item"><i class="fas fa-chart-pie"></i> 仪表盘</a>
<a href="users.php" class="menu-item"><i class="fas fa-users"></i> 用户管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核</a>
<a href="chat.php" class="menu-item">
<i class="fas fa-headset"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="options_orders.php" class="menu-item"><i class="fas fa-clock"></i> 秒合约</a>
<a href="spot_orders.php" class="menu-item active"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<a href="index.php" class="back-btn"><i class="fas fa-arrow-left"></i> 返回</a>
<h2 style="color: #1E2329;">现货交易管理 (后台控赢/)</h2>
<p style="color: #707A8A; font-size: 0.9rem;">提示:同意即为用户盈(得币/得USDT拒绝即为用户亏资产不退</p>
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>用户</th>
<th>币对</th>
<th>方向</th>
<th>类型</th>
<th>价格</th>
<th>数量</th>
<th>总额</th>
<th>状态</th>
<th>结果</th>
<th>时间</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach($orders as $o): ?>
<tr>
<td><?php echo $o['id']; ?></td>
<td><?php echo htmlspecialchars($o['username']); ?> (<?php echo $o['uid']; ?>)</td>
<td><?php echo $o['symbol']; ?></td>
<td style="color: <?php echo $o['side'] == 'buy' ? '#00c087' : '#f6465d'; ?>">
<?php echo $o['side'] == 'buy' ? '买入' : '卖出'; ?>
</td>
<td><?php echo $o['order_type'] == 'market' ? '市价' : '限价'; ?></td>
<td><?php echo number_format($o['price'], 4); ?></td>
<td><?php echo number_format($o['amount'], 4); ?></td>
<td><?php echo number_format($o['total'], 4); ?> USDT</td>
<td>
<span class="status-badge status-<?php echo $o['status']; ?>">
<?php echo $o['status'] == 'open' ? '进行中' : ($o['status'] == 'closed' ? '已完成' : '已取消'); ?>
</span>
</td>
<td>
<?php if($o['win_loss'] == 'win'): ?>
<span style="color: #00c087;">盈利</span>
<?php elseif($o['win_loss'] == 'loss'): ?>
<span style="color: #f6465d;">亏损</span>
<?php else: ?>
--
<?php endif; ?>
</td>
<td><?php echo $o['created_at']; ?></td>
<td>
<?php if($o['status'] == 'open'): ?>
<form method="POST" style="display: inline;">
<input type="hidden" name="order_id" value="<?php echo $o['id']; ?>">
<button type="submit" name="action" value="approve" class="btn-sm btn-approve">控赢</button>
<button type="submit" name="action" value="reject" class="btn-sm btn-reject">控亏</button>
</form>
<?php else: ?>
--
<?php endif; ?>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>

View File

@ -1,311 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
// Handle Actions
if ($_SERVER['REQUEST_METHOD'] == 'POST' && isset($_POST['action'])) {
$action = $_POST['action'];
if ($action == 'add_user') {
$username = $_POST['username'];
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
$uid = 618120 + $pdo->query("SELECT COUNT(*) FROM users")->fetchColumn() + mt_rand(1, 9);
$balance = $_POST['balance'] ?? 0;
$credit_score = $_POST['credit_score'] ?? 80;
$stmt = $pdo->prepare("INSERT INTO users (uid, username, password, balance, credit_score, status) VALUES (?, ?, ?, ?, ?, 'active')");
$stmt->execute([$uid, $username, $password, $balance, $credit_score]);
} elseif ($action == 'update_user') {
$id = $_POST['id'];
$username = $_POST['username'];
$balance = $_POST['balance'];
$credit_score = $_POST['credit_score'];
$win_loss = $_POST['win_loss_control'];
$status = $_POST['status'];
$sql = "UPDATE users SET username = ?, balance = ?, credit_score = ?, win_loss_control = ?, status = ? WHERE id = ?";
$params = [$username, $balance, $credit_score, $win_loss, $status, $id];
if (!empty($_POST['password'])) {
$sql = "UPDATE users SET username = ?, balance = ?, credit_score = ?, win_loss_control = ?, status = ?, password = ? WHERE id = ?";
$params = [$username, $balance, $credit_score, $win_loss, $status, password_hash($_POST['password'], PASSWORD_DEFAULT), $id];
}
$pdo->prepare($sql)->execute($params);
} elseif ($action == 'adjust_balance') {
$id = $_POST['id'];
$type = $_POST['adjustment_type'];
$amount = (float)$_POST['amount'];
if ($type == 'up') {
$pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?")->execute([$amount, $id]);
} else {
$pdo->prepare("UPDATE users SET balance = balance - ? WHERE id = ?")->execute([$amount, $id]);
}
} elseif ($action == 'toggle_status') {
$id = $_POST['id'];
$user = $pdo->prepare("SELECT status FROM users WHERE id = ?");
$user->execute([$id]);
$new_status = ($user->fetchColumn() == 'active' ? 'disabled' : 'active');
$pdo->prepare("UPDATE users SET status = ? WHERE id = ?")->execute([$new_status, $id]);
}
header("Location: users.php");
exit;
}
$users = $pdo->query("SELECT * FROM users ORDER BY id DESC")->fetchAll();
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
$pending_kyc = $pdo->query("SELECT COUNT(*) FROM users WHERE kyc_status = 1")->fetchColumn();
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<title>用户管理 - NovaEx 管理后台</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root { --primary: #f0b90b; --bg: #ffffff; --text: #1e2329; --border: #eaecef; }
body { background: #f4f6f9; color: var(--text); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; margin: 0; }
.admin-layout { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #ffffff; border-right: 1px solid var(--border); padding: 1.5rem; }
.main-content { flex: 1; padding: 2rem; background: #ffffff; }
.menu-item { padding: 12px 15px; color: #474d57; text-decoration: none; display: flex; align-items: center; gap: 12px; border-radius: 8px; margin-bottom: 8px; transition: 0.2s; }
.menu-item:hover, .menu-item.active { background: #f5f5f5; color: var(--primary); font-weight: bold; }
.badge { background: #f6465d; color: white; border-radius: 10px; padding: 2px 8px; font-size: 0.7rem; margin-left: auto; }
.card { background: white; border-radius: 12px; border: 1px solid var(--border); padding: 20px; box-shadow: 0 2px 8px rgba(0,0,0,0.05); }
.table { width: 100%; border-collapse: collapse; margin-top: 1.5rem; }
.table th, .table td { padding: 15px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.table th { background: #f9fafb; color: #707a8a; font-weight: 600; text-transform: uppercase; font-size: 0.75rem; }
.btn { padding: 8px 16px; border-radius: 6px; font-size: 0.85rem; border: none; cursor: pointer; font-weight: 500; transition: 0.2s; display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.btn-primary { background: var(--primary); color: black; }
.btn-danger { background: #f6465d; color: white; }
.btn-info { background: #2f80ed; color: white; }
.btn-success { background: #00c087; color: white; }
.status-badge { padding: 4px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: bold; }
.status-active { background: #e6fcf5; color: #00c087; }
.status-disabled { background: #fff5f5; color: #f6465d; }
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 1000; align-items: center; justify-content: center; }
.modal-content { background: white; width: 550px; padding: 30px; border-radius: 16px; box-shadow: 0 20px 40px rgba(0,0,0,0.2); }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #474d57; }
.form-group input, .form-group select { width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; font-size: 1rem; outline: none; box-sizing: border-box; }
</style>
</head>
<body>
<div class="admin-layout">
<div class="sidebar">
<h2 style="color: var(--primary); margin-bottom: 2rem;">NovaEx Admin</h2>
<a href="index.php" class="menu-item"><i class="fas fa-home"></i> 仪表盘</a>
<a href="users.php" class="menu-item active"><i class="fas fa-users"></i> 用户管理</a>
<a href="agents.php" class="menu-item"><i class="fas fa-user-shield"></i> 代理管理</a>
<a href="kyc.php" class="menu-item"><i class="fas fa-id-card"></i> KYC 审核
<?php if($pending_kyc > 0): ?><span class="badge"><?php echo $pending_kyc; ?></span><?php endif; ?>
</a>
<a href="chat.php" class="menu-item"><i class="fas fa-comments"></i> 客服管理
<?php if($unread_msgs > 0 || $pending_orders > 0): ?><span class="badge"><?php echo ($unread_msgs + $pending_orders); ?></span><?php endif; ?>
</a>
<a href="options_orders.php" class="menu-item"><i class="fas fa-clock"></i> 秒合约</a>
<a href="spot_orders.php" class="menu-item"><i class="fas fa-exchange-alt"></i> 现货交易</a>
<a href="futures_orders.php" class="menu-item"><i class="fas fa-file-contract"></i> 合约交易</a>
<a href="orders.php" class="menu-item"><i class="fas fa-wallet"></i> 充值记录</a>
<a href="settings.php" class="menu-item"><i class="fas fa-cog"></i> 系统设置</a>
</div>
<div class="main-content">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px;">
<h1>用户管理</h1>
<button class="btn btn-primary" onclick="showModal('addModal')"><i class="fas fa-user-plus"></i> 添加新用户</button>
</div>
<div class="card">
<table class="table">
<thead>
<tr>
<th>UID / 用户名</th>
<th>余额 (USDT)</th>
<th>信用分</th>
<th>输赢控制</th>
<th>状态</th>
<th>注册时间 / IP</th>
<th>操作</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td>
<div style="font-weight: bold;"><?php echo $user['uid']; ?></div>
<div style="font-size: 0.8rem; color: #707a8a;"><?php echo htmlspecialchars($user['username']); ?></div>
</td>
<td><div style="color: #00c087; font-weight: bold;"><?php echo number_format($user['balance'], 2); ?></div></td>
<td><?php echo $user['credit_score']; ?></td>
<td>
<?php
$wc = $user['win_loss_control'];
$labels = ['none' => '正常', 'win' => '起盈', 'loss' => '起亏'];
$colors = ['none' => '#474d57', 'win' => '#00c087', 'loss' => '#f6465d'];
echo "<span style='color: {$colors[$wc]}; font-weight: bold;'>{$labels[$wc]}</span>";
?>
</td>
<td>
<span class="status-badge <?php echo $user['status'] == 'active' ? 'status-active' : 'status-disabled'; ?>">
<?php echo $user['status'] == 'active' ? '正常' : '已冻结'; ?>
</span>
</td>
<td>
<div style="font-size: 0.8rem;"><?php echo $user['created_at']; ?></div>
<div style="font-size: 0.75rem; color: #848e9c;"><?php echo $user['last_ip'] ?: '127.0.0.1'; ?></div>
</td>
<td>
<div style="display: flex; gap: 5px;">
<button class="btn btn-info btn-sm" onclick='editUser(<?php echo json_encode($user); ?>)'><i class="fas fa-edit"></i></button>
<button class="btn btn-success btn-sm" onclick="adjustBalance(<?php echo $user['id']; ?>, '<?php echo $user['username']; ?>')"><i class="fas fa-wallet"></i></button>
<form method="POST" style="display: inline;" onsubmit="return confirm('确定要执行此操作吗?')">
<input type="hidden" name="id" value="<?php echo $user['id']; ?>">
<input type="hidden" name="action" value="toggle_status">
<button type="submit" class="btn btn-info btn-sm" title="锁定/解锁"><i class="fas fa-ban"></i></button>
</form>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Add User Modal -->
<div id="addModal" class="modal">
<div class="modal-content">
<h2>添加新用户</h2>
<form method="POST">
<input type="hidden" name="action" value="add_user">
<div class="form-group">
<label>用户名</label>
<input type="text" name="username" required>
</div>
<div class="form-group">
<label>密码</label>
<input type="password" name="password" required>
</div>
<div class="form-group">
<label>初始余额</label>
<input type="number" name="balance" step="0.01" value="0.00">
</div>
<div style="display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('addModal')" style="background: #eee;">取消</button>
<button type="submit" class="btn btn-primary">确定添加</button>
</div>
</form>
</div>
</div>
<!-- Edit User Modal -->
<div id="editModal" class="modal">
<div class="modal-content">
<h2>编辑用户信息</h2>
<form method="POST">
<input type="hidden" name="action" value="update_user">
<input type="hidden" name="id" id="edit-id">
<div class="form-group">
<label>用户名</label>
<input type="text" name="username" id="edit-username" required>
</div>
<div class="form-group">
<label>修改密码 (留空则不修改)</label>
<input type="password" name="password" placeholder="******">
</div>
<div class="form-row" style="display: flex; gap: 15px;">
<div class="form-group" style="flex: 1;">
<label>余额</label>
<input type="number" name="balance" id="edit-balance" step="0.01">
</div>
<div class="form-group" style="flex: 1;">
<label>信用分</label>
<input type="number" name="credit_score" id="edit-credit">
</div>
</div>
<div class="form-row" style="display: flex; gap: 15px;">
<div class="form-group" style="flex: 1;">
<label>输赢控制</label>
<select name="win_loss_control" id="edit-win-loss">
<option value="none">正常</option>
<option value="win">起盈</option>
<option value="loss">起亏</option>
</select>
</div>
<div class="form-group" style="flex: 1;">
<label>状态</label>
<select name="status" id="edit-status">
<option value="active">正常</option>
<option value="disabled">冻结</option>
</select>
</div>
</div>
<div style="display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('editModal')" style="background: #eee;">取消</button>
<button type="submit" class="btn btn-primary">保存修改</button>
</div>
</form>
</div>
</div>
<!-- Adjust Balance Modal -->
<div id="balanceModal" class="modal">
<div class="modal-content">
<h2>资金调整 - <span id="adj-name"></span></h2>
<form method="POST">
<input type="hidden" name="action" value="adjust_balance">
<input type="hidden" name="id" id="adj-id">
<div class="form-group">
<label>调整类型</label>
<select name="adjustment_type">
<option value="up">增加余额 (+)</option>
<option value="down">减少余额 (-)</option>
</select>
</div>
<div class="form-group">
<label>调整金额 (USDT)</label>
<input type="number" name="amount" step="0.01" required placeholder="0.00">
</div>
<div style="display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('balanceModal')" style="background: #eee;">取消</button>
<button type="submit" class="btn btn-success">确认调整</button>
</div>
</form>
</div>
</div>
<script>
function showModal(id) { document.getElementById(id).style.display = 'flex'; }
function hideModal(id) { document.getElementById(id).style.display = 'none'; }
function editUser(user) {
document.getElementById('edit-id').value = user.id;
document.getElementById('edit-username').value = user.username;
document.getElementById('edit-balance').value = user.balance;
document.getElementById('edit-credit').value = user.credit_score;
document.getElementById('edit-win-loss').value = user.win_loss_control;
document.getElementById('edit-status').value = user.status;
showModal('editModal');
}
function adjustBalance(id, name) {
document.getElementById('adj-id').value = id;
document.getElementById('adj-name').innerText = name;
showModal('balanceModal');
}
window.onclick = function(event) {
if (event.target.className === 'modal') {
event.target.style.display = "none";
}
}
</script>
</body>
</html>

View File

@ -1,59 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: 280px 1fr; gap: 60px;">
<aside style="position: sticky; top: 100px; height: fit-content;">
<h4 style="margin-bottom: 25px; color: var(--primary-color);">API Documentation</h4>
<nav style="display: flex; flex-direction: column; gap: 15px; font-size: 0.95rem;">
<a href="#intro" style="color: white; text-decoration: none;">Introduction</a>
<a href="#auth" style="color: #848e9c; text-decoration: none;">Authentication</a>
<a href="#market" style="color: #848e9c; text-decoration: none;">Market Data</a>
<a href="#trading" style="color: #848e9c; text-decoration: none;">Trading Endpoints</a>
<a href="#account" style="color: #848e9c; text-decoration: none;">Account & Balance</a>
<a href="#errors" style="color: #848e9c; text-decoration: none;">Error Codes</a>
</nav>
</aside>
<section style="background: #161a1e; padding: 60px; border-radius: 32px; border: 1px solid #2b3139;">
<h1 id="intro" style="font-size: 2.5rem; margin-bottom: 30px;">NovaEx API v1</h1>
<p style="color: var(--text-muted); line-height: 1.8; margin-bottom: 40px;">Welcome to the NovaEx API. Our RESTful API allows you to access market data, manage your account, and execute trades programmatically. All responses are returned in JSON format.</p>
<div id="auth" style="margin-top: 60px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px;">Authentication</h2>
<p style="color: var(--text-muted); line-height: 1.8;">To access private endpoints, you must use your API Key and Secret. These are passed in the request headers:</p>
<div style="background: #0b0e11; padding: 20px; border-radius: 12px; font-family: 'Roboto Mono', monospace; font-size: 0.9rem; color: #00f2fe; margin: 20px 0; border: 1px solid #2b3139;">
X-NOVA-APIKEY: &lt;your_api_key&gt;<br>
X-NOVA-SIGNATURE: &lt;hmac_sha256_signature&gt;
</div>
</div>
<div id="market" style="margin-top: 60px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px;">Get Ticker</h2>
<p style="color: var(--text-muted); margin-bottom: 20px;">Returns 24h ticker price change statistics.</p>
<div style="background: #0b0e11; padding: 20px; border-radius: 12px; font-family: 'Roboto Mono', monospace; font-size: 0.9rem; margin: 20px 0; border: 1px solid #2b3139;">
<span style="color: #00c087;">GET</span> /api/v1/ticker/24hr?symbol=BTCUSDT
</div>
<h4 style="margin: 30px 0 15px;">Response Example</h4>
<div style="background: #0b0e11; padding: 20px; border-radius: 12px; font-family: 'Roboto Mono', monospace; font-size: 0.85rem; color: #848e9c; border: 1px solid #2b3139;">
{<br>
&nbsp;&nbsp;"symbol": "BTCUSDT",<br>
&nbsp;&nbsp;"priceChange": "105.15",<br>
&nbsp;&nbsp;"priceChangePercent": "0.162",<br>
&nbsp;&nbsp;"lastPrice": "65120.50",<br>
&nbsp;&nbsp;"volume": "12540.25"<br>
}
</div>
</div>
<div id="trading" style="margin-top: 60px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px;">New Order</h2>
<p style="color: var(--text-muted); margin-bottom: 20px;">Executes a new limit or market order.</p>
<div style="background: #0b0e11; padding: 20px; border-radius: 12px; font-family: 'Roboto Mono', monospace; font-size: 0.9rem; margin: 20px 0; border: 1px solid #2b3139;">
<span style="color: #f0b90b;">POST</span> /api/v1/order
</div>
</div>
</section>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,64 +0,0 @@
<?php
session_start();
require_once '../db/config.php';
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['success' => false, 'error' => 'Unauthorized']);
exit;
}
$user_id = $_SESSION['user_id'];
$data = json_decode(file_get_contents('php://input'), true);
$order_id = $data['order_id'] ?? null;
if (!$order_id) {
echo json_encode(['success' => false, 'error' => 'Invalid order ID']);
exit;
}
try {
$db = db();
$db->beginTransaction();
// Check if order exists and belongs to user and is open
$stmt = $db->prepare("SELECT * FROM trading_orders WHERE id = ? AND user_id = ? AND status = 'open' FOR UPDATE");
$stmt->execute([$order_id, $user_id]);
$order = $stmt->fetch();
if (!$order) {
$db->rollBack();
echo json_encode(['success' => false, 'error' => '订单未找到或已处理']);
exit;
}
// Update status
$stmt = $db->prepare("UPDATE trading_orders SET status = 'cancelled' WHERE id = ?");
$stmt->execute([$order_id]);
if ($order['type'] === 'spot') {
if ($order['side'] === 'buy') {
// Refund USDT
$stmt = $db->prepare("UPDATE users SET balance = balance + ? WHERE id = ?");
$stmt->execute([$order['total'], $user_id]);
} else {
// Refund coins
$coin_symbol = str_replace('USDT', '', $order['symbol']);
$stmt = $db->prepare("INSERT INTO user_assets (user_id, symbol, amount) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE amount = amount + ?");
$stmt->execute([$user_id, $coin_symbol, $order['amount'], $order['amount']]);
}
} else {
// Futures: Refund margin
$margin = $order['total'] / $order['leverage'];
$stmt = $db->prepare("UPDATE users SET balance = balance + ? WHERE id = ?");
$stmt->execute([$margin, $user_id]);
}
$db->commit();
echo json_encode(['success' => true]);
} catch (Exception $e) {
if (isset($db)) $db->rollBack();
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}

View File

@ -1,22 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
header('Content-Type: application/json');
if (!isset($_SESSION['user_id']) || !isset($_GET['id'])) {
echo json_encode(['error' => 'Unauthorized']);
exit;
}
$order_id = $_GET['id'];
$pdo = db();
$stmt = $pdo->prepare("SELECT status FROM orders WHERE id = ? AND user_id = ?");
$stmt->execute([$order_id, $_SESSION['user_id']]);
$order = $stmt->fetch();
if ($order) {
echo json_encode(['status' => $order['status']]);
} else {
echo json_encode(['error' => 'Not found']);
}

View File

@ -1,26 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['status' => 'unauthorized']);
exit;
}
$user_id = $_SESSION['user_id'];
$pdo = db();
$stmt = $pdo->prepare("SELECT status, bank_account_info FROM fiat_orders WHERE user_id = ? AND status IN ('matching', 'matched', 'submitting') ORDER BY id DESC LIMIT 1");
$stmt->execute([$user_id]);
$order = $stmt->fetch();
if ($order) {
echo json_encode([
'status' => $order['status'],
'account_info' => $order['bank_account_info']
]);
} else {
echo json_encode(['status' => 'none']);
}

View File

@ -1,39 +0,0 @@
<?php
session_start();
require_once '../db/config.php';
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['success' => false, 'error' => 'Unauthorized']);
exit;
}
$user_id = $_SESSION['user_id'];
try {
$db = db();
// Get USDT balance
$stmt = $db->prepare("SELECT balance FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$usdt = $stmt->fetchColumn();
// Get other assets
$stmt = $db->prepare("SELECT symbol, amount FROM user_assets WHERE user_id = ? AND amount > 0");
$stmt->execute([$user_id]);
$other_assets = $stmt->fetchAll(PDO::FETCH_ASSOC);
$assets = [['symbol' => 'USDT', 'amount' => (float)$usdt]];
foreach ($other_assets as $asset) {
$assets[] = [
'symbol' => $asset['symbol'],
'amount' => (float)$asset['amount']
];
}
echo json_encode(['success' => true, 'data' => $assets]);
} catch (Exception $e) {
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}

View File

@ -1,42 +0,0 @@
<?php
session_start();
require_once '../db/config.php';
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['error' => 'Unauthorized']);
exit;
}
$pdo = db();
// Action for admin notification count
if (isset($_GET['action']) && $_GET['action'] === 'count_unread') {
$unread_msgs = $pdo->query("SELECT COUNT(*) FROM messages WHERE sender = 'user' AND is_read = 0")->fetchColumn();
$pending_orders = $pdo->query("SELECT COUNT(*) FROM fiat_orders WHERE status IN ('matching', 'submitting')")->fetchColumn();
echo json_encode(['total' => (int)($unread_msgs + $pending_orders)]);
exit;
}
// Support both regular user and admin polling for specific user
$user_id = isset($_GET['user_id']) ? $_GET['user_id'] : $_SESSION['user_id'];
// If last_id is provided, return new messages since then
if (isset($_GET['last_id'])) {
$last_id = (int)$_GET['last_id'];
$stmt = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? AND id > ? ORDER BY id ASC");
$stmt->execute([$user_id, $last_id]);
$msgs = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['data' => $msgs]);
exit;
}
// Default action: return count and last_id
$stmt = $pdo->prepare("SELECT COUNT(*), MAX(id) FROM messages WHERE user_id = ?");
$stmt->execute([$user_id]);
$res = $stmt->fetch();
$count = $res[0];
$last_id = $res[1];
echo json_encode(['count' => (int)$count, 'last_id' => (int)$last_id]);

View File

@ -1,70 +0,0 @@
<?php
session_start();
require_once '../db/config.php';
header('Content-Type: application/json');
$user_id = $_SESSION['user_id'] ?? null;
if (!$user_id) {
echo json_encode(['success' => false, 'error' => '未登录']);
exit;
}
$status = $_GET['status'] ?? 'pending';
$pdo = db();
// Auto-settle orders that are due
$now = date('Y-m-d H:i:s');
// Fetch orders that are pending and due, joined with user win_loss_control
$stmt = $pdo->prepare("SELECT o.*, u.win_loss_control as user_control FROM option_orders o JOIN users u ON o.user_id = u.id WHERE o.status = 'pending' AND o.settle_at <= ?");
$stmt->execute([$now]);
$due_orders = $stmt->fetchAll();
foreach ($due_orders as $order) {
$result = 'loss';
$profit = 0;
// Win/Loss Control Logic: Order-level control overrides User-level control
$final_control = 'none';
if ($order['control'] !== 'none') {
$final_control = $order['control'];
} elseif ($order['user_control'] !== 'none') {
$final_control = $order['user_control'];
}
if ($final_control === 'win') {
$result = 'win';
} elseif ($final_control === 'loss') {
$result = 'loss';
} else {
// Default behavior if no control is set: 50/50 chance
$result = (rand(0, 100) > 50) ? 'win' : 'loss';
}
if ($result === 'win') {
$profit = $order['amount'] * $order['profit_rate'];
$total_return = $order['amount'] + $profit;
// Add balance to user
$stmt_bal = $pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?");
$stmt_bal->execute([$total_return, $order['user_id']]);
// Set closing price slightly higher or lower than opening price to match result
$variation = (float)($order['opening_price'] * 0.0001 * rand(1, 10));
$closing_price = ($order['direction'] === 'up') ? $order['opening_price'] + $variation : $order['opening_price'] - $variation;
} else {
$profit = -$order['amount'];
$variation = (float)($order['opening_price'] * 0.0001 * rand(1, 10));
$closing_price = ($order['direction'] === 'up') ? $order['opening_price'] - $variation : $order['opening_price'] + $variation;
}
$stmt_update = $pdo->prepare("UPDATE option_orders SET status = 'completed', result = ?, profit = ?, closing_price = ? WHERE id = ?");
$stmt_update->execute([$result, $profit, $closing_price, $order['id']]);
}
// Fetch current orders for the user to return to frontend
$stmt = $pdo->prepare("SELECT * FROM option_orders WHERE user_id = ? AND status = ? ORDER BY created_at DESC");
$stmt->execute([$user_id, $status]);
$orders = $stmt->fetchAll();
echo json_encode(['success' => true, 'data' => $orders]);

View File

@ -1,38 +0,0 @@
<?php
session_start();
require_once '../db/config.php';
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['success' => false, 'error' => 'Unauthorized']);
exit;
}
$user_id = $_SESSION['user_id'];
$type = $_GET['type'] ?? 'spot';
$status = $_GET['status'] ?? 'open'; // open, positions, history, trades, tpsl
try {
$db = db();
if ($status === 'open' || $status === 'positions') {
$stmt = $db->prepare("SELECT * FROM trading_orders WHERE user_id = ? AND type = ? AND status = 'open' ORDER BY created_at DESC");
$stmt->execute([$user_id, $type]);
} elseif ($status === 'tpsl') {
$stmt = $db->prepare("SELECT * FROM trading_orders WHERE user_id = ? AND type = ? AND status = 'open' AND (tp_price IS NOT NULL OR sl_price IS NOT NULL) ORDER BY created_at DESC");
$stmt->execute([$user_id, $type]);
} elseif ($status === 'history') {
$stmt = $db->prepare("SELECT * FROM trading_orders WHERE user_id = ? AND type = ? AND status IN ('closed', 'cancelled', 'completed') ORDER BY created_at DESC");
$stmt->execute([$user_id, $type]);
} else { // trades
$stmt = $db->prepare("SELECT * FROM trading_orders WHERE user_id = ? AND type = ? AND status IN ('closed', 'completed') ORDER BY created_at DESC");
$stmt->execute([$user_id, $type]);
}
$orders = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode(['success' => true, 'data' => $orders]);
} catch (Exception $e) {
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}

View File

@ -1,68 +0,0 @@
<?php
header('Content-Type: application/json');
require_once '../db/config.php';
session_start();
if (!isset($_SESSION['user_id'])) {
echo json_encode(['success' => false, 'error' => 'Please login first']);
exit;
}
$user_id = $_SESSION['user_id'];
$data = json_decode(file_get_contents('php://input'), true);
$symbol = $data['symbol'] ?? '';
$amount = (float)($data['amount'] ?? 0);
$direction = $data['direction'] ?? '';
$duration = (int)($data['duration'] ?? 60);
$opening_price = (float)($data['opening_price'] ?? 0);
// Updated Validate duration and profit rates as per user request
// 60s/8%、90s/12%、120s/20%、180s/20%、300s/32%
$valid_durations = [
60 => ['profit' => 0.08, 'min' => 10],
90 => ['profit' => 0.12, 'min' => 10],
120 => ['profit' => 0.20, 'min' => 10],
180 => ['profit' => 0.20, 'min' => 10],
300 => ['profit' => 0.32, 'min' => 10],
];
if (!isset($valid_durations[$duration])) {
echo json_encode(['success' => false, 'error' => 'Invalid duration']);
exit;
}
$profit_rate = $valid_durations[$duration]['profit'];
$min_amount = $valid_durations[$duration]['min'];
if ($amount < $min_amount) {
echo json_encode(['success' => false, 'error' => "Minimum amount is {$min_amount} USDT"]);
exit;
}
$db = db();
$db->beginTransaction();
try {
$stmt = $db->prepare("SELECT balance FROM users WHERE id = ? FOR UPDATE");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
if (!$user || $user['balance'] < $amount) {
throw new Exception('Insufficient balance');
}
$new_balance = $user['balance'] - $amount;
$db->prepare("UPDATE users SET balance = ? WHERE id = ?")->execute([$new_balance, $user_id]);
$settle_at = date('Y-m-d H:i:s', time() + $duration);
$stmt = $db->prepare("INSERT INTO option_orders (user_id, symbol, amount, direction, duration, profit_rate, opening_price, status, settle_at) VALUES (?, ?, ?, ?, ?, ?, ?, 'pending', ?)");
$stmt->execute([$user_id, $symbol, $amount, $direction, $duration, $profit_rate, $opening_price, $settle_at]);
$db->commit();
echo json_encode(['success' => true, 'new_balance' => $new_balance]);
} catch (Exception $e) {
$db->rollBack();
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}

View File

@ -1,95 +0,0 @@
<?php
session_start();
require_once '../db/config.php';
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['success' => false, 'error' => 'Unauthorized']);
exit;
}
$user_id = $_SESSION['user_id'];
$data = json_decode(file_get_contents('php://input'), true);
if (!$data) {
echo json_encode(['success' => false, 'error' => 'Invalid data']);
exit;
}
$symbol = $data['symbol']; // e.g., BTCUSDT
$type = $data['type']; // spot or futures
$side = $data['side']; // buy or sell
$order_type = $data['order_type']; // limit or market
$price = (float)$data['price'];
$amount = (float)$data['amount'];
$total = (float)$data['total'];
$leverage = (int)($data['leverage'] ?? 1);
$tp_price = isset($data['tp_price']) ? (float)$data['tp_price'] : null;
$sl_price = isset($data['sl_price']) ? (float)$data['sl_price'] : null;
try {
$db = db();
$db->beginTransaction();
if ($type === 'spot') {
if ($side === 'buy') {
// Check USDT balance
$stmt = $db->prepare("SELECT balance FROM users WHERE id = ? FOR UPDATE");
$stmt->execute([$user_id]);
$balance = (float)$stmt->fetchColumn();
if ($balance < $total) {
$db->rollBack();
echo json_encode(['success' => false, 'error' => '余额不足 (USDT)']);
exit;
}
// Deduct USDT
$stmt = $db->prepare("UPDATE users SET balance = balance - ? WHERE id = ?");
$stmt->execute([$total, $user_id]);
} else {
// Spot Sell: Check coin balance
$coin_symbol = str_replace('USDT', '', $symbol);
$stmt = $db->prepare("SELECT amount FROM user_assets WHERE user_id = ? AND symbol = ? FOR UPDATE");
$stmt->execute([$user_id, $coin_symbol]);
$asset_amount = (float)$stmt->fetchColumn();
if ($asset_amount < $amount) {
$db->rollBack();
echo json_encode(['success' => false, 'error' => '资产余额不足 (' . $coin_symbol . ')']);
exit;
}
// Deduct coin
$stmt = $db->prepare("UPDATE user_assets SET amount = amount - ? WHERE user_id = ? AND symbol = ?");
$stmt->execute([$amount, $user_id, $coin_symbol]);
}
} else {
// Futures: Deduct margin (USDT)
$margin = $total / $leverage;
$stmt = $db->prepare("SELECT balance FROM users WHERE id = ? FOR UPDATE");
$stmt->execute([$user_id]);
$balance = (float)$stmt->fetchColumn();
if ($balance < $margin) {
$db->rollBack();
echo json_encode(['success' => false, 'error' => '余额不足 (USDT)']);
exit;
}
$stmt = $db->prepare("UPDATE users SET balance = balance - ? WHERE id = ?");
$stmt->execute([$margin, $user_id]);
}
// Insert order
$stmt = $db->prepare("INSERT INTO trading_orders (user_id, symbol, type, side, order_type, price, amount, total, leverage, tp_price, sl_price, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 'open')");
$stmt->execute([$user_id, $symbol, $type, $side, $order_type, $price, $amount, $total, $leverage, $tp_price, $sl_price]);
$db->commit();
echo json_encode(['success' => true]);
} catch (Exception $e) {
if (isset($db)) $db->rollBack();
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}

View File

@ -1,77 +0,0 @@
<?php
require_once '../db/config.php';
session_start();
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['success' => false, 'error' => 'Unauthorized']);
exit;
}
$user_id = $_SESSION['user_id'];
$pdo = db();
// Handle Confirm Payment action
if (isset($_GET['action']) && $_GET['action'] === 'confirm_payment') {
// Check for active order that is 'matched'
$stmt = $pdo->prepare("SELECT id FROM fiat_orders WHERE user_id = ? AND status = 'matched' ORDER BY id DESC LIMIT 1");
$stmt->execute([$user_id]);
$order = $stmt->fetch();
if (!$order) {
echo json_encode(['success' => false, 'error' => '没有待确认的订单']);
exit;
}
// Update status to submitting
$stmt = $pdo->prepare("UPDATE fiat_orders SET status = 'submitting' WHERE id = ?");
$stmt->execute([$order['id']]);
// Send a system message to chat
$pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'user', '我已完成支付,请查收凭证。')")->execute([$user_id]);
echo json_encode(['success' => true]);
exit;
}
if (!isset($_FILES['image'])) {
echo json_encode(['success' => false, 'error' => 'No image uploaded']);
exit;
}
$file = $_FILES['image'];
$ext = strtolower(pathinfo($file['name'], PATHINFO_EXTENSION));
$allowed = ['jpg', 'jpeg', 'png', 'gif'];
if (!in_array($ext, $allowed)) {
echo json_encode(['success' => false, 'error' => 'Invalid file type']);
exit;
}
$filename = 'chat_' . $user_id . '_' . time() . '_' . mt_rand(1000, 9999) . '.' . $ext;
$dir = '../assets/images/chat/';
if (!is_dir($dir)) mkdir($dir, 0775, true);
$target = $dir . $filename;
if (move_uploaded_file($file['tmp_name'], $target)) {
$path = 'assets/images/chat/' . $filename;
$stmt = $pdo->prepare("INSERT INTO messages (user_id, sender, type, message) VALUES (?, 'user', 'image', ?)");
$stmt->execute([$user_id, $path]);
// If there is an active order, update its proof_image
$stmt = $pdo->prepare("SELECT id FROM fiat_orders WHERE user_id = ? AND status IN ('matched', 'matching', 'submitting') ORDER BY id DESC LIMIT 1");
$stmt->execute([$user_id]);
$order = $stmt->fetch();
if ($order) {
$stmt = $pdo->prepare("UPDATE fiat_orders SET proof_image = ? WHERE id = ?");
$stmt->execute([$path, $order['id']]);
}
echo json_encode(['success' => true, 'path' => $path]);
} else {
echo json_encode(['success' => false, 'error' => 'Failed to save image']);
}

366
app.php
View File

@ -1,366 +0,0 @@
<?php
require_once 'header.php';
?>
<div class="app-page-container">
<div class="app-hero">
<div class="app-hero-content">
<h1 class="app-title"><?php echo __('app_hero_title', 'NovaEx App'); ?></h1>
<p class="app-subtitle"><?php echo __('app_hero_subtitle', 'Trade anywhere, anytime. The world\'s leading crypto exchange is in your pocket.'); ?></p>
<!-- Mobile Buttons (Visible only on mobile) -->
<div class="mobile-download-buttons">
<a href="#" class="btn-app-download">
<i class="fab fa-apple"></i>
<span>App Store</span>
</a>
<a href="#" class="btn-app-download">
<i class="fab fa-google-play"></i>
<span>Google Play</span>
</a>
<a href="#" class="btn-app-download">
<i class="fas fa-android"></i>
<span>Android APK</span>
</a>
</div>
<!-- Desktop QR Section (Visible only on desktop) -->
<div class="desktop-qr-section">
<div class="qr-container">
<img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=https://novaex.com/app" alt="QR Code">
</div>
<div class="qr-text">
<p style="font-weight: bold; font-size: 1.1rem; margin-bottom: 5px;"><?php echo __('scan_to_download', 'Scan to Download'); ?></p>
<p style="color: var(--text-muted); font-size: 0.9rem;"><?php echo __('ios_android_support', 'iOS & Android support'); ?></p>
</div>
</div>
</div>
<div class="app-hero-image">
<!-- Mockup image of a phone -->
<div class="phone-mockup">
<div class="phone-screen">
<div class="app-mockup-content">
<div class="app-mockup-header">
<div class="logo-text" style="font-size: 1.2rem;">NovaEx</div>
<i class="fas fa-user-circle"></i>
</div>
<div class="app-mockup-balance">
<p style="color: #848e9c; font-size: 0.8rem;">Total Balance</p>
<h3>$ 48,250.42</h3>
</div>
<div class="app-mockup-actions">
<div class="action-item"><i class="fas fa-plus-circle"></i><span>Deposit</span></div>
<div class="action-item"><i class="fas fa-arrow-circle-up"></i><span>Withdraw</span></div>
<div class="action-item"><i class="fas fa-exchange-alt"></i><span>Transfer</span></div>
</div>
<div class="app-mockup-list">
<div class="list-item">
<div style="display:flex; align-items:center; gap:10px;">
<div class="coin-icon" style="background: #f3ba2f;">B</div>
<div>BTC</div>
</div>
<div style="text-align:right;">
<div>$ 43,251.20</div>
<div style="color: #00c087;">+2.45%</div>
</div>
</div>
<div class="list-item">
<div style="display:flex; align-items:center; gap:10px;">
<div class="coin-icon" style="background: #627eea;">E</div>
<div>ETH</div>
</div>
<div style="text-align:right;">
<div>$ 2,541.10</div>
<div style="color: #f6465d;">-0.15%</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="app-features">
<div class="feature-card">
<i class="fas fa-bolt"></i>
<h4><?php echo __('feature_fast', 'Fast & Reliable'); ?></h4>
<p><?php echo __('feature_fast_desc', 'High-speed matching engine for lightning-fast trades.'); ?></p>
</div>
<div class="feature-card">
<i class="fas fa-shield-alt"></i>
<h4><?php echo __('feature_secure', 'Bank-Grade Security'); ?></h4>
<p><?php echo __('feature_secure_desc', 'Advanced encryption and multi-sig wallets to protect your funds.'); ?></p>
</div>
<div class="feature-card">
<i class="fas fa-headset"></i>
<h4><?php echo __('feature_support', '24/7 Support'); ?></h4>
<p><?php echo __('feature_support_desc', 'Our dedicated support team is always here to help you.'); ?></p>
</div>
</div>
</div>
<style>
.app-page-container {
min-height: 100vh;
background: radial-gradient(circle at top right, #1e2329 0%, #0b0e11 100%);
color: white;
padding: 100px 5% 50px;
}
.app-hero {
display: flex;
align-items: center;
justify-content: space-between;
max-width: 1200px;
margin: 0 auto;
gap: 50px;
}
.app-hero-content {
flex: 1;
}
.app-title {
font-size: 4rem;
font-weight: 800;
margin-bottom: 20px;
background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
}
.app-subtitle {
font-size: 1.5rem;
color: #848e9c;
margin-bottom: 40px;
line-height: 1.4;
}
/* Mobile buttons */
.mobile-download-buttons {
display: none;
flex-direction: column;
gap: 15px;
}
.btn-app-download {
background: #2b3139;
color: white;
padding: 15px 25px;
border-radius: 12px;
text-decoration: none;
display: flex;
align-items: center;
gap: 15px;
font-size: 1.1rem;
font-weight: 600;
transition: all 0.3s ease;
border: 1px solid transparent;
}
.btn-app-download:hover {
background: #1e2329;
border-color: #4facfe;
transform: translateY(-2px);
}
.btn-app-download i {
font-size: 1.5rem;
color: #4facfe;
}
/* Desktop QR */
.desktop-qr-section {
display: flex;
align-items: center;
gap: 20px;
background: rgba(255,255,255,0.05);
padding: 20px;
border-radius: 16px;
border: 1px solid rgba(255,255,255,0.1);
width: fit-content;
}
.qr-container {
background: white;
padding: 10px;
border-radius: 10px;
}
.qr-container img {
display: block;
}
/* Phone Mockup */
.app-hero-image {
flex: 1;
display: flex;
justify-content: center;
}
.phone-mockup {
width: 320px;
height: 640px;
background: #000;
border-radius: 40px;
border: 12px solid #2b3139;
position: relative;
box-shadow: 0 50px 100px rgba(0,0,0,0.5);
}
.phone-mockup::before {
content: '';
position: absolute;
top: 0;
left: 50%;
transform: translateX(-50%);
width: 150px;
height: 25px;
background: #2b3139;
border-bottom-left-radius: 20px;
border-bottom-right-radius: 20px;
z-index: 2;
}
.phone-screen {
width: 100%;
height: 100%;
background: #0b0e11;
border-radius: 28px;
overflow: hidden;
padding: 40px 15px 20px;
}
.app-mockup-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
}
.app-mockup-balance {
margin-bottom: 30px;
}
.app-mockup-actions {
display: flex;
justify-content: space-around;
margin-bottom: 40px;
}
.action-item {
display: flex;
flex-direction: column;
align-items: center;
gap: 5px;
font-size: 0.7rem;
color: #848e9c;
}
.action-item i {
font-size: 1.2rem;
color: #4facfe;
}
.app-mockup-list {
display: flex;
flex-direction: column;
gap: 20px;
}
.list-item {
display: flex;
justify-content: space-between;
align-items: center;
font-size: 0.85rem;
}
.coin-icon {
width: 32px;
height: 32px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
/* Features */
.app-features {
display: grid;
grid-template-columns: repeat(3, 1fr);
gap: 30px;
max-width: 1200px;
margin: 100px auto 0;
}
.feature-card {
background: rgba(255,255,255,0.03);
padding: 40px;
border-radius: 24px;
text-align: center;
transition: all 0.3s ease;
border: 1px solid rgba(255,255,255,0.05);
}
.feature-card:hover {
background: rgba(255,255,255,0.05);
transform: translateY(-10px);
border-color: rgba(79, 172, 254, 0.3);
}
.feature-card i {
font-size: 2.5rem;
color: #4facfe;
margin-bottom: 20px;
}
.feature-card h4 {
font-size: 1.3rem;
margin-bottom: 15px;
}
.feature-card p {
color: #848e9c;
font-size: 0.95rem;
line-height: 1.5;
}
/* Responsive */
@media (max-width: 992px) {
.app-hero {
flex-direction: column;
text-align: center;
}
.app-hero-content {
display: flex;
flex-direction: column;
align-items: center;
}
.desktop-qr-section {
display: none;
}
.mobile-download-buttons {
display: flex;
width: 100%;
max-width: 300px;
}
.app-title {
font-size: 3rem;
}
.app-features {
grid-template-columns: 1fr;
}
}
</style>
<?php
require_once 'footer.php';
?>

View File

@ -1,240 +1,346 @@
* { box-sizing: border-box; }
:root {
--bg-color: #0B0E11;
--nav-bg: #0B0E11;
--primary-color: #0052FF;
--text-color: #FFFFFF;
--text-muted: #848E9C;
--border-color: #2B3139;
--card-bg: #1E2329;
--danger-color: #F6465D;
--success-color: #0ECB81;
--gold-color: #F0B90B;
--color-bg: #ffffff;
--color-text: #1a1a1a;
--color-primary: #2563EB; /* Vibrant Blue */
--color-secondary: #000000;
--color-accent: #A3E635; /* Lime Green */
--color-surface: #f8f9fa;
--font-heading: 'Space Grotesk', sans-serif;
--font-body: 'Inter', sans-serif;
--border-width: 2px;
--shadow-hard: 5px 5px 0px #000;
--shadow-hover: 8px 8px 0px #000;
--radius-pill: 50rem;
--radius-card: 1rem;
}
body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
background-color: var(--bg-color);
color: var(--text-color);
line-height: 1.5;
padding-bottom: 0;
font-family: var(--font-body);
background-color: var(--color-bg);
color: var(--color-text);
overflow-x: hidden;
}
/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-color); }
::-webkit-scrollbar-thumb { background: #2b3139; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #3b4149; }
h1, h2, h3, h4, h5, h6, .navbar-brand {
font-family: var(--font-heading);
letter-spacing: -0.03em;
}
/* Utilities */
.text-primary { color: var(--color-primary) !important; }
.bg-black { background-color: #000 !important; }
.text-white { color: #fff !important; }
.shadow-hard { box-shadow: var(--shadow-hard); }
.border-2-black { border: var(--border-width) solid #000; }
.py-section { padding-top: 5rem; padding-bottom: 5rem; }
/* Navbar */
.navbar {
background-color: var(--nav-bg);
padding: 0 1.5rem;
height: 64px;
display: flex;
justify-content: space-between;
align-items: center;
border-bottom: 1px solid var(--border-color);
position: sticky;
top: 0;
z-index: 1000;
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
border-bottom: var(--border-width) solid transparent;
transition: all 0.3s;
padding-top: 1rem;
padding-bottom: 1rem;
}
.nav-links {
display: flex;
gap: 1.5rem;
align-items: center;
.navbar.scrolled {
border-bottom-color: #000;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
.nav-links a {
color: var(--text-color);
text-decoration: none;
font-size: 14px;
.brand-text {
font-size: 1.5rem;
font-weight: 800;
}
.nav-link {
font-weight: 500;
transition: color 0.2s;
display: flex;
align-items: center;
}
.nav-links a:hover {
color: var(--primary-color);
}
.nav-link-icon {
margin-right: 6px;
font-size: 16px;
}
/* Colorful Menu Icons */
.fa-home { color: #5d5dff; }
.fa-chart-line { color: #00e676; }
.fa-coins { color: #ffd600; }
.fa-file-contract { color: #ff3d00; }
.fa-bolt { color: #fbc02d; }
.fa-pickaxe { color: #8e24aa; }
.fa-wallet { color: #03a9f4; }
.dropdown {
color: var(--color-text);
margin-left: 1rem;
position: relative;
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #1E2329;
min-width: 180px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.5);
z-index: 1002;
border: 1px solid var(--border-color);
border-radius: 8px;
top: 100%;
.nav-link:hover, .nav-link.active {
color: var(--color-primary);
}
.dropdown:hover .dropdown-content {
display: block;
/* Buttons */
.btn {
font-weight: 700;
font-family: var(--font-heading);
padding: 0.8rem 2rem;
border-radius: var(--radius-pill);
border: var(--border-width) solid #000;
transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
box-shadow: var(--shadow-hard);
}
.dropdown-content a {
color: white;
padding: 12px 16px;
text-decoration: none;
display: block;
font-size: 14px;
.btn:hover {
transform: translate(-2px, -2px);
box-shadow: var(--shadow-hover);
}
.dropdown-content a:hover {
background-color: #2B3139;
.btn:active {
transform: translate(2px, 2px);
box-shadow: 0 0 0 #000;
}
.btn-primary {
background-color: var(--primary-color);
color: white;
border: none;
padding: 8px 20px;
border-radius: 8px;
cursor: pointer;
font-weight: 600;
text-decoration: none;
display: inline-flex;
align-items: center;
justify-content: center;
transition: 0.2s;
background-color: var(--color-primary);
border-color: #000;
color: #fff;
}
.btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
/* Mobile Bottom Nav */
.mobile-bottom-nav {
display: none;
position: fixed;
bottom: 0;
left: 0;
right: 0;
height: 65px;
background: #161a1e;
border-top: 1px solid var(--border-color);
z-index: 1000;
justify-content: space-around;
align-items: center;
padding: 5px 0 10px;
backdrop-filter: blur(10px);
.btn-primary:hover {
background-color: #1d4ed8;
border-color: #000;
color: #fff;
}
.mobile-nav-item {
.btn-outline-dark {
background-color: #fff;
color: #000;
}
.btn-cta {
background-color: var(--color-accent);
color: #000;
}
.btn-cta:hover {
background-color: #8cc629;
color: #000;
}
/* Hero Section */
.hero-section {
min-height: 100vh;
padding-top: 80px;
}
.background-blob {
position: absolute;
border-radius: 50%;
filter: blur(80px);
opacity: 0.6;
z-index: 1;
}
.blob-1 {
top: -10%;
right: -10%;
width: 600px;
height: 600px;
background: radial-gradient(circle, var(--color-accent), transparent);
}
.blob-2 {
bottom: 10%;
left: -10%;
width: 500px;
height: 500px;
background: radial-gradient(circle, var(--color-primary), transparent);
}
.highlight-text {
background: linear-gradient(120deg, transparent 0%, transparent 40%, var(--color-accent) 40%, var(--color-accent) 100%);
background-repeat: no-repeat;
background-size: 100% 40%;
background-position: 0 88%;
padding: 0 5px;
}
.dot { color: var(--color-primary); }
.badge-pill {
display: inline-block;
padding: 0.5rem 1rem;
border: 2px solid #000;
border-radius: 50px;
font-weight: 700;
background: #fff;
box-shadow: 4px 4px 0 #000;
font-family: var(--font-heading);
font-size: 0.9rem;
}
/* Marquee */
.marquee-container {
overflow: hidden;
white-space: nowrap;
border-top: 2px solid #000;
border-bottom: 2px solid #000;
}
.rotate-divider {
transform: rotate(-2deg) scale(1.05);
z-index: 10;
position: relative;
margin-top: -50px;
margin-bottom: 30px;
}
.marquee-content {
display: inline-block;
animation: marquee 20s linear infinite;
font-family: var(--font-heading);
font-weight: 700;
font-size: 1.5rem;
letter-spacing: 2px;
}
@keyframes marquee {
0% { transform: translateX(0); }
100% { transform: translateX(-50%); }
}
/* Portfolio Cards */
.project-card {
border: 2px solid #000;
border-radius: var(--radius-card);
overflow: hidden;
background: #fff;
transition: transform 0.3s ease;
box-shadow: var(--shadow-hard);
height: 100%;
display: flex;
flex-direction: column;
}
.project-card:hover {
transform: translateY(-10px);
box-shadow: 8px 8px 0 #000;
}
.card-img-holder {
height: 250px;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 2px solid #000;
position: relative;
font-size: 4rem;
}
.placeholder-art {
transition: transform 0.3s ease;
}
.project-card:hover .placeholder-art {
transform: scale(1.2) rotate(10deg);
}
.bg-soft-blue { background-color: #e0f2fe; }
.bg-soft-green { background-color: #dcfce7; }
.bg-soft-purple { background-color: #f3e8ff; }
.bg-soft-yellow { background-color: #fef9c3; }
.category-tag {
position: absolute;
top: 15px;
right: 15px;
background: #000;
color: #fff;
padding: 5px 12px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 700;
}
.card-body { padding: 1.5rem; }
.link-arrow {
text-decoration: none;
color: var(--text-muted);
font-size: 11px;
gap: 4px;
color: #000;
font-weight: 700;
display: inline-flex;
align-items: center;
margin-top: auto;
}
.mobile-nav-item i { font-size: 20px; }
.mobile-nav-item.active { color: var(--primary-color); }
.link-arrow i { transition: transform 0.2s; margin-left: 5px; }
.link-arrow:hover i { transform: translateX(5px); }
/* Sidebar Drawer */
.mobile-sidebar {
position: fixed;
top: 0;
left: -100%;
width: 280px;
/* About */
.about-image-stack {
position: relative;
height: 400px;
width: 100%;
}
.stack-card {
position: absolute;
width: 80%;
height: 100%;
background: #0B0E11;
z-index: 2000;
transition: 0.3s;
box-shadow: 10px 0 30px rgba(0,0,0,0.5);
padding: 20px;
overflow-y: auto;
border-radius: var(--radius-card);
border: 2px solid #000;
box-shadow: var(--shadow-hard);
left: 10%;
transform: rotate(-3deg);
background-size: cover;
}
.mobile-sidebar.open { left: 0; }
.sidebar-overlay {
display: none;
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.7);
z-index: 1999;
}
.sidebar-overlay.open { display: block; }
/* Market Trends Table */
.market-table-container {
overflow-x: auto;
-webkit-overflow-scrolling: touch;
/* Forms */
.form-control {
border: 2px solid #000;
border-radius: 0.5rem;
padding: 1rem;
font-weight: 500;
background: #f8f9fa;
}
/* Responsive Grid Helper */
.container {
max-width: 1200px;
margin: 0 auto;
padding: 0 20px;
.form-control:focus {
box-shadow: 4px 4px 0 var(--color-primary);
border-color: #000;
background: #fff;
}
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
/* Mobile Optimizations */
@media (max-width: 992px) {
.navbar { padding: 0 1rem; }
.nav-links { display: none; }
.hero-section { flex-direction: column; text-align: center; padding: 40px 5%; }
.grid-3, .grid-2 { grid-template-columns: 1fr; }
.mobile-bottom-nav { display: flex; }
body { padding-bottom: 70px; }
.section-title { font-size: 1.8rem; }
/* Market Table Mobile */
.market-table th:nth-child(4),
.market-table td:nth-child(4) { display: none; }
/* Animations */
.animate-up {
opacity: 0;
transform: translateY(30px);
animation: fadeUp 0.8s ease forwards;
}
@media (max-width: 576px) {
.logo-text { font-size: 1.4rem !important; }
.logo-svg { width: 28px !important; height: 28px !important; }
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
.btn-login-hide { display: none; }
.market-table th, .market-table td { padding: 12px 15px !important; }
.market-table td div { font-size: 0.9rem !important; }
@keyframes fadeUp {
to {
opacity: 1;
transform: translateY(0);
}
}
/* User Profile Dropdown Adjustments */
.user-info-header {
padding: 15px;
border-bottom: 1px solid var(--border-color);
}
.uid-badge {
/* Social */
.social-links a {
transition: transform 0.2s;
display: inline-block;
background: rgba(79, 172, 254, 0.1);
color: var(--primary-color);
font-size: 11px;
padding: 2px 8px;
border-radius: 4px;
margin-top: 5px;
}
.social-links a:hover {
transform: scale(1.2) rotate(10deg);
color: var(--color-accent) !important;
}
/* Responsive */
@media (max-width: 991px) {
.rotate-divider {
transform: rotate(0);
margin-top: 0;
margin-bottom: 2rem;
}
.hero-section {
padding-top: 120px;
text-align: center;
min-height: auto;
padding-bottom: 100px;
}
.display-1 { font-size: 3.5rem; }
.blob-1 { width: 300px; height: 300px; right: -20%; }
.blob-2 { width: 300px; height: 300px; left: -20%; }
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 86 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 238 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 KiB

View File

@ -1,55 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 1200px; margin: 0 auto;">
<div style="text-align: center; margin-bottom: 80px;">
<h1 style="font-size: 3.5rem; font-weight: 800; margin-bottom: 20px;">Build the Future of Finance</h1>
<p style="font-size: 1.2rem; color: var(--text-muted); max-width: 700px; margin: 0 auto;">Join a global team of innovators working to redefine how the world interacts with money.</p>
</div>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-bottom: 100px;">
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139;">
<h3 style="font-size: 1.5rem; margin-bottom: 15px;">Remote-First</h3>
<p style="color: var(--text-muted);">We believe in freedom and flexibility. Work from anywhere in the world and manage your own schedule.</p>
</div>
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139;">
<h3 style="font-size: 1.5rem; margin-bottom: 15px;">Global Impact</h3>
<p style="color: var(--text-muted);">Your work directly affects millions of users and helps build a more inclusive financial system.</p>
</div>
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139;">
<h3 style="font-size: 1.5rem; margin-bottom: 15px;">Ownership</h3>
<p style="color: var(--text-muted);">We value initiative and drive. At NovaEx, you own your projects and have the autonomy to make decisions.</p>
</div>
</div>
<h2 style="font-size: 2.2rem; margin-bottom: 40px; text-align: center;">Open Roles</h2>
<div style="display: flex; flex-direction: column; gap: 20px; margin-bottom: 100px;">
<?php
$jobs = [
['title' => 'Senior Blockchain Engineer', 'dept' => 'Engineering', 'location' => 'Remote / Global'],
['title' => 'Product Designer (UI/UX)', 'dept' => 'Product', 'location' => 'Remote / Europe'],
['title' => 'Customer Success Manager', 'dept' => 'Support', 'location' => 'Remote / Asia'],
['title' => 'Quantitative Trader', 'dept' => 'Trading', 'location' => 'Remote / North America'],
['title' => 'Security Architect', 'dept' => 'Security', 'location' => 'Remote / Global'],
];
foreach ($jobs as $job):
?>
<div style="background: #161a1e; padding: 30px; border-radius: 16px; border: 1px solid #2b3139; display: flex; justify-content: space-between; align-items: center; transition: 0.3s; cursor: pointer;" onmouseover="this.style.borderColor='var(--primary-color)'" onmouseout="this.style.borderColor='#2b3139'">
<div>
<h4 style="font-size: 1.3rem; margin-bottom: 5px;"><?php echo $job['title']; ?></h4>
<span style="font-size: 0.9rem; color: var(--text-muted);"><?php echo $job['dept']; ?> • <?php echo $job['location']; ?></span>
</div>
<a href="#" class="btn-primary" style="padding: 10px 25px; border-radius: 8px;">Apply Now</a>
</div>
<?php endforeach; ?>
</div>
<div style="text-align: center;">
<p style="color: var(--text-muted); margin-bottom: 20px;">Don't see a perfect fit? We're always looking for talented individuals.</p>
<a href="mailto:careers@novaex.com" style="color: var(--primary-color); font-weight: bold; text-decoration: none;">Send us your CV <i class="fas fa-arrow-right"></i></a>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

293
chat.php
View File

@ -1,293 +0,0 @@
<?php
include 'header.php';
if (!isset($_SESSION['user_id'])) {
echo "<script>location.href='login.php';</script>";
exit;
}
$user_id = $_SESSION['user_id'];
$pdo = db();
// Check for active recharge order to force stay
$stmt = $pdo->prepare("SELECT id, status, bank_account_info, proof_image FROM fiat_orders WHERE user_id = ? AND status IN ('matching', 'matched', 'submitting') ORDER BY id DESC LIMIT 1");
$stmt->execute([$user_id]);
$active_recharge = $stmt->fetch();
$is_forced = !!$active_recharge;
// Fetch user info
$stmt = $pdo->prepare("SELECT uid, username FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
// Get user IP
$user_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$user_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
// Fetch greeting message
$stmt = $pdo->prepare("SELECT value FROM settings WHERE name = 'chat_greeting'");
$stmt->execute();
$greeting = $stmt->fetchColumn() ?: '您好!欢迎咨询 NovaEx 官方客服,请问有什么可以帮您?';
// Fetch messages
$stmt = $pdo->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY created_at ASC");
$stmt->execute([$user_id]);
$messages = $stmt->fetchAll();
// Mark admin messages as read
$stmt = $pdo->prepare("UPDATE messages SET is_read = 1 WHERE user_id = ? AND sender = 'admin'");
$stmt->execute([$user_id]);
?>
<style>
<?php if ($is_forced): ?>
/* Forced state: Hide navbar and floating chat, full screen mode */
.navbar, .floating-service, footer { display: none !important; }
body { padding-top: 0 !important; overflow: hidden; background: #0b0e11; }
#chat-container { height: 100vh !important; width: 100vw !important; max-width: none !important; margin: 0 !important; }
#chat-card { border-radius: 0 !important; height: 100vh !important; border: none !important; }
<?php endif; ?>
#chat-box::-webkit-scrollbar { width: 6px; }
#chat-box::-webkit-scrollbar-track { background: transparent; }
#chat-box::-webkit-scrollbar-thumb { background: #2b3139; border-radius: 10px; }
/* Account Matching Modal */
#account-modal {
position: fixed;
top: 0; left: 0; width: 100%; height: 100%;
background: rgba(0,0,0,0.85);
display: none;
align-items: center;
justify-content: center;
z-index: 99999;
backdrop-filter: blur(8px);
}
.account-card {
background: #1e2329;
width: 90%;
max-width: 450px;
border-radius: 24px;
border: 1px solid #2b3139;
overflow: hidden;
box-shadow: 0 25px 50px rgba(0,0,0,0.6);
}
</style>
<div id="chat-container" class="container" style="max-width: 850px; margin: 30px auto; padding: 0; height: 75vh;">
<div id="chat-card" class="card" style="background: #1e2329; border: 1px solid #2b3139; border-radius: 20px; display: flex; flex-direction: column; height: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.3);">
<!-- Header -->
<div style="padding: 20px 25px; border-bottom: 1px solid #2b3139; display: flex; align-items: center; justify-content: space-between;">
<div style="display: flex; align-items: center; gap: 15px;">
<div style="width: 45px; height: 45px; background: #f0b90b; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: black;">
<i class="fas fa-headset fa-lg"></i>
</div>
<div>
<h3 style="margin: 0; font-size: 18px; color: white;">NovaEx 官方客服</h3>
<div style="display: flex; align-items: center; gap: 5px; font-size: 12px; color: #00c087;">
<span style="width: 8px; height: 8px; background: #00c087; border-radius: 50%; display: inline-block;"></span> 在线 (Online)
</div>
</div>
</div>
<div style="text-align: right; font-size: 12px; color: #848e9c;">
<div>UID: <?php echo $user['uid']; ?></div>
<div>IP: <?php echo $user_ip; ?></div>
</div>
</div>
<!-- Chat Body -->
<div id="chat-box" style="flex: 1; overflow-y: auto; padding: 25px; display: flex; flex-direction: column; gap: 20px; background: #161a1e;">
<!-- System Greeting -->
<div style="display: flex; flex-direction: column; align-items: flex-start;">
<div style="max-width: 80%; padding: 15px 20px; border-radius: 18px; border-bottom-left-radius: 4px; font-size: 14px; line-height: 1.6; background: #2b3139; color: white; border: 1px solid #3b424d;">
<?php echo nl2br(htmlspecialchars($greeting)); ?>
</div>
<span style="font-size: 10px; color: #5e6673; margin-top: 6px;">系统消息</span>
</div>
<?php foreach ($messages as $m):
if (strpos($m['message'], '[RECHARGE_NOTIFICATION]') !== false) continue;
?>
<div class="msg-container" data-id="<?php echo $m['id']; ?>" data-sender="<?php echo $m['sender']; ?>" style="display: flex; flex-direction: column; align-items: <?php echo $m['sender'] === 'user' ? 'flex-end' : 'flex-start'; ?>;">
<div class="msg-content" style="max-width: 75%; padding: 12px 18px; border-radius: 18px; font-size: 14px; line-height: 1.6;
<?php echo $m['sender'] === 'user' ? 'background: #f0b90b; color: black; border-bottom-right-radius: 4px;' : 'background: #2b3139; color: white; border-bottom-left-radius: 4px; border: 1px solid #3b424d;'; ?>">
<?php if ($m['type'] === 'image'): ?>
<img src="<?php echo $m['message']; ?>" style="max-width: 100%; border-radius: 8px; cursor: pointer;" onclick="window.open(this.src)">
<?php else: ?>
<?php echo nl2br(htmlspecialchars($m['message'])); ?>
<?php endif; ?>
</div>
<span style="font-size: 10px; color: #5e6673; margin-top: 6px;"><?php echo date('H:i', strtotime($m['created_at'])); ?></span>
</div>
<?php endforeach; ?>
</div>
<!-- Input Area -->
<div style="padding: 20px; background: #1e2329; border-top: 1px solid #2b3139;">
<?php if ($active_recharge && $active_recharge['status'] === 'matched'): ?>
<div style="background: rgba(240, 185, 11, 0.1); border: 1px dashed #f0b90b; border-radius: 12px; padding: 15px; margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between;">
<div style="font-size: 13px; color: #f0b90b;">
<i class="fas fa-info-circle"></i> 已匹配账户,请在转账后上传凭证并点击确认完成。
</div>
<button onclick="document.getElementById('account-modal').style.display='flex'" style="background: #f0b90b; border: none; color: black; padding: 5px 12px; border-radius: 6px; font-size: 12px; font-weight: bold; cursor: pointer;">查看账户</button>
</div>
<?php endif; ?>
<form id="chat-form" style="display: flex; gap: 12px; align-items: center;">
<div style="position: relative; display: flex; align-items: center; justify-content: center;">
<button type="button" onclick="document.getElementById('image-input').click()" style="background: #2b3139; border: 1px solid #3b424d; color: #f0b90b; width: 45px; height: 45px; border-radius: 12px; cursor: pointer; transition: 0.2s;" title="上传凭证">
<i class="fas fa-plus"></i>
</button>
<input type="file" id="image-input" accept="image/*" style="display: none;" onchange="uploadImage(this)">
</div>
<input type="text" id="chat-input" placeholder="请输入消息内容..."
style="flex: 1; background: #161a1e; border: 1px solid #2b3139; border-radius: 12px; padding: 14px 20px; color: white; outline: none; font-size: 14px;">
<button type="submit" style="background: #f0b90b; border: none; color: black; width: 50px; height: 50px; border-radius: 12px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.3s;">
<i class="fas fa-paper-plane fa-lg"></i>
</button>
</form>
<?php if ($active_recharge && $active_recharge['status'] === 'matched'): ?>
<button id="confirm-pay-btn" onclick="confirmPayment()" style="width: 100%; margin-top: 15px; padding: 15px; background: #00c087; border: none; color: white; border-radius: 12px; font-weight: bold; cursor: pointer; <?php echo $active_recharge['proof_image'] ? '' : 'display: none;'; ?>">
<i class="fas fa-check-circle"></i> 我已完成支付 (凭证已上传)
</button>
<?php elseif ($active_recharge && $active_recharge['status'] === 'submitting'): ?>
<div style="width: 100%; margin-top: 15px; padding: 15px; background: rgba(0, 192, 135, 0.1); border: 1px solid #00c087; color: #00c087; border-radius: 12px; font-weight: bold; text-align: center;">
<i class="fas fa-clock"></i> 凭证已上传,等待客服审核...
</div>
<?php endif; ?>
</div>
</div>
</div>
<!-- Account Matching Modal -->
<div id="account-modal">
<div class="account-card">
<div style="padding: 20px; background: #2b3139; display: flex; align-items: center; justify-content: space-between;">
<div style="font-weight: bold; color: #f0b90b;"><i class="fas fa-university"></i> 收款账户信息</div>
<i class="fas fa-times" onclick="document.getElementById('account-modal').style.display='none'" style="cursor: pointer;"></i>
</div>
<div style="padding: 25px;">
<div style="background: rgba(0, 192, 135, 0.1); color: #00c087; padding: 15px; border-radius: 12px; font-size: 13px; margin-bottom: 20px; border: 1px solid rgba(0, 192, 135, 0.2);">
<i class="fas fa-shield-check"></i> 请向以下账户进行汇款,转账成功后请回传截图。
</div>
<div id="account-info-display" style="color: white; font-size: 14px; line-height: 1.8; background: #161a1e; padding: 20px; border-radius: 12px; border: 1px solid #2b3139; white-space: pre-wrap;">
<?php echo $active_recharge['bank_account_info'] ?: '正在匹配收款账户,请稍等...'; ?>
</div>
<button onclick="document.getElementById('account-modal').style.display='none'" style="width: 100%; margin-top: 20px; padding: 15px; background: #f0b90b; border: none; color: black; border-radius: 12px; font-weight: bold; cursor: pointer;">知道了</button>
</div>
</div>
</div>
<script>
const chatBox = document.getElementById('chat-box');
chatBox.scrollTop = chatBox.scrollHeight;
document.getElementById('chat-form').onsubmit = function(e) {
e.preventDefault();
const input = document.getElementById('chat-input');
const msg = input.value.trim();
if (!msg) return;
const formData = new FormData();
formData.append('message', msg);
fetch('chat.php', {
method: 'POST',
body: new URLSearchParams(formData)
}).then(() => {
input.value = '';
location.reload();
});
};
function uploadImage(input) {
if (!input.files || !input.files[0]) return;
const formData = new FormData();
formData.append('image', input.files[0]);
const btn = input.parentElement.querySelector('button');
const originalHtml = btn.innerHTML;
btn.innerHTML = '<i class="fas fa-spinner fa-spin"></i>';
btn.disabled = true;
fetch('api/upload_chat_image.php', {
method: 'POST',
body: formData
})
.then(r => r.json())
.then(data => {
if (data.success) {
location.reload();
} else {
alert('上传失败: ' + data.error);
btn.innerHTML = originalHtml;
btn.disabled = false;
}
});
}
function confirmPayment() {
if(!confirm('确定已完成转账并上传凭证了吗?')) return;
fetch('api/upload_chat_image.php?action=confirm_payment', {
method: 'POST'
})
.then(r => r.json())
.then(data => {
if(data.success) {
location.reload();
} else {
alert(data.error || '操作失败');
}
});
}
// Auto refresh chat and detect account matching
let lastCount = <?php echo count($messages); ?>;
let currentStatus = '<?php echo $active_recharge['status'] ?? ''; ?>';
setInterval(() => {
fetch('api/get_messages.php')
.then(r => r.json())
.then(data => {
if (data.count > lastCount) {
location.reload();
}
});
<?php if ($is_forced): ?>
fetch('api/check_order_status.php')
.then(r => r.json())
.then(order => {
if (order.status !== currentStatus) {
location.reload();
}
if (order.status === 'matched' && order.account_info) {
const display = document.getElementById('account-info-display');
if(display.innerText.includes('正在匹配')) {
display.innerText = order.account_info;
document.getElementById('account-modal').style.display = 'flex';
}
}
});
<?php endif; ?>
}, 4000);
<?php if ($is_forced): ?>
window.onbeforeunload = function() {
return "您有正在处理的订单,请在当前页面等待客服完成。";
};
history.pushState(null, null, location.href);
window.onpopstate = function() {
history.pushState(null, null, location.href);
};
<?php endif; ?>
</script>
<?php include 'footer.php'; ?>

View File

@ -1,99 +0,0 @@
<?php
session_start();
require_once 'db/config.php';
if (!isset($_SESSION['user_id'])) {
die("Please login first.");
}
$user_id = $_SESSION['user_id'];
$db = db();
// Handle message sending via AJAX
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['message'])) {
$msg = trim($_POST['message']);
if ($msg !== '') {
$stmt = $db->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'user', ?)");
$stmt->execute([$user_id, $msg]);
echo json_encode(['success' => true]);
}
exit;
}
// Fetch messages for initial load
$stmt = $db->prepare("SELECT * FROM messages WHERE user_id = ? ORDER BY created_at ASC");
$stmt->execute([$user_id]);
$messages = $stmt->fetchAll();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
body { margin: 0; padding: 0; font-family: 'Inter', sans-serif; background: #161a1e; color: white; height: 100vh; display: flex; flex-direction: column; }
#chat-box { flex: 1; overflow-y: auto; padding: 15px; display: flex; flex-direction: column; gap: 12px; scroll-behavior: smooth; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; font-size: 14px; line-height: 1.4; position: relative; }
.msg.user { align-self: flex-end; background: #4facfe; color: white; border-bottom-right-radius: 2px; }
.msg.admin { align-self: flex-start; background: #2b3139; color: #EAECEF; border-bottom-left-radius: 2px; }
.msg-time { font-size: 10px; opacity: 0.5; margin-top: 4px; display: block; }
.chat-input-area { padding: 12px; background: #1e2329; border-top: 1px solid #2b3139; display: flex; gap: 10px; }
input { flex: 1; background: #0b0e11; border: 1px solid #2b3139; border-radius: 8px; padding: 10px 12px; color: white; outline: none; }
button { background: #4facfe; border: none; width: 40px; height: 40px; border-radius: 8px; color: white; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: 0.2s; }
button:hover { background: #00f2fe; }
</style>
</head>
<body>
<div id="chat-box">
<?php foreach ($messages as $m): ?>
<div class="msg <?php echo $m['sender']; ?>">
<?php echo nl2br(htmlspecialchars($m['message'])); ?>
<span class="msg-time"><?php echo date('H:i', strtotime($m['created_at'])); ?></span>
</div>
<?php endforeach; ?>
</div>
<form id="chat-form" class="chat-input-area">
<input type="text" id="msg-input" placeholder="Type a message..." autocomplete="off">
<button type="submit"><i class="fas fa-paper-plane"></i></button>
</form>
<script>
const chatBox = document.getElementById('chat-box');
const chatForm = document.getElementById('chat-form');
const msgInput = document.getElementById('msg-input');
chatBox.scrollTop = chatBox.scrollHeight;
chatForm.onsubmit = async (e) => {
e.preventDefault();
const msg = msgInput.value.trim();
if (!msg) return;
// Optimistic UI update
const msgDiv = document.createElement('div');
msgDiv.className = 'msg user';
msgDiv.innerHTML = msg.replace(/\n/g, '<br>') + '<span class="msg-time">' + new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'}) + '</span>';
chatBox.appendChild(msgDiv);
chatBox.scrollTop = chatBox.scrollHeight;
msgInput.value = '';
const formData = new FormData();
formData.append('message', msg);
await fetch('chat_iframe.php', { method: 'POST', body: formData });
};
// Auto refresh for new messages from admin
let lastMsgCount = <?php echo count($messages); ?>;
setInterval(async () => {
const res = await fetch('api/get_messages.php');
const data = await res.json();
if (data.count > lastMsgCount) {
location.reload();
}
}, 3000);
</script>
</body>
</html>

View File

@ -1,87 +0,0 @@
<?php include 'header.php'; ?>
<main style="padding: 60px 20px; background: #0b0e11; min-height: calc(100vh - 60px);">
<div style="max-width: 500px; margin: 0 auto; background: #1e2329; padding: 40px; border-radius: 20px; border: 1px solid #2b3139;">
<h2 style="margin-bottom: 30px; text-align: center; color: white;"><?php echo __('nav_convert'); ?></h2>
<div style="margin-bottom: 25px;">
<label style="color: #848e9c; font-size: 0.9rem; margin-bottom: 10px; display: block;">From</label>
<div style="display: flex; align-items: center; background: #0b0e11; padding: 15px; border-radius: 12px; border: 1px solid #2b3139;">
<input type="number" id="from-amount" value="100" style="flex: 1; background: transparent; border: none; color: white; font-size: 1.5rem; font-weight: bold; outline: none;">
<div style="display: flex; align-items: center; gap: 8px; background: #1e2329; padding: 5px 12px; border-radius: 20px; cursor: pointer;">
<img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/usdt.png" width="24">
<span style="font-weight: bold; color: white;">USDT</span>
</div>
</div>
<div style="margin-top: 8px; color: #848e9c; font-size: 0.8rem; display: flex; justify-content: space-between;">
<span>Available: 0.00 USDT</span>
<span style="color: var(--primary-color); cursor: pointer;">Max</span>
</div>
</div>
<div style="text-align: center; margin: -10px 0 15px;">
<div style="width: 40px; height: 40px; background: #1e2329; border: 1px solid #2b3139; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; color: var(--primary-color); cursor: pointer;">
<i class="fas fa-exchange-alt fa-rotate-90"></i>
</div>
</div>
<div style="margin-bottom: 30px;">
<label style="color: #848e9c; font-size: 0.9rem; margin-bottom: 10px; display: block;">To</label>
<div style="display: flex; align-items: center; background: #0b0e11; padding: 15px; border-radius: 12px; border: 1px solid #2b3139;">
<input type="number" id="to-amount" readonly style="flex: 1; background: transparent; border: none; color: white; font-size: 1.5rem; font-weight: bold; outline: none;">
<select id="target-crypto" onchange="updateConvert()" style="background: #1e2329; border: none; color: white; padding: 5px 10px; border-radius: 20px; font-weight: bold; cursor: pointer; outline: none;">
<option value="BTC">BTC</option>
<option value="ETH">ETH</option>
<option value="SOL">SOL</option>
<option value="BNB">BNB</option>
</select>
</div>
<div id="rate-display" style="margin-top: 8px; color: #848e9c; font-size: 0.8rem; text-align: center;">
1 USDT --.--- BTC
</div>
</div>
<button class="btn-primary" style="width: 100%; padding: 16px; font-size: 1.1rem; font-weight: bold; border-radius: 12px; margin-bottom: 20px;">Preview Conversion</button>
<div style="background: rgba(240, 185, 11, 0.05); border: 1px solid rgba(240, 185, 11, 0.1); padding: 15px; border-radius: 10px;">
<div style="display: flex; align-items: center; gap: 10px; color: #F0B90B; font-size: 0.85rem;">
<i class="fas fa-info-circle"></i>
<span>Zero fees, instant settlement.</span>
</div>
</div>
</div>
</main>
<script>
const prices = {};
const symbols = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT'];
const ws = new WebSocket('wss://stream.binance.com:9443/ws/' + symbols.map(s => s.toLowerCase() + '@ticker').join('/'));
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
prices[data.s.replace('USDT', '')] = parseFloat(data.c);
updateConvert();
};
const fromInput = document.getElementById('from-amount');
const toInput = document.getElementById('to-amount');
const targetSelect = document.getElementById('target-crypto');
const rateDisplay = document.getElementById('rate-display');
function updateConvert() {
const fromVal = parseFloat(fromInput.value) || 0;
const target = targetSelect.value;
const price = prices[target];
if (price) {
const result = fromVal / price;
toInput.value = result.toFixed(8);
rateDisplay.innerText = `1 USDT ≈ ${(1/price).toFixed(8)} ${target}`;
}
}
fromInput.oninput = updateConvert;
</script>
<?php include 'footer.php'; ?>

View File

@ -1,9 +0,0 @@
CREATE TABLE IF NOT EXISTS user_assets (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
symbol VARCHAR(20) NOT NULL,
amount DECIMAL(30, 10) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
UNIQUE KEY user_symbol (user_id, symbol)
);

View File

@ -1,16 +0,0 @@
CREATE TABLE IF NOT EXISTS option_orders (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
symbol VARCHAR(20) NOT NULL,
amount DECIMAL(18, 8) NOT NULL,
direction ENUM('up', 'down') NOT NULL,
duration INT NOT NULL, -- in seconds (60, 90, 120, 180, 300)
profit_rate DECIMAL(5, 2) NOT NULL, -- e.g. 0.08 for 8%
opening_price DECIMAL(18, 8) NOT NULL,
closing_price DECIMAL(18, 8) DEFAULT NULL,
status ENUM('pending', 'completed') DEFAULT 'pending',
result ENUM('none', 'win', 'loss') DEFAULT 'none',
profit DECIMAL(18, 8) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
settle_at TIMESTAMP NULL
);

View File

@ -1,218 +0,0 @@
<?php
include 'header.php';
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once 'db/config.php';
require_once 'includes/currency_helper.php';
$db = db();
// Check for existing pending orders to force workflow
$stmt = $db->prepare("SELECT id FROM fiat_orders WHERE user_id = ? AND status IN ('matching', 'matched', 'submitting') ORDER BY id DESC LIMIT 1");
$stmt->execute([$_SESSION['user_id']]);
$pending_order = $stmt->fetch();
if ($pending_order) {
header("Location: chat.php");
exit;
}
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$fiat_rates = get_fiat_rates();
$fiat_currencies_info = [
'USD' => 'US Dollar',
'EUR' => 'Euro',
'GBP' => 'British Pound',
'CNY' => 'Chinese Yuan',
'HKD' => 'Hong Kong Dollar',
'JPY' => 'Japanese Yen',
'KRW' => 'Korean Won',
'SGD' => 'Singapore Dollar',
'TWD' => 'Taiwan Dollar',
'THB' => 'Thai Baht',
'VND' => 'Vietnamese Dong',
'IDR' => 'Indonesian Rupiah',
'MYR' => 'Malaysian Ringgit',
];
?>
<main style="padding: 40px 20px; background: #0b0e11; min-height: calc(100vh - 64px);">
<div style="max-width: 1000px; margin: 0 auto;">
<a href="profile.php" class="back-btn"><i class="fas fa-arrow-left"></i> <?php echo __('nav_profile'); ?></a>
<div style="margin-bottom: 40px;">
<h1 style="font-size: 2.5rem; font-weight: bold; margin-bottom: 10px;"><?php echo __('deposit_assets', '充值资产'); ?></h1>
<p style="color: var(--text-muted);"><?php echo __('deposit_method_tip', '请选择您偏好的充值方式'); ?></p>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 40px;">
<div id="card-fiat" style="background: var(--card-bg); padding: 35px; border-radius: 24px; border: 2px solid var(--primary-color); cursor: pointer;" onclick="switchMethod('fiat')">
<div style="display: flex; align-items: center; gap: 20px; margin-bottom: 25px;">
<div style="width: 60px; height: 60px; background: rgba(0, 82, 255, 0.1); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--primary-color); font-size: 24px;">
<i class="fas fa-university"></i>
</div>
<div>
<h3 style="margin: 0;"><?php echo __('fiat_deposit', '法币充值'); ?></h3>
<p style="margin: 5px 0 0; color: var(--text-muted); font-size: 14px;"><?php echo __('bank_transfer', '银行转账 / OTC'); ?></p>
</div>
</div>
<div style="color: var(--text-muted); font-size: 13px; line-height: 2;">
<div style="display: flex; align-items: center; gap: 10px;"><i class="fas fa-check-circle" style="color: var(--success-color); font-size: 12px;"></i> Support 20+ Global Currencies</div>
<div style="display: flex; align-items: center; gap: 10px;"><i class="fas fa-check-circle" style="color: var(--success-color); font-size: 12px;"></i> Secure Bank-Grade Processing</div>
</div>
</div>
<div id="card-usdt" style="background: var(--card-bg); padding: 35px; border-radius: 24px; border: 2px solid transparent; cursor: pointer;" onclick="switchMethod('usdt')">
<div style="display: flex; align-items: center; gap: 20px; margin-bottom: 25px;">
<div style="width: 60px; height: 60px; background: rgba(14, 203, 129, 0.1); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--success-color); font-size: 24px;">
<i class="fas fa-coins"></i>
</div>
<div>
<h3 style="margin: 0;"><?php echo __('crypto_deposit', '数字货币充值'); ?></h3>
<p style="margin: 5px 0 0; color: var(--text-muted); font-size: 14px;">Blockchain Transfer</p>
</div>
</div>
<div style="color: var(--text-muted); font-size: 13px; line-height: 2;">
<div style="display: flex; align-items: center; gap: 10px;"><i class="fas fa-check-circle" style="color: var(--success-color); font-size: 12px;"></i> USDT (TRC20, ERC20, BEP20)</div>
<div style="display: flex; align-items: center; gap: 10px;"><i class="fas fa-check-circle" style="color: var(--success-color); font-size: 12px;"></i> Low Service Fees</div>
</div>
</div>
</div>
<div id="fiat-section" style="background: var(--card-bg); padding: 40px; border-radius: 24px; border: 1px solid var(--border-color);">
<form action="matching.php" method="POST" id="fiat-form">
<input type="hidden" name="type" value="fiat">
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-bottom: 30px;">
<div>
<label style="display: block; margin-bottom: 12px; color: var(--text-muted); font-size: 14px;"><?php echo __('select_currency', '选择币种'); ?></label>
<select name="currency" id="currency-select" style="width: 100%; padding: 15px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1rem; outline: none;">
<?php foreach ($fiat_rates as $code => $rate): ?>
<option value="<?php echo $code; ?>" data-rate="<?php echo $rate; ?>"><?php echo $code; ?> - <?php echo $fiat_currencies_info[$code] ?? $code; ?></option>
<?php endforeach; ?>
</select>
</div>
<div>
<label style="display: block; margin-bottom: 12px; color: var(--text-muted); font-size: 14px;"><?php echo __('deposit_amount', '充值金额'); ?></label>
<input type="number" name="amount" id="amount-input" placeholder="Min. 100" required style="width: 100%; padding: 15px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1.2rem; font-weight: bold; outline: none;">
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 30px;">
<div id="rate-display" style="padding: 20px; background: #161a1e; border-radius: 12px; border: 1px dashed var(--border-color); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;">
<div style="color: var(--text-muted); font-size: 12px; margin-bottom: 5px;">Real-time Exchange Rate</div>
<div style="font-weight: bold; font-size: 1.1rem;"><span id="rate-value">...</span> <span id="rate-currency">...</span> = 1 USDT</div>
</div>
<div id="result-display" style="padding: 20px; background: rgba(79, 172, 254, 0.05); border-radius: 12px; border: 1px solid rgba(79, 172, 254, 0.2); display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center;">
<div style="color: var(--primary-color); font-size: 12px; margin-bottom: 5px;">You will receive</div>
<div style="font-weight: 800; font-size: 1.5rem; color: var(--primary-color);"><span id="receive-amount">0.00</span> USDT</div>
</div>
</div>
<div style="margin-top: 30px; padding: 25px; background: rgba(0,82,255,0.03); border-radius: 16px; border: 1px solid rgba(0,82,255,0.1); margin-bottom: 30px;">
<div style="display: flex; align-items: center; gap: 10px; color: var(--primary-color); margin-bottom: 10px; font-weight: bold;">
<i class="fas fa-info-circle"></i> Instructions
</div>
<p style="color: var(--text-muted); font-size: 14px; margin: 0; line-height: 1.6;">
Please complete the payment within the time limit after matching. Once submitted, our customer service will verify your deposit.
</p>
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 18px; font-size: 1.1rem; border-radius: 12px;">Order Confirmation / 订单确认</button>
</form>
</div>
<div id="usdt-section" style="background: var(--card-bg); padding: 40px; border-radius: 24px; border: 1px solid var(--border-color); display: none;">
<form action="matching.php" method="POST" id="usdt-form">
<input type="hidden" name="type" value="usdt">
<div style="margin-bottom: 30px;">
<label style="display: block; margin-bottom: 15px; color: var(--text-muted); font-size: 14px;">Select Network</label>
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px;">
<label class="network-label active">
<input type="radio" name="network" value="TRC20" checked style="display: none;">
<div style="font-weight: bold;">TRC20</div>
<div style="font-size: 11px; opacity: 0.7; margin-top: 4px;"> 2 Mins</div>
</label>
<label class="network-label">
<input type="radio" name="network" value="ERC20" style="display: none;">
<div style="font-weight: bold;">ERC20</div>
<div style="font-size: 11px; opacity: 0.7; margin-top: 4px;"> 5 Mins</div>
</label>
<label class="network-label">
<input type="radio" name="network" value="BEP20" style="display: none;">
<div style="font-weight: bold;">BEP20</div>
<div style="font-size: 11px; opacity: 0.7; margin-top: 4px;"> 1 Min</div>
</label>
</div>
</div>
<div style="margin-bottom: 35px;">
<label style="display: block; margin-bottom: 12px; color: var(--text-muted); font-size: 14px;">Deposit Amount (USDT)</label>
<input type="number" name="amount" placeholder="Min. 10" required style="width: 100%; padding: 15px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1.2rem; font-weight: bold; outline: none;">
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 18px; font-size: 1.1rem; border-radius: 12px; background: var(--success-color);">Order Confirmation / 订单确认</button>
</form>
</div>
</div>
</main>
<style>
.network-label { padding: 20px; background: #161a1e; border: 1px solid var(--border-color); border-radius: 16px; cursor: pointer; text-align: center; transition: 0.2s; }
.network-label.active { border-color: var(--success-color); background: rgba(14,203,129,0.05); color: var(--success-color); }
</style>
<script>
function switchMethod(method) {
if(method === 'fiat') {
document.getElementById('fiat-section').style.display = 'block';
document.getElementById('usdt-section').style.display = 'none';
document.getElementById('card-fiat').style.borderColor = 'var(--primary-color)';
document.getElementById('card-usdt').style.borderColor = 'transparent';
} else {
document.getElementById('fiat-section').style.display = 'none';
document.getElementById('usdt-section').style.display = 'block';
document.getElementById('card-fiat').style.borderColor = 'transparent';
document.getElementById('card-usdt').style.borderColor = 'var(--success-color)';
}
}
const select = document.getElementById('currency-select');
const amountInput = document.getElementById('amount-input');
const rateVal = document.getElementById('rate-value');
const rateCur = document.getElementById('rate-currency');
const receiveAmount = document.getElementById('receive-amount');
function calculate() {
const option = select.options[select.selectedIndex];
const rate = parseFloat(option.getAttribute('data-rate'));
const amount = parseFloat(amountInput.value) || 0;
rateVal.innerText = rate.toFixed(4);
rateCur.innerText = select.value;
if (rate > 0) {
receiveAmount.innerText = (amount / rate).toFixed(2);
} else {
receiveAmount.innerText = '0.00';
}
}
select.onchange = calculate;
amountInput.oninput = calculate;
calculate();
document.querySelectorAll('.network-label').forEach(label => {
label.onclick = function() {
document.querySelectorAll('.network-label').forEach(l => l.classList.remove('active'));
this.classList.add('active');
this.querySelector('input').checked = true;
};
});
</script>
<?php include 'footer.php'; ?>

View File

@ -1,90 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 1000px; margin: 0 auto;">
<h1 style="font-size: 2.5rem; font-weight: 800; margin-bottom: 20px; text-align: center;">Fee Schedule</h1>
<p style="color: var(--text-muted); text-align: center; margin-bottom: 60px;">Transparent and competitive fees for all users.</p>
<section style="margin-bottom: 60px;">
<h2 style="font-size: 1.8rem; margin-bottom: 30px;">Trading Fees</h2>
<div style="background: #161a1e; border-radius: 24px; border: 1px solid #2b3139; overflow: hidden;">
<table style="width: 100%; border-collapse: collapse; text-align: left;">
<thead>
<tr style="background: #2b3139; color: #848e9c; font-size: 0.9rem;">
<th style="padding: 20px;">Tier</th>
<th style="padding: 20px;">30d Trading Volume</th>
<th style="padding: 20px;">Maker Fee</th>
<th style="padding: 20px;">Taker Fee</th>
</tr>
</thead>
<tbody style="font-size: 0.95rem;">
<tr style="border-bottom: 1px solid #2b3139;">
<td style="padding: 20px; font-weight: bold;">VIP 0</td>
<td style="padding: 20px;">&lt; 1,000,000 USD</td>
<td style="padding: 20px; color: var(--primary-color);">0.100%</td>
<td style="padding: 20px; color: var(--primary-color);">0.100%</td>
</tr>
<tr style="border-bottom: 1px solid #2b3139;">
<td style="padding: 20px; font-weight: bold;">VIP 1</td>
<td style="padding: 20px;"> 1,000,000 USD</td>
<td style="padding: 20px; color: var(--primary-color);">0.090%</td>
<td style="padding: 20px; color: var(--primary-color);">0.100%</td>
</tr>
<tr style="border-bottom: 1px solid #2b3139;">
<td style="padding: 20px; font-weight: bold;">VIP 2</td>
<td style="padding: 20px;"> 5,000,000 USD</td>
<td style="padding: 20px; color: var(--primary-color);">0.080%</td>
<td style="padding: 20px; color: var(--primary-color);">0.090%</td>
</tr>
<tr>
<td style="padding: 20px; font-weight: bold;">VIP 3</td>
<td style="padding: 20px;"> 20,000,000 USD</td>
<td style="padding: 20px; color: var(--primary-color);">0.070%</td>
<td style="padding: 20px; color: var(--primary-color);">0.085%</td>
</tr>
</tbody>
</table>
</div>
</section>
<section>
<h2 style="font-size: 1.8rem; margin-bottom: 30px;">Withdrawal Fees</h2>
<div style="background: #161a1e; border-radius: 24px; border: 1px solid #2b3139; overflow: hidden;">
<table style="width: 100%; border-collapse: collapse; text-align: left;">
<thead>
<tr style="background: #2b3139; color: #848e9c; font-size: 0.9rem;">
<th style="padding: 20px;">Asset</th>
<th style="padding: 20px;">Network</th>
<th style="padding: 20px;">Min. Withdrawal</th>
<th style="padding: 20px;">Fixed Fee</th>
</tr>
</thead>
<tbody style="font-size: 0.95rem;">
<tr style="border-bottom: 1px solid #2b3139;">
<td style="padding: 20px; font-weight: bold;">BTC</td>
<td style="padding: 20px;">Bitcoin</td>
<td style="padding: 20px;">0.001</td>
<td style="padding: 20px; color: #f6465d;">0.0005</td>
</tr>
<tr style="border-bottom: 1px solid #2b3139;">
<td style="padding: 20px; font-weight: bold;">ETH</td>
<td style="padding: 20px;">ERC20</td>
<td style="padding: 20px;">0.01</td>
<td style="padding: 20px; color: #f6465d;">0.005</td>
</tr>
<tr>
<td style="padding: 20px; font-weight: bold;">USDT</td>
<td style="padding: 20px;">TRC20 / BEP20</td>
<td style="padding: 20px;">10.0</td>
<td style="padding: 20px; color: #f6465d;">1.00</td>
</tr>
</tbody>
</table>
</div>
</section>
<p style="margin-top: 40px; color: var(--text-muted); font-size: 0.85rem;">* Deposit fees are 0% for all supported assets. Withdrawal fees are adjusted periodically based on network conditions.</p>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,81 +0,0 @@
<footer style="margin-top: 60px; background: #0b0e11; border-top: 1px solid var(--border-color); padding: 60px 5% 40px;">
<div style="max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 40px;">
<div class="col">
<div class="logo-text" style="margin-bottom: 1.5rem;">
<svg class="logo-svg" viewBox="0 0 100 100" style="width:32px; height:32px; vertical-align: middle;">
<rect x="10" y="10" width="80" height="80" rx="20" fill="url(#gradFooter)"/>
<path d="M30 30 L70 70 M70 30 L30 70" stroke="white" stroke-width="12" stroke-linecap="round"/>
<defs>
<linearGradient id="gradFooter" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#4facfe;stop-opacity:1" />
<stop offset="100%" style="stop-color:#00f2fe;stop-opacity:1" />
</linearGradient>
</defs>
</svg>
NovaEx
</div>
<p style="color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 1.5rem;"><?php echo __('footer_desc'); ?></p>
<div style="display: flex; gap: 1.2rem; font-size: 1.2rem;">
<a href="#" style="color: var(--text-muted); transition: color 0.3s;"><i class="fab fa-twitter"></i></a>
<a href="#" style="color: var(--text-muted); transition: color 0.3s;"><i class="fab fa-telegram"></i></a>
<a href="#" style="color: var(--text-muted); transition: color 0.3s;"><i class="fab fa-facebook"></i></a>
<a href="#" style="color: var(--text-muted); transition: color 0.3s;"><i class="fab fa-discord"></i></a>
</div>
</div>
<div class="col">
<h4 style="font-size: 16px; margin-bottom: 20px; color: white;"><?php echo __('about'); ?></h4>
<div style="display: flex; flex-direction: column; gap: 10px;">
<a href="about.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('about_us'); ?></a>
<a href="careers.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('careers'); ?></a>
<a href="news.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('news'); ?></a>
<a href="privacy.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('legal_privacy'); ?></a>
<a href="terms.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('terms_service'); ?></a>
</div>
</div>
<div class="col">
<h4 style="font-size: 16px; margin-bottom: 20px; color: white;"><?php echo __('products'); ?></h4>
<div style="display: flex; flex-direction: column; gap: 10px;">
<a href="spot.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('spot_trading'); ?></a>
<a href="futures.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('futures_trading'); ?></a>
<a href="app.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('app_download'); ?></a>
<a href="convert.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('flash_swap'); ?></a>
<a href="mining.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('staking'); ?></a>
</div>
</div>
<div class="col">
<h4 style="font-size: 16px; margin-bottom: 20px; color: white;"><?php echo __('support'); ?></h4>
<div style="display: flex; flex-direction: column; gap: 10px;">
<a href="help.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('help_center'); ?></a>
<a href="request.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('submit_request'); ?></a>
<a href="api-docs.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('api_docs'); ?></a>
<a href="fees.php" style="color: var(--text-muted); text-decoration: none; font-size: 14px;"><?php echo __('fee_schedule'); ?></a>
</div>
</div>
</div>
<div class="footer-bottom" style="max-width: 1200px; margin: 40px auto 0; padding-top: 30px; border-top: 1px solid #1e2329; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 15px;">
<div style="color: var(--text-muted); font-size: 12px;">
&copy; 2017-2026 NOVAEX.COM All rights reserved.
</div>
<div style="display: flex; gap: 15px; color: var(--text-muted); font-size: 12px; flex-wrap: wrap;">
<div style="display: flex; align-items: center; gap: 5px; color: var(--success-color);">
<i class="fas fa-check-circle"></i> <?php echo __('system_status_normal'); ?>
</div>
<span><?php echo __('cookie_policy'); ?></span>
<span><?php echo __('security'); ?></span>
</div>
</div>
</footer>
<style>
footer a:hover { color: white !important; }
@media (max-width: 576px) {
.footer-bottom { justify-content: center !important; text-align: center; }
}
</style>
</body>
</html>

View File

@ -1,425 +0,0 @@
<?php
session_start();
include 'header.php';
require_once 'db/config.php';
$user_id = $_SESSION['user_id'] ?? null;
$balance = 0;
if ($user_id) {
$stmt = db()->prepare("SELECT balance FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
$balance = $user['balance'] ?? 0;
}
?>
<style>
* { box-sizing: border-box; }
:root {
--bg-color: #0b0e11;
--panel-bg: #161a1e;
--border-color: #2b3139;
--text-primary: #EAECEF;
--text-secondary: #848e9c;
--accent-color: #4facfe;
--up-color: #00c087;
--down-color: #f6465d;
--input-bg: #1e2329;
}
body { background-color: var(--bg-color); color: var(--text-primary); font-family: 'Inter', 'PingFang SC', sans-serif; margin: 0; overflow-y: auto !important; }
.trading-layout { display: flex; gap: 1px; background: var(--border-color); min-height: calc(100vh - 64px); }
.panel { background: var(--panel-bg); display: flex; flex-direction: column; }
/* Market Panel */
.market-panel { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border-color); }
#pairs-list { height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: thin; }
.pair-item { display: flex; align-items: center; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); transition: 0.2s; }
.pair-item:hover { background: rgba(255,255,255,0.05); }
.pair-item.active { background: rgba(79, 172, 254, 0.08); border-left: 3px solid var(--accent-color); }
.pair-icon { width: 24px; height: 24px; margin-right: 12px; border-radius: 50%; }
/* Center Panel */
.center-panel { flex: 1; background: var(--bg-color); display: flex; flex-direction: column; min-width: 0; }
.info-bar { height: 66px; display: flex; align-items: center; padding: 0 20px; gap: 25px; border-bottom: 1px solid var(--border-color); background: var(--panel-bg); }
.chart-container { height: 550px; background: var(--bg-color); border-bottom: 1px solid var(--border-color); }
.order-form-panel { padding: 25px; background: var(--panel-bg); border-bottom: 1px solid var(--border-color); }
.order-form-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; }
.input-row { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 6px; display: flex; align-items: center; margin-bottom: 12px; padding: 10px 15px; transition: 0.2s; }
.input-row:focus-within { border-color: var(--accent-color); }
.input-row input { flex: 1; background: transparent; border: none; color: white; text-align: right; outline: none; font-size: 14px; font-weight: 600; }
.btn-trade { padding: 14px; border: none; border-radius: 8px; font-weight: bold; font-size: 16px; cursor: pointer; color: white; transition: 0.3s; margin-top: 10px; }
.btn-trade:hover { opacity: 0.9; transform: translateY(-1px); }
/* Order Book Panel */
.order-book-panel { width: 320px; flex-shrink: 0; border-left: 1px solid var(--border-color); display: flex; flex-direction: column; }
.ob-header { padding: 12px 16px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; font-weight: 600; }
.ob-row { display: flex; justify-content: space-between; padding: 4px 16px; font-size: 12px; position: relative; font-family: 'Roboto Mono', monospace; cursor: pointer; }
.ob-row:hover { background: rgba(255,255,255,0.05); }
.ob-vol-bar { position: absolute; top: 0; right: 0; bottom: 0; z-index: 0; opacity: 0.15; transition: width 0.3s; }
/* Tabs */
.tab-btn { background: none; border: none; color: var(--text-secondary); padding: 15px 20px; font-size: 14px; font-weight: 600; cursor: pointer; position: relative; transition: 0.2s; white-space: nowrap; }
.tab-btn.active { color: var(--accent-color); }
.tab-btn.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: var(--accent-color); border-radius: 3px 3px 0 0; }
/* Responsive */
@media (max-width: 1400px) {
.market-panel { width: 260px; }
.order-book-panel { width: 280px; }
}
@media (max-width: 1200px) {
.market-panel { display: none; }
}
@media (max-width: 992px) {
.trading-layout { flex-direction: column; }
.order-book-panel { width: 100%; border-left: none; border-top: 1px solid var(--border-color); }
.chart-container { height: 400px; }
.order-form-grid { grid-template-columns: 1fr; gap: 20px; }
.info-bar { height: auto; padding: 15px; flex-wrap: wrap; gap: 15px; }
}
</style>
<div class="trading-layout">
<!-- Left Panel -->
<div class="panel market-panel">
<div style="padding: 15px; border-bottom: 1px solid var(--border-color);">
<div style="position: relative;">
<i class="fas fa-search" style="position: absolute; left: 12px; top: 12px; color: var(--text-secondary); font-size: 14px;"></i>
<input type="text" id="market-search" placeholder="<?php echo __('search_contract'); ?>" style="width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 10px 12px 10px 35px; border-radius: 8px; font-size: 13px; outline: none;">
</div>
</div>
<div id="pairs-list"></div>
</div>
<!-- Center Panel -->
<div class="panel center-panel">
<div class="info-bar">
<div style="display: flex; align-items: center; gap: 12px;">
<img id="current-logo" src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/btc.png" width="32" height="32" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div>
<div id="current-pair-display" style="font-size: 18px; font-weight: 800; letter-spacing: -0.5px;">BTC/USDT <?php echo __('perpetual'); ?></div>
<div id="leverage-display" style="font-size: 12px; color: var(--accent-color); cursor: pointer; font-weight: 600;" onclick="showLevModal()"><span id="leverage-val-info">20</span>x</div>
</div>
</div>
<div style="display: flex; flex-direction: column;">
<span id="last-price" style="font-size: 18px; font-weight: 700; color: var(--up-color); font-family: 'Roboto Mono', monospace;">--</span>
<span id="price-change" style="font-size: 11px; font-weight: 600;">--</span>
</div>
<div style="margin-left: auto; display: flex; gap: 25px; font-size: 12px;" class="desktop-only">
<div style="color: var(--text-secondary);">Mark <span id="mark-price" style="color: white; font-weight: 600; display: block; margin-top: 4px;">--</span></div>
<div style="color: var(--text-secondary);">24h Vol <span id="vol-24h" style="color: white; font-weight: 600; display: block; margin-top: 4px;">--</span></div>
</div>
</div>
<div class="chart-container">
<div id="tv_chart_container" style="height: 100%;"></div>
</div>
<div class="center-content">
<div class="order-form-panel">
<div style="display: flex; gap: 12px; margin-bottom: 20px; align-items: center;">
<button class="ctrl-btn active" id="margin-isolated" onclick="setMargin('isolated')" style="background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 6px 15px; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 600;"><?php echo __('isolated'); ?></button>
<button class="ctrl-btn" onclick="showLevModal()" style="background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 6px 15px; border-radius: 6px; font-size: 13px; cursor: pointer; font-weight: 600;"><span id="leverage-val">20</span>x</button>
<div style="display: flex; gap: 20px; margin-left: 15px; align-items: center;">
<button onclick="setOrderType('limit')" id="order-type-limit" style="background: none; border: none; color: var(--text-secondary); font-size: 14px; cursor: pointer; font-weight: 700;"><?php echo __('limit'); ?></button>
<button onclick="setOrderType('market')" id="order-type-market" style="background: none; border: none; color: var(--accent-color); font-weight: 700; font-size: 14px; cursor: pointer;"><?php echo __('market'); ?></button>
</div>
</div>
<div class="order-form-grid">
<div>
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 10px;">
<span style="color: var(--text-secondary);"><?php echo __('available'); ?></span>
<span id="available-bal" style="color: white; font-weight: 600;"><?php echo number_format($balance, 2); ?> USDT</span>
</div>
<div class="input-row" id="price-row" style="display: none;">
<span style="color: var(--text-secondary); font-size: 13px; width: 60px; font-weight: 600;"><?php echo __('price'); ?></span>
<input type="number" id="order-price" placeholder="0.00">
</div>
<div class="input-row">
<span style="color: var(--text-secondary); font-size: 13px; width: 60px; font-weight: 600;"><?php echo __('amount'); ?></span>
<input type="number" id="order-amount" placeholder="Cont">
</div>
</div>
<div>
<div style="margin: 10px 0 20px;">
<input type="range" min="0" max="100" value="0" id="order-slider" style="width: 100%; accent-color: var(--accent-color); cursor: pointer;" oninput="updateFromSlider(this.value)">
<div style="display: flex; justify-content: space-between; font-size: 11px; color: var(--text-secondary); margin-top: 8px; font-weight: 500;">
<span onclick="setSlider(0)" style="cursor: pointer;">0%</span><span onclick="setSlider(25)" style="cursor: pointer;">25%</span><span onclick="setSlider(50)" style="cursor: pointer;">50%</span><span onclick="setSlider(75)" style="cursor: pointer;">75%</span><span onclick="setSlider(100)" style="cursor: pointer;">100%</span>
</div>
</div>
<div style="font-size: 14px; display: flex; justify-content: space-between; margin-top: 15px;">
<span style="color: var(--text-secondary); font-weight: 600;"><?php echo __('margin'); ?></span>
<span style="font-weight: 700;"><span id="order-cost">0.00</span> USDT</span>
</div>
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 25px;">
<button class="btn-trade" style="background: var(--up-color);" onclick="placeOrder('buy')"><?php echo __('open_long'); ?></button>
<button class="btn-trade" style="background: var(--down-color);" onclick="placeOrder('sell')"><?php echo __('open_short'); ?></button>
</div>
</div>
<div style="background: var(--panel-bg);">
<div style="display: flex; border-bottom: 1px solid var(--border-color); padding: 0 10px; overflow-x: auto;">
<button class="tab-btn active" onclick="switchTab(this, 'positions')"><?php echo __('positions'); ?></button>
<button class="tab-btn" onclick="switchTab(this, 'open')"><?php echo __('open_orders'); ?></button>
</div>
<div style="padding: 15px; overflow-x: auto;">
<table style="width: 100%; font-size: 13px; border-collapse: collapse; min-width: 800px;">
<thead id="data-thead" style="color: var(--text-secondary); text-align: left; background: rgba(255,255,255,0.02);"></thead>
<tbody id="data-tbody"></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Right Panel (Order Book) -->
<div class="panel order-book-panel">
<div class="ob-header">
<span>Price / Amount</span>
</div>
<div id="asks-list" style="display: flex; flex-direction: column-reverse; flex: 1; overflow: hidden;"></div>
<div id="ob-mid-price" style="padding: 15px 0; text-align: center; font-weight: 800; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); font-size: 18px; font-family: 'Roboto Mono', monospace; background: rgba(255,255,255,0.01);">--</div>
<div id="bids-list" style="flex: 1; overflow: hidden;"></div>
</div>
</div>
<div id="lev-modal" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 2100; backdrop-filter: blur(5px);">
<div style="background: var(--panel-bg); padding: 40px; border-radius: 20px; width: 360px; text-align: center; border: 1px solid var(--border-color); box-shadow: 0 20px 60px rgba(0,0,0,0.5);">
<h3 style="margin-bottom: 25px; font-size: 1.5rem; font-weight: 800;"><?php echo __('adjust_leverage'); ?></h3>
<div id="lev-val-big" style="font-size: 48px; font-weight: 800; color: var(--accent-color); margin-bottom: 30px; font-family: 'Roboto Mono', monospace;">20x</div>
<input type="range" min="1" max="125" value="20" id="lev-range" style="width: 100%; accent-color: var(--accent-color); cursor: pointer;" oninput="document.getElementById('lev-val-big').innerText = this.value + 'x'">
<div style="display: flex; gap: 20px; margin-top: 40px;">
<button onclick="hideLevModal()" style="flex: 1; padding: 12px; background: #2b3139; border: none; color: white; border-radius: 10px; font-weight: 700; cursor: pointer;"><?php echo __('cancel'); ?></button>
<button onclick="confirmLev()" style="flex: 1; padding: 12px; background: var(--accent-color); border: none; color: white; border-radius: 10px; font-weight: 700; cursor: pointer;"><?php echo __('confirm'); ?></button>
</div>
</div>
</div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script>
let currentPair = 'BTCUSDT';
let currentPrice = 0;
let leverage = 20;
let usdtBalance = <?php echo $balance; ?>;
let marketData = {};
let orderType = 'market';
let activeTab = 'positions';
const faceValue = 10;
const lang = '<?php echo $lang; ?>';
const pairs = [
'BTCUSDT', 'ETHUSDT', 'BNBUSDT', 'SOLUSDT', 'XRPUSDT', 'ADAUSDT', 'AVAXUSDT', 'DOGEUSDT', 'DOTUSDT', 'LINKUSDT',
'MATICUSDT', 'NEARUSDT', 'LTCUSDT', 'ATOMUSDT', 'UNIUSDT', 'XLMUSDT', 'ALGOUSDT', 'TRXUSDT', 'BCHUSDT', 'SHIBUSDT'
];
function initChart(symbol) {
new TradingView.widget({
"width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "15", "theme": "dark", "style": "1", "locale": lang === 'zh' ? 'zh_CN' : 'en', "container_id": "tv_chart_container", "backgroundColor": "#0b0e11", "hide_side_toolbar": true
});
}
initChart(currentPair);
let ws;
function connectWS() {
const streams = pairs.map(p => p.toLowerCase() + '@ticker').join('/');
ws = new WebSocket(`wss://fstream.binance.com/ws/${streams}`);
ws.onmessage = (e) => {
const data = JSON.parse(e.data);
marketData[data.s] = data;
renderPairs();
if (data.s === currentPair) updateUI(data);
};
}
connectWS();
function updateUI(data) {
currentPrice = parseFloat(data.c);
document.getElementById('last-price').innerText = currentPrice.toLocaleString();
document.getElementById('last-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('price-change').innerText = (data.P >= 0 ? '+' : '') + data.P + '%';
document.getElementById('mark-price').innerText = currentPrice.toLocaleString();
document.getElementById('vol-24h').innerText = parseFloat(data.q).toLocaleString();
document.getElementById('ob-mid-price').innerText = currentPrice.toLocaleString();
document.getElementById('ob-mid-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
updateOrderBook();
}
function renderPairs() {
const list = document.getElementById('pairs-list');
if (!list) return;
let html = '';
pairs.forEach(p => {
const d = marketData[p] || {c: 0, P: 0};
const name = p.replace('USDT', '');
const icon = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png`;
html += `
<div class="pair-item ${currentPair === p ? 'active' : ''}" onclick="switchPair('${p}')">
<img src="${icon}" class="pair-icon" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div style="flex: 1;">
<div style="font-weight: 700; font-size: 14px;">${name}/USDT</div>
<div style="font-size: 11px; color: var(--text-secondary);">Vol ${parseFloat(d.q || 0).toLocaleString()}</div>
</div>
<div style="text-align: right;">
<div style="font-weight: 600; font-family: 'Roboto Mono', monospace; font-size: 13px;">${parseFloat(d.c).toLocaleString()}</div>
<div style="color: ${d.P >= 0 ? 'var(--up-color)' : 'var(--down-color)'}; font-size: 11px; font-weight: 600;">${(d.P >= 0 ? '+' : '') + d.P}%</div>
</div>
</div>
`;
});
list.innerHTML = html;
}
function switchPair(p) {
if (currentPair === p) return;
currentPair = p;
document.getElementById('current-pair-display').innerText = p + '/USDT ' + (lang === 'zh' ? '永续' : 'Perpetual');
document.getElementById('current-logo').src = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${p.replace('USDT','').toLowerCase()}.png`;
initChart(p);
}
function updateOrderBook() {
const asks = document.getElementById('asks-list');
const bids = document.getElementById('bids-list');
let aH = ''; let bH = '';
let maxVol = 0;
const rows = 18;
const askData = [];
const bidData = [];
for(let i=0; i<rows; i++) {
const av = Math.random() * 200 + 10;
const bv = Math.random() * 200 + 10;
askData.push(av);
bidData.push(bv);
maxVol = Math.max(maxVol, av, bv);
}
for(let i=0; i<rows; i++) {
const ap = currentPrice * (1 + (i + 1) * 0.0003);
const bp = currentPrice * (1 - (i + 1) * 0.0003);
const av = askData[i];
const bv = bidData[i];
aH += `
<div class="ob-row" onclick="setPrice(${ap.toFixed(1)})">
<div class="ob-vol-bar" style="width: ${(av/maxVol*100)}%; background: var(--down-color);"></div>
<span style="color: var(--down-color); font-weight: 600; z-index: 1;">${ap.toFixed(1)}</span>
<span style="color: white; opacity: 0.9; z-index: 1;">${av.toFixed(0)}</span>
</div>`;
bH += `
<div class="ob-row" onclick="setPrice(${bp.toFixed(1)})">
<div class="ob-vol-bar" style="width: ${(bv/maxVol*100)}%; background: var(--up-color);"></div>
<span style="color: var(--up-color); font-weight: 600; z-index: 1;">${bp.toFixed(1)}</span>
<span style="color: white; opacity: 0.9; z-index: 1;">${bv.toFixed(0)}</span>
</div>`;
}
asks.innerHTML = aH; bids.innerHTML = bH;
}
function setPrice(p) {
if (orderType === 'limit') document.getElementById('order-price').value = p;
}
function setSlider(val) { document.getElementById('order-slider').value = val; updateFromSlider(val); }
function updateFromSlider(val) {
const cost = usdtBalance * (val / 100);
document.getElementById('order-amount').value = Math.floor((cost * leverage) / faceValue);
document.getElementById('order-cost').innerText = cost.toFixed(2);
}
function showLevModal() { document.getElementById('lev-modal').style.display = 'flex'; }
function hideLevModal() { document.getElementById('lev-modal').style.display = 'none'; }
function confirmLev() {
leverage = document.getElementById('lev-range').value;
document.getElementById('leverage-display').innerText = leverage + 'x';
document.getElementById('leverage-val-info').innerText = leverage;
document.getElementById('leverage-val').innerText = leverage;
hideLevModal();
updateFromSlider(document.getElementById('order-slider').value);
}
function setOrderType(type) {
orderType = type;
document.getElementById('order-type-limit').style.color = type === 'limit' ? 'var(--accent-color)' : 'var(--text-secondary)';
document.getElementById('order-type-market').style.color = type === 'market' ? 'var(--accent-color)' : 'var(--text-secondary)';
document.getElementById('price-row').style.display = type === 'limit' ? 'flex' : 'none';
}
async function placeOrder(side) {
const amount = parseFloat(document.getElementById('order-amount').value);
if (!amount || amount <= 0) return alert(lang === 'zh' ? '请输入有效数量' : 'Please enter a valid amount');
const price = orderType === 'limit' ? parseFloat(document.getElementById('order-price').value) : currentPrice;
const resp = await fetch('api/place_order.php', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
symbol: currentPair, type: 'futures', side: side, order_type: orderType,
price: price, amount: amount, leverage: leverage, total: amount * faceValue
})
});
const res = await resp.json();
if (res.success) {
alert(lang === 'zh' ? '下单成功' : 'Order Placed Successfully');
fetchOrders();
} else { alert(res.error); }
}
async function fetchOrders() {
const resp = await fetch(`api/get_orders.php?type=futures&status=${activeTab}`);
const res = await resp.json();
const tbody = document.getElementById('data-tbody');
const thead = document.getElementById('data-thead');
if (activeTab === 'positions') {
thead.innerHTML = `<tr><th style="padding: 12px 10px;"><?php echo __('pair'); ?></th><th style="padding: 12px 10px;"><?php echo __('direction'); ?></th><th style="padding: 12px 10px;"><?php echo __('price'); ?></th><th style="padding: 12px 10px;"><?php echo __('pnl'); ?></th><th style="padding: 12px 10px; text-align: right;"><?php echo __('action'); ?></th></tr>`;
} else {
thead.innerHTML = `<tr><th style="padding: 12px 10px;"><?php echo __('time'); ?></th><th style="padding: 12px 10px;"><?php echo __('pair'); ?></th><th style="padding: 12px 10px;"><?php echo __('direction'); ?></th><th style="padding: 12px 10px;"><?php echo __('price'); ?></th><th style="padding: 12px 10px;"><?php echo __('amount'); ?></th><th style="padding: 12px 10px; text-align: right;"><?php echo __('action'); ?></th></tr>`;
}
if (res.success && res.data.length > 0) {
tbody.innerHTML = res.data.map(o => {
const color = o.side === 'buy' ? 'var(--up-color)' : 'var(--down-color)';
if (activeTab === 'positions') {
return `<tr style="border-bottom: 1px solid var(--border-color);">
<td style="padding: 15px 10px; font-weight: 700;">${o.symbol}</td>
<td style="padding: 15px 10px; color: ${color}; font-weight: 700;">${o.side === 'buy' ? (lang === 'zh' ? '多' : 'LONG') : (lang === 'zh' ? '空' : 'SHORT')} ${o.leverage}x</td>
<td style="padding: 15px 10px; font-family: 'Roboto Mono', monospace;">${parseFloat(o.price).toLocaleString()}</td>
<td style="padding: 15px 10px; font-weight: 700;">--</td>
<td style="padding: 15px 10px; text-align: right;"><button onclick="closePos(${o.id})" style="background: rgba(255,255,255,0.05); color: white; border: 1px solid var(--border-color); padding: 5px 15px; border-radius: 6px; cursor: pointer; font-size: 12px;"><?php echo __('close_position'); ?></button></td>
</tr>`;
} else {
return `<tr style="border-bottom: 1px solid var(--border-color);">
<td style="padding: 15px 10px;">${o.created_at}</td>
<td style="padding: 15px 10px; font-weight: 700;">${o.symbol}</td>
<td style="padding: 15px 10px; color: ${color}; font-weight: 700;">${o.side.toUpperCase()}</td>
<td style="padding: 15px 10px; font-family: 'Roboto Mono', monospace;">${parseFloat(o.price).toLocaleString()}</td>
<td style="padding: 15px 10px;">${o.amount}</td>
<td style="padding: 15px 10px; text-align: right;"><button onclick="cancelOrder(${o.id})" style="background: var(--danger-color); color: white; border: none; padding: 5px 15px; border-radius: 6px; cursor: pointer; font-size: 12px;"><?php echo __('cancel'); ?></button></td>
</tr>`;
}
}).join('');
} else { tbody.innerHTML = `<tr><td colspan="5" style="text-align: center; padding: 60px; color: var(--text-secondary);"><?php echo __('no_records'); ?></td></tr>`; }
}
function switchTab(btn, tab) {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active'); activeTab = tab; fetchOrders();
}
document.getElementById('market-search').addEventListener('input', function(e) {
const q = e.target.value.toUpperCase();
document.querySelectorAll('.pair-item').forEach(item => {
const text = item.querySelector('div div').innerText;
item.style.display = text.includes(q) ? 'flex' : 'none';
});
});
fetchOrders(); setInterval(fetchOrders, 4000);
</script>
<?php include 'footer.php'; ?>

View File

@ -1,219 +0,0 @@
<?php
require_once 'includes/i18n.php';
require_once 'db/config.php';
$db = db();
$settings_res = $db->query("SELECT * FROM settings")->fetchAll();
$settings = [];
foreach($settings_res as $s) $settings[$s['name']] = $s['value'];
$site_logo = $settings['site_logo'] ?? null;
?>
<!DOCTYPE html>
<html lang="<?php echo $lang; ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>NovaEx | Leading Crypto Exchange</title>
<?php if($site_logo): ?>
<link rel="icon" href="<?php echo $site_logo; ?>" type="image/x-icon">
<?php endif; ?>
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
<style>
.logo-text { font-size: 1.8rem; font-weight: 800; color: white; letter-spacing: -1px; display: flex; align-items: center; gap: 8px; font-family: 'Inter', sans-serif; }
.logo-svg { width: 32px; height: 32px; fill: #4facfe; }
.site-logo-img { max-height: 40px; width: auto; object-fit: contain; }
/* Floating CS Chat */
.floating-service { position: fixed; bottom: 85px; right: 20px; width: 50px; height: 50px; background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-size: 1.2rem; cursor: pointer; box-shadow: 0 10px 25px rgba(0,242,254,0.3); z-index: 999; transition: transform 0.3s ease; }
#cs-chat-window { position: fixed; bottom: 0; left: 0; right: 0; top: 0; width: 100%; height: 100%; background: #161a1e; display: none; flex-direction: column; z-index: 2100; }
#cs-chat-window iframe { border: none; width: 100%; height: 100%; }
.chat-header { background: #2b3139; padding: 15px; display: flex; justify-content: space-between; align-items: center; color: white; }
@media (min-width: 993px) {
#cs-chat-window { bottom: 100px; right: 30px; left: auto; top: auto; width: 380px; height: 500px; border-radius: 16px; border: 1px solid #2b3139; overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,0.5); }
.floating-service { bottom: 30px; right: 30px; width: 60px; height: 60px; font-size: 1.5rem; }
}
/* Mobile Sidebar Links */
.sidebar-links a { display: flex; align-items: center; gap: 15px; padding: 15px 10px; color: white; text-decoration: none; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 1.1rem; }
.sidebar-links a i { width: 25px; text-align: center; }
/* Language and CSS helper classes */
.desktop-only { display: flex !important; }
@media (max-width: 992px) {
.desktop-only { display: none !important; }
.navbar { padding: 10px 15px !important; }
.logo-name { font-size: 1.2rem; }
#mobileMenuBtn { display: block !important; }
}
</style>
</head>
<body>
<!-- Sidebar Overlay -->
<div class="sidebar-overlay" id="sidebarOverlay" onclick="toggleSidebar()"></div>
<!-- Mobile Sidebar -->
<div class="mobile-sidebar" id="mobileSidebar">
<div style="display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; padding: 0 10px;">
<div class="logo-text">
<?php if($site_logo): ?>
<img src="<?php echo $site_logo; ?>" class="site-logo-img" alt="Logo">
<?php else: ?>
<span style="font-size: 1.5rem;">NovaEx</span>
<?php endif; ?>
</div>
<i class="fas fa-times" style="font-size: 1.5rem; cursor: pointer;" onclick="toggleSidebar()"></i>
</div>
<div class="sidebar-links">
<a href="index.php"><i class="fas fa-home" style="color: #5d5dff;"></i> <?php echo __('nav_home'); ?></a>
<a href="markets.php"><i class="fas fa-chart-line" style="color: #00e676;"></i> <?php echo __('nav_market'); ?></a>
<a href="options.php"><i class="fas fa-clock" style="color: #fbc02d;"></i> <?php echo __('nav_options'); ?></a>
<a href="spot.php"><i class="fas fa-coins" style="color: #ffd600;"></i> <?php echo __('nav_spot'); ?></a>
<a href="futures.php"><i class="fas fa-file-contract" style="color: #ff3d00;"></i> <?php echo __('nav_futures'); ?></a>
<a href="mining.php"><i class="fas fa-pickaxe" style="color: #8e24aa;"></i> <?php echo __('nav_mining'); ?></a>
<a href="app.php"><i class="fas fa-mobile-alt" style="color: #4facfe;"></i> <?php echo __('nav_app_download'); ?></a>
<hr style="border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 15px 0;">
<div style="padding: 10px;">
<div style="color: var(--text-muted); font-size: 12px; margin-bottom: 15px;"><?php echo __('language', 'Language'); ?></div>
<div style="display: flex; gap: 10px;">
<a href="?lang=en" style="padding: 12px; background: #1e2329; border-radius: 8px; font-size: 14px; flex: 1; border: none; justify-content: center; text-decoration: none; color: white; display: flex; align-items: center; gap: 8px;">
<img src="https://flagcdn.com/w20/us.png" width="20" alt="English"> EN
</a>
<a href="?lang=zh" style="padding: 12px; background: #1e2329; border-radius: 8px; font-size: 14px; flex: 1; border: none; justify-content: center; text-decoration: none; color: white; display: flex; align-items: center; gap: 8px;">
<img src="https://flagcdn.com/w20/cn.png" width="20" alt="Chinese"> 中文
</a>
</div>
</div>
</div>
</div>
<div class="floating-service" onclick="toggleCSChat()" title="Customer Service">
<i class="fas fa-headset"></i>
</div>
<div id="cs-chat-window">
<div class="chat-header">
<span>NovaEx Support</span>
<i class="fas fa-times" onclick="toggleCSChat()" style="cursor: pointer;"></i>
</div>
<iframe src="chat_iframe.php"></iframe>
</div>
<nav class="navbar">
<div style="display: flex; align-items: center; gap: 1.5rem;">
<!-- Mobile Menu Toggle -->
<i class="fas fa-bars" id="mobileMenuBtn" style="font-size: 1.2rem; cursor: pointer; display: none;" onclick="toggleSidebar()"></i>
<a href="index.php" style="text-decoration: none;">
<div class="logo-text">
<?php if($site_logo): ?>
<img src="<?php echo $site_logo; ?>" class="site-logo-img" alt="Logo">
<?php else: ?>
<svg class="logo-svg" viewBox="0 0 100 100">
<rect x="10" y="10" width="80" height="80" rx="20" fill="url(#grad1)"/>
<path d="M30 30 L70 70 M70 30 L30 70" stroke="white" stroke-width="12" stroke-linecap="round"/>
<defs>
<linearGradient id="grad1" x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" style="stop-color:#4facfe;stop-opacity:1" />
<stop offset="100%" style="stop-color:#00f2fe;stop-opacity:1" />
</linearGradient>
</defs>
</svg>
<span class="logo-name">NovaEx</span>
<?php endif; ?>
</div>
</a>
<div class="nav-links desktop-only">
<a href="index.php"><?php echo __('nav_home'); ?></a>
<a href="markets.php"><?php echo __('nav_market'); ?></a>
<a href="options.php"><?php echo __('nav_options'); ?></a>
<a href="spot.php"><?php echo __('nav_spot'); ?></a>
<a href="futures.php"><?php echo __('nav_futures'); ?></a>
<a href="mining.php"><?php echo __('nav_mining'); ?></a>
</div>
</div>
<div style="display: flex; gap: 1rem; align-items: center;">
<div class="dropdown desktop-only">
<a href="#" style="color: white; display: flex; align-items: center; gap: 8px; text-decoration: none; font-size: 14px; font-weight: 500;">
<i class="fas fa-globe" style="color: var(--primary-color);"></i>
<span><?php echo $lang == 'en' ? 'English' : '简体中文'; ?></span>
<i class="fas fa-chevron-down" style="font-size: 10px; opacity: 0.6;"></i>
</a>
<div class="dropdown-content" style="right: 0; min-width: 150px; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color); box-shadow: 0 10px 30px rgba(0,0,0,0.3);">
<a href="?lang=en" style="display: flex; align-items: center; gap: 12px; padding: 12px 15px;">
<img src="https://flagcdn.com/w20/us.png" width="20" alt="English"> English
</a>
<a href="?lang=zh" style="display: flex; align-items: center; gap: 12px; padding: 12px 15px;">
<img src="https://flagcdn.com/w20/cn.png" width="20" alt="Chinese"> 简体中文
</a>
</div>
</div>
<?php if(isset($_SESSION['user_id'])): ?>
<div class="dropdown">
<a href="#" style="color: white; display: flex; align-items: center; gap: 8px; text-decoration: none;">
<i class="fas fa-user-circle" style="font-size: 1.8rem; color: var(--primary-color);"></i>
<i class="fas fa-chevron-down desktop-only" style="font-size: 10px; opacity: 0.6;"></i>
</a>
<div class="dropdown-content user-profile-dropdown" style="right: 0; border-radius: 12px; overflow: hidden; border: 1px solid var(--border-color);">
<div class="user-info-header" style="background: rgba(79, 172, 254, 0.1); padding: 15px;">
<div style="font-weight: bold; margin-bottom: 4px; color: white;"><?php echo $_SESSION['username'] ?? 'User'; ?></div>
<div class="uid-badge" style="background: rgba(255,255,255,0.1); padding: 2px 8px; border-radius: 4px; font-size: 11px;">UID: <?php echo $_SESSION['uid'] ?? '------'; ?></div>
</div>
<a href="profile.php"><i class="fas fa-wallet" style="color: #03a9f4; width: 20px;"></i> <?php echo __('nav_assets'); ?></a>
<a href="deposit.php"><i class="fas fa-plus-circle" style="color: #00f2fe; width: 20px;"></i> <?php echo __('nav_deposit'); ?></a>
<a href="security.php"><i class="fas fa-shield-alt" style="color: #ffd600; width: 20px;"></i> <?php echo __('nav_security'); ?></a>
<a href="logout.php" style="color: var(--danger-color); border-top: 1px solid rgba(255,255,255,0.05);"><i class="fas fa-sign-out-alt" style="width: 20px;"></i> <?php echo __('nav_logout'); ?></a>
</div>
</div>
<?php else: ?>
<a href="login.php" class="desktop-only" style="color: white; text-decoration: none; font-size: 14px; font-weight: 500;"><?php echo __('nav_login'); ?></a>
<a href="register.php" class="btn-primary" style="padding: 8px 20px; font-size: 14px; border-radius: 8px; font-weight: 600;"><?php echo __('nav_register'); ?></a>
<?php endif; ?>
</div>
</nav>
<!-- Mobile Bottom Navigation -->
<div class="mobile-bottom-nav">
<a href="index.php" class="mobile-nav-item <?php echo basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : ''; ?>">
<i class="fas fa-home"></i>
<span><?php echo __('nav_home'); ?></span>
</a>
<a href="markets.php" class="mobile-nav-item <?php echo basename($_SERVER['PHP_SELF']) == 'markets.php' ? 'active' : ''; ?>">
<i class="fas fa-chart-line"></i>
<span><?php echo __('nav_market'); ?></span>
</a>
<a href="options.php" class="mobile-nav-item <?php echo in_array(basename($_SERVER['PHP_SELF']), ['options.php', 'spot.php', 'futures.php']) ? 'active' : ''; ?>">
<i class="fas fa-exchange-alt"></i>
<span><?php echo __('nav_trade'); ?></span>
</a>
<a href="mining.php" class="mobile-nav-item <?php echo basename($_SERVER['PHP_SELF']) == 'mining.php' ? 'active' : ''; ?>">
<i class="fas fa-pickaxe"></i>
<span><?php echo __('nav_mining'); ?></span>
</a>
<a href="profile.php" class="mobile-nav-item <?php echo basename($_SERVER['PHP_SELF']) == 'profile.php' ? 'active' : ''; ?>">
<i class="fas fa-wallet"></i>
<span><?php echo __('nav_assets'); ?></span>
</a>
</div>
<script>
function toggleSidebar() {
const sidebar = document.getElementById('mobileSidebar');
const overlay = document.getElementById('sidebarOverlay');
sidebar.classList.toggle('open');
overlay.classList.toggle('open');
document.body.style.overflow = sidebar.classList.contains('open') ? 'hidden' : '';
}
function toggleCSChat() {
const chat = document.getElementById('cs-chat-window');
chat.style.display = chat.style.display === 'flex' ? 'none' : 'flex';
document.body.style.overflow = chat.style.display === 'flex' ? 'hidden' : '';
}
</script>

View File

@ -1,54 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 1200px; margin: 0 auto;">
<div style="text-align: center; margin-bottom: 80px;">
<h1 style="font-size: 3rem; font-weight: 800; margin-bottom: 30px;">How can we help you?</h1>
<div style="max-width: 600px; margin: 0 auto; position: relative;">
<i class="fas fa-search" style="position: absolute; left: 20px; top: 22px; color: #848e9c;"></i>
<input type="text" placeholder="Search for articles..." style="width: 100%; padding: 20px 20px 20px 55px; background: #161a1e; border: 1px solid #2b3139; border-radius: 16px; color: white; font-size: 1.1rem; outline: none; box-shadow: 0 10px 30px rgba(0,0,0,0.3);">
</div>
</div>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 30px; margin-bottom: 80px;">
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139; cursor: pointer; transition: 0.3s;" onmouseover="this.style.borderColor='var(--primary-color)'" onmouseout="this.style.borderColor='#2b3139'">
<i class="fas fa-user-plus" style="font-size: 2rem; color: #4facfe; margin-bottom: 20px;"></i>
<h3 style="margin-bottom: 15px;">Getting Started</h3>
<ul style="list-style: none; padding: 0; color: var(--text-muted); line-height: 2;">
<li>How to create an account?</li>
<li>Identity Verification (KYC) guide</li>
<li>Securing your account (2FA)</li>
</ul>
</div>
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139; cursor: pointer; transition: 0.3s;" onmouseover="this.style.borderColor='var(--primary-color)'" onmouseout="this.style.borderColor='#2b3139'">
<i class="fas fa-wallet" style="font-size: 2rem; color: #00f2fe; margin-bottom: 20px;"></i>
<h3 style="margin-bottom: 15px;">Deposits & Withdrawals</h3>
<ul style="list-style: none; padding: 0; color: var(--text-muted); line-height: 2;">
<li>How to deposit crypto?</li>
<li>Withdrawal limits and fees</li>
<li>Fiat deposit instructions</li>
</ul>
</div>
<div style="background: #161a1e; padding: 40px; border-radius: 24px; border: 1px solid #2b3139; cursor: pointer; transition: 0.3s;" onmouseover="this.style.borderColor='var(--primary-color)'" onmouseout="this.style.borderColor='#2b3139'">
<i class="fas fa-chart-line" style="font-size: 2rem; color: #f0b90b; margin-bottom: 20px;"></i>
<h3 style="margin-bottom: 15px;">Trading & Markets</h3>
<ul style="list-style: none; padding: 0; color: var(--text-muted); line-height: 2;">
<li>Spot trading vs Futures</li>
<li>Understanding order types</li>
<li>Trading fees explained</li>
</ul>
</div>
</div>
<div style="background: linear-gradient(135deg, #161a1e 0%, #0b0e11 100%); padding: 60px; border-radius: 32px; border: 1px solid #2b3139; text-align: center;">
<h2 style="margin-bottom: 20px;">Still need help?</h2>
<p style="color: var(--text-muted); margin-bottom: 30px;">Our customer support team is available 24/7 to assist you.</p>
<div style="display: flex; justify-content: center; gap: 20px;">
<a href="#" onclick="toggleCSChat(); return false;" class="btn-primary" style="padding: 15px 40px; border-radius: 12px; font-weight: bold;">Live Chat</a>
<a href="request.php" style="padding: 15px 40px; border-radius: 12px; font-weight: bold; background: #2b3139; color: white; text-decoration: none; border: 1px solid #3c444d;">Submit a Ticket</a>
</div>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,33 +0,0 @@
<?php
function get_fiat_rates() {
$fiat_currencies = [
'USD' => 1.00,
'EUR' => 0.92,
'GBP' => 0.79,
'CNY' => 7.23,
'HKD' => 7.82,
'JPY' => 151.45,
'KRW' => 1350.20,
'SGD' => 1.35,
'TWD' => 32.10,
'THB' => 36.50,
'VND' => 24800,
'IDR' => 15850,
'MYR' => 4.74,
];
$api_url = 'https://api.exchangerate-api.com/v4/latest/USD';
$ctx = stream_context_create(['http' => ['timeout' => 2]]);
$json = @file_get_contents($api_url, false, $ctx);
if ($json) {
$data = json_decode($json, true);
if (isset($data['rates'])) {
foreach ($fiat_currencies as $code => $rate) {
if (isset($data['rates'][$code])) {
$fiat_currencies[$code] = $data['rates'][$code];
}
}
}
}
return $fiat_currencies;
}

View File

@ -1,264 +0,0 @@
<?php
session_start();
$translations = [
'en' => [
'nav_home' => 'Home',
'nav_market' => 'Markets',
'nav_trade' => 'Trade',
'nav_spot' => 'Spot',
'nav_futures' => 'Futures',
'nav_options' => 'Second Contract',
'nav_mining' => 'Mining',
'nav_convert' => 'Convert',
'nav_assets' => 'Assets',
'nav_total_assets' => 'Total Assets',
'nav_deposit' => 'Deposit',
'nav_withdraw' => 'Withdraw',
'nav_login' => 'Log In',
'nav_register' => 'Sign Up',
'nav_profile' => 'Profile',
'nav_logout' => 'Log Out',
'nav_security' => 'Security',
'nav_app_download' => 'APP Download',
'hero_title' => 'Buy, trade, and hold 350+ cryptocurrencies on NovaEx',
'hero_subtitle' => 'Join the world\'s largest crypto exchange with the lowest fees and best security.',
'btn_start' => 'Get Started',
'btn_download' => 'Download App',
'app_download' => 'APP Download',
'download_qr_tip' => 'Download App & Get Up to 50 USDT',
'join_now' => 'Join Now',
'start_trading' => 'Start Trading',
'earn_now' => 'Earn Now',
'market_trends' => 'Market Trends',
'view_more_markets' => 'View More',
'pair' => 'Pair',
'last_price' => 'Last Price',
'24h_change' => '24h Change',
'market_cap' => 'Market Cap',
'why_choose_us' => 'Why Choose NovaEx?',
'secure_storage' => 'Secure Storage',
'secure_storage_desc' => 'We store the vast majority of the digital assets in secure offline storage.',
'protected_insurance' => 'Protected by Insurance',
'protected_insurance_desc' => 'Cryptocurrency stored on our servers is covered by our insurance policy.',
'industry_best_practices' => 'Best Practices',
'industry_best_practices_desc' => 'NovaEx supports a variety of the most popular digital currencies.',
'platform_desc' => 'Our platform provides a seamless trading experience with advanced features and a robust infrastructure designed for both retail and institutional traders.',
'global_partners' => 'Global Partners',
'partners_subtitle' => 'Trusted by world-leading organizations and financial institutions.',
'footer_desc' => 'NovaEx is a leading digital asset trading platform, providing secure and stable trading services for global users.',
'about' => 'About',
'about_us' => 'About Us',
'careers' => 'Careers',
'news' => 'News',
'legal_privacy' => 'Legal & Privacy',
'terms_service' => 'Terms of Service',
'products' => 'Products',
'spot_trading' => 'Spot Trading',
'futures_trading' => 'Futures Trading',
'flash_swap' => 'Flash Swap',
'staking' => 'Staking',
'asset_management' => 'Asset Management',
'support' => 'Support',
'help_center' => 'Help Center',
'submit_request' => 'Submit a Request',
'api_docs' => 'API Documentation',
'fee_schedule' => 'Fee Schedule',
'service_status' => 'Service Status',
'all_rights_reserved' => 'ALL RIGHTS RESERVED.',
'cookie_policy' => 'Cookie Policy',
'security' => 'Security',
'system_status_normal' => 'System Status: Normal',
'search_pair' => 'Search Pairs',
'search_contract' => 'Search Contracts',
'price' => 'Price',
'amount' => 'Amount',
'total' => 'Total',
'available' => 'Available',
'limit' => 'Limit',
'market' => 'Market',
'buy' => 'Buy',
'sell' => 'Sell',
'buy_long' => 'Buy Long',
'sell_short' => 'Sell Short',
'open_long' => 'Open Long',
'open_short' => 'Open Short',
'leverage' => 'Leverage',
'margin' => 'Margin',
'isolated' => 'Isolated',
'cross' => 'Cross',
'order_book' => 'Order Book',
'open_orders' => 'Open Orders',
'order_history' => 'Order History',
'positions' => 'Positions',
'no_records' => 'No Records',
'cancel' => 'Cancel',
'confirm' => 'Confirm',
'adjust_leverage' => 'Adjust Leverage',
'close_position' => 'Close',
'time' => 'Time',
'status' => 'Status',
'action' => 'Action',
'type' => 'Type',
'direction' => 'Side',
'filled' => 'Filled',
'settlement_time' => 'Settlement Time',
'buy_amount' => 'Order Amount',
'min_order' => 'Min Order',
'buy_up' => 'Buy Up',
'buy_down' => 'Buy Down',
'profit' => 'Profit',
'expected_profit' => 'Expected Profit',
'in_progress' => 'In Progress',
'settled' => 'Settled',
'opening_price' => 'Opening Price',
'closing_price' => 'Closing Price',
'countdown' => 'Countdown',
'pnl' => 'P/L',
'trading_executing' => 'Trading Executing',
'waiting_settlement' => 'Waiting for Settlement',
'system_matching_engine' => 'System matching engine',
],
'zh' => [
'nav_home' => '首页',
'nav_market' => '行情',
'nav_trade' => '交易',
'nav_spot' => '现货交易',
'nav_futures' => '合约交易',
'nav_options' => '秒合约',
'nav_mining' => '挖矿',
'nav_convert' => '闪兑',
'nav_assets' => '资产',
'nav_total_assets' => '总资产',
'nav_deposit' => '充值',
'nav_withdraw' => '提现',
'nav_login' => '登录',
'nav_register' => '注册',
'nav_profile' => '个人中心',
'nav_logout' => '退出登录',
'nav_security' => '安全中心',
'nav_app_download' => 'APP 下载',
'hero_title' => '在 NovaEx 购买、交易和持有 350 多种加密货币',
'hero_subtitle' => '加入全球最大的加密货币交易所,享受最低的费用和最好的安全性。',
'btn_start' => '立即开始',
'btn_download' => '下载应用',
'app_download' => 'APP 下载',
'download_qr_tip' => '下载应用并获得高达 50 USDT 的奖励',
'join_now' => '立即加入',
'start_trading' => '开始交易',
'earn_now' => '立即赚取',
'market_trends' => '市场趋势',
'view_more_markets' => '查看更多',
'pair' => '币对',
'last_price' => '最新价',
'24h_change' => '24h 涨跌',
'market_cap' => '市值',
'why_choose_us' => '为什么选择 NovaEx?',
'secure_storage' => '安全存储',
'secure_storage_desc' => '我们将绝大部分数字资产存储在安全的离线存储中。',
'protected_insurance' => '保险保护',
'protected_insurance_desc' => '存储在我们服务器上的加密货币受我们的保险政策保护。',
'industry_best_practices' => '行业最佳实践',
'industry_best_practices_desc' => 'NovaEx 支持多种最流行的数字货币。',
'platform_desc' => '我们的平台为零售和机构交易者提供具有先进功能和稳健基础设施的无缝交易体验。',
'global_partners' => '全球合作伙伴',
'partners_subtitle' => '深受全球领先组织和金融机构的信任。',
'footer_desc' => 'NovaEx 是全球领先的数字资产 trading 平台,为全球用户提供安全稳定的交易服务。',
'about' => '关于',
'about_us' => '关于我们',
'careers' => '职业介绍',
'news' => '新闻',
'legal_privacy' => '法律与隐私',
'terms_service' => '服务条款',
'products' => '产品',
'spot_trading' => '现货交易',
'futures_trading' => '合约交易',
'flash_swap' => '闪兑',
'staking' => '质押',
'asset_management' => '资产管理',
'support' => '支持',
'help_center' => '帮助中心',
'submit_request' => '提交请求',
'api_docs' => 'API 文档',
'fee_schedule' => '费率标准',
'service_status' => '服务状态',
'all_rights_reserved' => '保留所有权利。',
'cookie_policy' => 'Cookie 政策',
'security' => '安全',
'system_status_normal' => '系统状态:正常',
'search_pair' => '搜索币对',
'search_contract' => '搜索合约',
'price' => '价格',
'amount' => '数量',
'total' => '总额',
'available' => '可用',
'limit' => '限价',
'market' => '市价',
'buy' => '买入',
'sell' => '卖出',
'buy_long' => '看多/买入',
'sell_short' => '看空/卖出',
'open_long' => '买入开多',
'open_short' => '卖出开空',
'leverage' => '杠杆',
'margin' => '保证金',
'isolated' => '逐仓',
'cross' => '全仓',
'order_book' => '订单簿',
'open_orders' => '当前委托',
'order_history' => '历史委托',
'positions' => '当前持仓',
'no_records' => '暂无记录',
'cancel' => '取消',
'confirm' => '确认',
'adjust_leverage' => '调整杠杆',
'close_position' => '平仓',
'time' => '时间',
'status' => '状态',
'action' => '操作',
'type' => '类型',
'direction' => '方向',
'filled' => '已成交',
'settlement_time' => '结算时间',
'buy_amount' => '买入金额',
'min_order' => '最小下单',
'buy_up' => '买涨',
'buy_down' => '买跌',
'profit' => '收益',
'expected_profit' => '预期收益',
'in_progress' => '进行中',
'settled' => '已结算',
'opening_price' => '买入价',
'closing_price' => '结算价',
'countdown' => '倒计时',
'pnl' => '盈亏',
'trading_executing' => '交易执行中',
'waiting_settlement' => '等待结算',
'system_matching_engine' => '系统撮合引擎',
]
];
$lang = $_SESSION['lang'] ?? 'en';
if (isset($_GET['lang']) && array_key_exists($_GET['lang'], $translations)) {
$_SESSION['lang'] = $_GET['lang'];
$lang = $_GET['lang'];
}
function __($key, $default = '') {
global $translations, $lang;
return $translations[$lang][$key] ?? ($default ?: $key);
}

424
index.php
View File

@ -1,290 +1,150 @@
<?php
session_start();
include 'header.php';
require_once 'db/config.php';
declare(strict_types=1);
@ini_set('display_errors', '1');
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
// Fetch market data for the home page table
$trending_pairs = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT'];
$phpVersion = PHP_VERSION;
$now = date('Y-m-d H:i:s');
?>
<main>
<!-- Carousel Section (Constrained Width) -->
<section class="hero-carousel-section" style="padding: 20px 0; background: #0b0e11;">
<div class="carousel-container" style="max-width: 1200px; margin: 0 auto; position: relative; height: 500px; overflow: hidden; border-radius: 24px; box-shadow: 0 30px 60px rgba(0,0,0,0.6);">
<div class="carousel-track" id="carouselTrack" style="display: flex; height: 100%; transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);">
<div class="carousel-slide" style="min-width: 100%; position: relative;">
<img src="https://images.pexels.com/photos/6771574/pexels-photo-6771574.jpeg?auto=compress&cs=tinysrgb&w=1920" style="width: 100%; height: 100%; object-fit: cover; opacity: 0.6;">
<div class="carousel-content" style="position: absolute; top: 50%; left: 8%; transform: translateY(-50%); color: white; max-width: 650px;">
<h2 class="carousel-title" style="font-size: 3.5rem; font-weight: 800; margin-bottom: 25px; line-height: 1.1; text-shadow: 0 10px 20px rgba(0,0,0,0.5);">NovaEx Global Launch</h2>
<p class="carousel-desc" style="font-size: 1.2rem; opacity: 0.9; margin-bottom: 35px; line-height: 1.6;">Experience the next generation of digital asset trading with ultra-low latency and bank-grade security.</p>
<a href="register.php" class="btn-primary" style="padding: 15px 45px; border-radius: 12px; font-weight: bold; text-decoration: none; display: inline-block; background: var(--primary-color); color: white; font-size: 1.1rem; box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3);"><?php echo __('join_now'); ?></a>
</div>
</div>
<div class="carousel-slide" style="min-width: 100%; position: relative;">
<img src="https://images.pexels.com/photos/844124/pexels-photo-844124.jpeg?auto=compress&cs=tinysrgb&w=1920" style="width: 100%; height: 100%; object-fit: cover; opacity: 0.6;">
<div class="carousel-content" style="position: absolute; top: 50%; left: 8%; transform: translateY(-50%); color: white; max-width: 650px;">
<h2 class="carousel-title" style="font-size: 3.5rem; font-weight: 800; margin-bottom: 25px; line-height: 1.1; text-shadow: 0 10px 20px rgba(0,0,0,0.5);">Trade Futures with 100x Leverage</h2>
<p class="carousel-desc" style="font-size: 1.2rem; opacity: 0.9; margin-bottom: 35px; line-height: 1.6;">Maximize your capital efficiency with our professional perpetual futures contracts.</p>
<a href="futures.php" class="btn-primary" style="padding: 15px 45px; border-radius: 12px; font-weight: bold; text-decoration: none; display: inline-block; background: var(--primary-color); color: white; font-size: 1.1rem;"><?php echo __('start_trading'); ?></a>
</div>
</div>
<div class="carousel-slide" style="min-width: 100%; position: relative;">
<img src="https://images.pexels.com/photos/6771178/pexels-photo-6771178.jpeg?auto=compress&cs=tinysrgb&w=1920" style="width: 100%; height: 100%; object-fit: cover; opacity: 0.6;">
<div class="carousel-content" style="position: absolute; top: 50%; left: 8%; transform: translateY(-50%); color: white; max-width: 650px;">
<h2 class="carousel-title" style="font-size: 3.5rem; font-weight: 800; margin-bottom: 25px; line-height: 1.1; text-shadow: 0 10px 20px rgba(0,0,0,0.5);">Secure Crypto Staking</h2>
<p class="carousel-desc" style="font-size: 1.2rem; opacity: 0.9; margin-bottom: 35px; line-height: 1.6;">Earn passive income on your idle assets with our high-yield staking pools.</p>
<a href="mining.php" class="btn-primary" style="padding: 15px 45px; border-radius: 12px; font-weight: bold; text-decoration: none; display: inline-block; background: var(--primary-color); color: white; font-size: 1.1rem;"><?php echo __('earn_now'); ?></a>
</div>
</div>
</div>
<div class="carousel-dots" style="position: absolute; bottom: 30px; left: 8%; display: flex; gap: 12px;">
<div class="carousel-dot active" onclick="goToSlide(0)" style="width: 12px; height: 12px; border-radius: 50%; background: white; cursor: pointer; opacity: 0.5; transition: 0.3s;"></div>
<div class="carousel-dot" onclick="goToSlide(1)" style="width: 12px; height: 12px; border-radius: 50%; background: white; cursor: pointer; opacity: 0.5; transition: 0.3s;"></div>
<div class="carousel-dot" onclick="goToSlide(2)" style="width: 12px; height: 12px; border-radius: 50%; background: white; cursor: pointer; opacity: 0.5; transition: 0.3s;"></div>
</div>
</div>
</section>
<!-- Market Trends -->
<section class="container" style="padding: 60px 20px;">
<div style="display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 30px;">
<h2 class="section-title-home" style="font-size: 2.2rem; font-weight: 800; margin: 0;"><?php echo __('market_trends'); ?></h2>
<a href="markets.php" style="color: var(--primary-color); text-decoration: none; font-weight: 600; font-size: 15px;"><?php echo __('view_more_markets'); ?> <i class="fas fa-chevron-right" style="font-size: 11px; margin-left: 5px;"></i></a>
</div>
<div class="market-table-container" style="background: var(--card-bg); border-radius: 24px; border: 1px solid var(--border-color); overflow: hidden; box-shadow: 0 15px 40px rgba(0,0,0,0.3);">
<table class="market-table" style="width: 100%; border-collapse: collapse; text-align: left; min-width: 600px;">
<thead>
<tr style="border-bottom: 1px solid var(--border-color); background: rgba(255,255,255,0.03);">
<th style="padding: 20px 25px; color: var(--text-muted); font-weight: 600; font-size: 14px;"><?php echo __('pair'); ?></th>
<th style="padding: 20px 25px; color: var(--text-muted); font-weight: 600; font-size: 14px;"><?php echo __('last_price'); ?></th>
<th style="padding: 20px 25px; color: var(--text-muted); font-weight: 600; font-size: 14px;"><?php echo __('24h_change'); ?></th>
<th class="desktop-only-cell" style="padding: 20px 25px; color: var(--text-muted); font-weight: 600; font-size: 14px;"><?php echo __('market_cap'); ?></th>
</tr>
</thead>
<tbody id="home-market-list">
<!-- JS Filled -->
</tbody>
</table>
</div>
</section>
<!-- Why Choose Us -->
<section class="container" style="padding: 80px 20px; border-top: 1px solid rgba(255,255,255,0.05);">
<div style="text-align: center; margin-bottom: 60px;">
<h2 class="section-title-home" style="font-size: 2.8rem; font-weight: 800; margin-bottom: 20px;"><?php echo __('why_choose_us'); ?></h2>
<p style="color: var(--text-muted); max-width: 700px; margin: 0 auto; font-size: 1.1rem; line-height: 1.7;"><?php echo __('platform_desc'); ?></p>
</div>
<div class="grid-3" style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px;">
<div class="choose-card" style="padding: 50px 40px; background: rgba(255,255,255,0.02); border-radius: 32px; border: 1px solid rgba(255,255,255,0.05); text-align: center; transition: all 0.4s ease;">
<div style="width: 80px; height: 80px; background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); border-radius: 24px; display: flex; align-items: center; justify-content: center; margin: 0 auto 30px; color: white; font-size: 2rem; box-shadow: 0 10px 20px rgba(79, 172, 254, 0.3);">
<i class="fas fa-shield-alt"></i>
</div>
<h3 style="margin-bottom: 18px; font-size: 1.5rem; font-weight: 700; color: white;"><?php echo __('secure_storage'); ?></h3>
<p style="color: var(--text-muted); line-height: 1.7; font-size: 1rem;"><?php echo __('secure_storage_desc'); ?></p>
</div>
<div class="choose-card" style="padding: 50px 40px; background: rgba(255,255,255,0.02); border-radius: 32px; border: 1px solid rgba(255,255,255,0.05); text-align: center; transition: all 0.4s ease;">
<div style="width: 80px; height: 80px; background: linear-gradient(135deg, #00c087 0%, #00d2ff 100%); border-radius: 24px; display: flex; align-items: center; justify-content: center; margin: 0 auto 30px; color: white; font-size: 2rem; box-shadow: 0 10px 20px rgba(0, 192, 135, 0.3);">
<i class="fas fa-user-lock"></i>
</div>
<h3 style="margin-bottom: 18px; font-size: 1.5rem; font-weight: 700; color: white;"><?php echo __('protected_insurance'); ?></h3>
<p style="color: var(--text-muted); line-height: 1.7; font-size: 1rem;"><?php echo __('protected_insurance_desc'); ?></p>
</div>
<div class="choose-card" style="padding: 50px 40px; background: rgba(255,255,255,0.02); border-radius: 32px; border: 1px solid rgba(255,255,255,0.05); text-align: center; transition: all 0.4s ease;">
<div style="width: 80px; height: 80px; background: linear-gradient(135deg, #f0b90b 0%, #ff9a00 100%); border-radius: 24px; display: flex; align-items: center; justify-content: center; margin: 0 auto 30px; color: white; font-size: 2rem; box-shadow: 0 10px 20px rgba(240, 185, 11, 0.3);">
<i class="fas fa-microchip"></i>
</div>
<h3 style="margin-bottom: 18px; font-size: 1.5rem; font-weight: 700; color: white;"><?php echo __('industry_best_practices'); ?></h3>
<p style="color: var(--text-muted); line-height: 1.7; font-size: 1rem;"><?php echo __('industry_best_practices_desc'); ?></p>
</div>
</div>
</section>
<!-- Partners -->
<section style="padding: 100px 0; background: #0b0e11; border-top: 1px solid rgba(255,255,255,0.05);">
<div class="container" style="text-align: center;">
<h2 style="font-size: 2.2rem; font-weight: 800; margin-bottom: 15px;"><?php echo __('global_partners'); ?></h2>
<p style="color: var(--text-muted); margin-bottom: 60px; font-size: 1.1rem;"><?php echo __('partners_subtitle'); ?></p>
<div class="partners-grid-custom" style="display: grid; grid-template-columns: repeat(6, 1fr); gap: 25px;">
<div class="partner-item"><i class="fab fa-google-pay" style="font-size: 2.5rem; color: #4285F4;"></i></div>
<div class="partner-item"><i class="fab fa-apple-pay" style="font-size: 2.5rem; color: #ffffff;"></i></div>
<div class="partner-item"><i class="fab fa-visa" style="font-size: 2.5rem; color: #1a1f71;"></i></div>
<div class="partner-item"><i class="fab fa-mastercard" style="font-size: 2.5rem; color: #eb001b;"></i></div>
<div class="partner-item"><i class="fab fa-paypal" style="font-size: 2.5rem; color: #003087;"></i></div>
<div class="partner-item"><i class="fab fa-stripe" style="font-size: 2.5rem; color: #6772e5;"></i></div>
<div class="partner-item"><i class="fab fa-amazon-pay" style="font-size: 2.5rem; color: #FF9900;"></i></div>
<div class="partner-item"><i class="fab fa-alipay" style="font-size: 2.5rem; color: #00A3EE;"></i></div>
<div class="partner-item"><i class="fab fa-cc-amex" style="font-size: 2.5rem; color: #007bc1;"></i></div>
<div class="partner-item"><i class="fab fa-cc-discover" style="font-size: 2.5rem; color: #ff6000;"></i></div>
<div class="partner-item"><i class="fab fa-cc-diners-club" style="font-size: 2.5rem; color: #004a97;"></i></div>
<div class="partner-item"><i class="fab fa-cc-jcb" style="font-size: 2.5rem; color: #003184;"></i></div>
</div>
</div>
</section>
<!-- Download Section -->
<section style="padding: 100px 0; background: linear-gradient(to bottom, #0b0e11, #161a1e);">
<div class="container">
<div class="download-grid" style="display: flex; align-items: center; justify-content: space-between; gap: 60px; flex-wrap: wrap;">
<div style="flex: 1.2; min-width: 300px;">
<h2 class="section-title-small" style="font-size: 3rem; font-weight: 800; margin-bottom: 25px; background: linear-gradient(135deg, #fff 0%, #848e9c 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1.2;">Trade Anywhere, Anytime</h2>
<p style="color: var(--text-muted); font-size: 1.2rem; line-height: 1.8; margin-bottom: 40px;">Stay connected to the markets with the NovaEx mobile app. Experience professional trading features in the palm of your hand.</p>
<div class="features-mini-grid" style="display: grid; grid-template-columns: 1fr 1fr; gap: 30px; margin-top: 40px;">
<div style="display: flex; gap: 15px; align-items: flex-start;">
<div style="width: 44px; height: 44px; border-radius: 14px; background: rgba(79, 172, 254, 0.1); display: flex; align-items: center; justify-content: center; color: var(--primary-color); flex-shrink: 0;">
<i class="fas fa-bolt" style="font-size: 18px;"></i>
</div>
<div>
<h4 style="margin: 0 0 5px; font-weight: 700; font-size: 1.1rem; color: white;">Fast & Secure</h4>
<p style="font-size: 0.95rem; color: #848e9c; margin: 0; line-height: 1.4;">Military-grade encryption for all your data.</p>
</div>
</div>
<div style="display: flex; gap: 15px; align-items: flex-start;">
<div style="width: 44px; height: 44px; border-radius: 14px; background: rgba(0, 192, 135, 0.1); display: flex; align-items: center; justify-content: center; color: #00c087; flex-shrink: 0;">
<i class="fas fa-chart-line" style="font-size: 18px;"></i>
</div>
<div>
<h4 style="margin: 0 0 5px; font-weight: 700; font-size: 1.1rem; color: white;">Real-time</h4>
<p style="font-size: 0.95rem; color: #848e9c; margin: 0; line-height: 1.4;">Low-latency updates and market depth.</p>
</div>
</div>
</div>
</div>
<div style="flex: 1; display: flex; flex-direction: column; gap: 20px; min-width: 320px;">
<a href="app.php" style="text-decoration: none;">
<div class="download-card-new" style="background: rgba(255,255,255,0.03); padding: 25px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 20px; transition: all 0.3s ease;">
<div style="width: 60px; height: 60px; background: #000; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 2rem;">
<i class="fab fa-apple" style="color: white;"></i>
</div>
<div style="flex: 1;">
<div style="font-size: 0.85rem; color: #848e9c;">Download on the</div>
<div style="font-size: 1.3rem; font-weight: 800; color: white;">App Store</div>
</div>
<i class="fas fa-chevron-right" style="color: #848e9c;"></i>
</div>
</a>
<a href="app.php" style="text-decoration: none;">
<div class="download-card-new" style="background: rgba(255,255,255,0.03); padding: 25px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 20px; transition: all 0.3s ease;">
<div style="width: 60px; height: 60px; background: #000; border-radius: 16px; display: flex; align-items: center; justify-content: center; font-size: 1.8rem;">
<i class="fab fa-google-play" style="color: #3DDC84;"></i>
</div>
<div style="flex: 1;">
<div style="font-size: 0.85rem; color: #848e9c;">Get it on</div>
<div style="font-size: 1.3rem; font-weight: 800; color: white;">Google Play</div>
</div>
<i class="fas fa-chevron-right" style="color: #848e9c;"></i>
</div>
</a>
<div style="display: flex; gap: 20px; align-items: center; background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%); padding: 20px; border-radius: 20px; border: 1px solid rgba(79, 172, 254, 0.2);">
<div style="background: white; padding: 12px; border-radius: 14px; box-shadow: 0 5px 15px rgba(0,0,0,0.2);">
<i class="fas fa-qrcode" style="font-size: 2.5rem; color: #000;"></i>
</div>
<div>
<div style="font-weight: 800; color: white; font-size: 1.1rem; margin-bottom: 4px;">Scan to Download</div>
<div style="font-size: 0.9rem; color: #848e9c;">Support for iOS & Android</div>
</div>
</div>
</div>
</div>
</div>
</section>
</main>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New Style</title>
<?php
// Read project preview data from environment
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
?>
<?php if ($projectDescription): ?>
<!-- Meta description -->
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
<!-- Open Graph meta tags -->
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<!-- Twitter meta tags -->
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
<?php endif; ?>
<?php if ($projectImageUrl): ?>
<!-- Open Graph image -->
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<!-- Twitter image -->
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
<?php endif; ?>
<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=Inter:wght@400;700&display=swap" rel="stylesheet">
<style>
.carousel-dot.active { opacity: 1 !important; width: 35px !important; border-radius: 8px !important; background: var(--primary-color) !important; }
.partner-item { padding: 30px 20px; background: rgba(255,255,255,0.02); border-radius: 20px; transition: 0.3s; display: flex; align-items: center; justify-content: center; border: 1px solid rgba(255,255,255,0.03); }
.partner-item:hover { background: rgba(255,255,255,0.05); transform: translateY(-5px); border-color: rgba(255,255,255,0.1); }
.download-card-new:hover { background: rgba(255,255,255,0.06) !important; border-color: var(--primary-color) !important; transform: translateX(5px); }
.choose-card:hover { transform: translateY(-15px); border-color: var(--primary-color) !important; background: rgba(79, 172, 254, 0.05) !important; }
@media (max-width: 992px) {
.carousel-container { height: 400px !important; border-radius: 0 !important; }
.carousel-title { font-size: 2.2rem !important; }
.carousel-desc { font-size: 1rem !important; margin-bottom: 25px !important; }
.partners-grid-custom { grid-template-columns: repeat(3, 1fr) !important; }
.grid-3 { grid-template-columns: 1fr !important; }
.section-title-home { font-size: 2.2rem !important; }
:root {
--bg-color-start: #6a11cb;
--bg-color-end: #2575fc;
--text-color: #ffffff;
--card-bg-color: rgba(255, 255, 255, 0.01);
--card-border-color: rgba(255, 255, 255, 0.1);
}
@media (max-width: 576px) {
.carousel-container { height: 350px !important; }
.carousel-title { font-size: 1.8rem !important; }
.section-title-home { font-size: 1.8rem !important; }
.partners-grid-custom { grid-template-columns: repeat(2, 1fr) !important; }
.desktop-only-cell { display: none; }
.features-mini-grid { grid-template-columns: 1fr !important; }
.download-grid { gap: 40px !important; }
.section-title-small { font-size: 2.2rem !important; }
body {
margin: 0;
font-family: 'Inter', sans-serif;
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
color: var(--text-color);
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
<script>
// Carousel Logic
let currentSlide = 0;
const track = document.getElementById('carouselTrack');
const dots = document.querySelectorAll('.carousel-dot');
function updateCarousel() {
if (!track) return;
track.style.transform = `translateX(-${currentSlide * 100}%)`;
dots.forEach((dot, i) => {
dot.classList.toggle('active', i === currentSlide);
});
}
function goToSlide(n) {
currentSlide = n;
updateCarousel();
}
function nextSlide() {
currentSlide = (currentSlide + 1) % 3;
updateCarousel();
}
setInterval(nextSlide, 6000);
const trendingPairs = <?php echo json_encode($trending_pairs); ?>;
const homeWs = new WebSocket('wss://stream.binance.com:9443/ws/' + trendingPairs.map(p => p.toLowerCase() + '@ticker').join('/'));
const homeMarketData = {};
homeWs.onmessage = (event) => {
const data = JSON.parse(event.data);
homeMarketData[data.s] = data;
renderHomeMarket();
};
function renderHomeMarket() {
const tbody = document.getElementById('home-market-list');
if (!tbody) return;
let html = '';
trendingPairs.forEach(p => {
const d = homeMarketData[p] || {c: 0, P: 0, q: 0};
const color = d.P >= 0 ? 'var(--success-color)' : 'var(--danger-color)';
const name = p.replace('USDT', '');
html += `
<tr style="border-bottom: 1px solid rgba(255,255,255,0.05);">
<td style="padding: 20px 25px; display: flex; align-items: center; gap: 15px;">
<img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png" width="32" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div>
<div style="font-weight: 700; font-size: 1.1rem; color: white;">${name}</div>
<div style="font-size: 0.8rem; color: var(--text-muted);">USDT</div>
</head>
<body>
<main>
<div class="card">
<h1>Analyzing your requirements and generating your website…</h1>
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
<span class="sr-only">Loading…</span>
</div>
</td>
<td style="padding: 20px 25px; font-weight: 600; font-size: 1.1rem; color: #EAECEF;">$ ${parseFloat(d.c).toLocaleString()}</td>
<td style="padding: 20px 25px; color: ${color}; font-weight: 700; font-size: 1.1rem;">${d.P >= 0 ? '+' : ''}${d.P}%</td>
<td class="desktop-only-cell" style="padding: 20px 25px; color: var(--text-muted); font-size: 1rem;">$ ${(parseFloat(d.q) / 1000000).toFixed(2)}M</td>
</tr>
`;
});
tbody.innerHTML = html;
}
</script>
<?php include 'footer.php'; ?>
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
<p class="hint">This page will update automatically as the plan is implemented.</p>
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
</div>
</main>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC)
</footer>
</body>
</html>

185
kyc.php
View File

@ -1,185 +0,0 @@
<?php
include 'header.php';
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once 'db/config.php';
$db = db();
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$status = $user['kyc_status'] ?? 0;
$message = '';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && $status != 1 && $status != 2) {
$name = $_POST['kyc_name'] ?? '';
$id_number = $_POST['kyc_id_number'] ?? '';
// Simple file handling for prototype
$upload_dir = 'uploads/kyc/';
if (!is_dir($upload_dir)) mkdir($upload_dir, 0777, true);
$front = '';
$back = '';
$handheld = '';
if (isset($_FILES['front']) && $_FILES['front']['error'] === 0) {
$front = $upload_dir . time() . '_front_' . $_FILES['front']['name'];
move_uploaded_file($_FILES['front']['tmp_name'], $front);
}
if (isset($_FILES['back']) && $_FILES['back']['error'] === 0) {
$back = $upload_dir . time() . '_back_' . $_FILES['back']['name'];
move_uploaded_file($_FILES['back']['tmp_name'], $back);
}
if (isset($_FILES['handheld']) && $_FILES['handheld']['error'] === 0) {
$handheld = $upload_dir . time() . '_handheld_' . $_FILES['handheld']['name'];
move_uploaded_file($_FILES['handheld']['tmp_name'], $handheld);
}
$stmt = $db->prepare("UPDATE users SET kyc_name = ?, kyc_id_number = ?, kyc_id_front = ?, kyc_id_back = ?, kyc_id_handheld = ?, kyc_status = 1 WHERE id = ?");
if ($stmt->execute([$name, $id_number, $front, $back, $handheld, $_SESSION['user_id']])) {
$status = 1;
$message = "KYC documents submitted successfully! Our team will review them shortly.";
} else {
$error = "Failed to submit KYC documents. Please try again.";
}
}
$status_labels = [
0 => ['text' => 'Unverified', 'color' => '#888', 'icon' => 'fa-user-slash'],
1 => ['text' => 'Under Review', 'color' => '#f0b90b', 'icon' => 'fa-clock'],
2 => ['text' => 'Verified', 'color' => 'var(--success-color)', 'icon' => 'fa-check-circle'],
3 => ['text' => 'Rejected', 'color' => 'var(--danger-color)', 'icon' => 'fa-times-circle'],
];
$current = $status_labels[$status];
?>
<main style="padding: 40px 20px; background: #0b0e11; min-height: calc(100vh - 64px);">
<div style="max-width: 800px; margin: 0 auto;">
<a href="profile.php" class="back-btn"><i class="fas fa-arrow-left"></i> Profile</a>
<div style="background: var(--card-bg); padding: 40px; border-radius: 24px; border: 1px solid var(--border-color);">
<div style="text-align: center; margin-bottom: 40px;">
<div style="width: 70px; height: 70px; background: rgba(0,82,255,0.1); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 20px; color: <?php echo $current['color']; ?>; font-size: 32px;">
<i class="fas <?php echo $current['icon']; ?>"></i>
</div>
<h2 style="margin: 0; font-size: 2rem;">Identity Verification</h2>
<p style="color: var(--text-muted); margin-top: 10px;">Status: <span style="color: <?php echo $current['color']; ?>; font-weight: bold;"><?php echo $current['text']; ?></span></p>
</div>
<?php if($message): ?>
<div style="background: rgba(14,203,129,0.1); color: var(--success-color); padding: 20px; border-radius: 12px; margin-bottom: 30px; border: 1px solid var(--success-color);">
<i class="fas fa-check-circle"></i> <?php echo $message; ?>
</div>
<?php endif; ?>
<?php if($error): ?>
<div style="background: rgba(246,70,93,0.1); color: var(--danger-color); padding: 20px; border-radius: 12px; margin-bottom: 30px; border: 1px solid var(--danger-color);">
<i class="fas fa-exclamation-circle"></i> <?php echo $error; ?>
</div>
<?php endif; ?>
<?php if($status == 0 || $status == 3): ?>
<form method="POST" enctype="multipart/form-data">
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 25px;">
<div>
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;">Full Name</label>
<input type="text" name="kyc_name" placeholder="As shown on ID" required style="width: 100%; padding: 14px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; outline: none;">
</div>
<div>
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;">ID / Passport Number</label>
<input type="text" name="kyc_id_number" placeholder="Enter ID number" required style="width: 100%; padding: 14px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; outline: none;">
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 25px; margin-bottom: 30px;">
<div>
<label style="display: block; margin-bottom: 12px; color: var(--text-muted); font-size: 14px;">ID Front Side</label>
<div class="upload-box" onclick="document.getElementById('file-front').click()">
<i class="fas fa-plus" id="icon-front"></i>
<span id="text-front">Upload Photo</span>
<input type="file" name="front" id="file-front" hidden onchange="previewFile(this, 'front')">
</div>
</div>
<div>
<label style="display: block; margin-bottom: 12px; color: var(--text-muted); font-size: 14px;">ID Back Side</label>
<div class="upload-box" onclick="document.getElementById('file-back').click()">
<i class="fas fa-plus" id="icon-back"></i>
<span id="text-back">Upload Photo</span>
<input type="file" name="back" id="file-back" hidden onchange="previewFile(this, 'back')">
</div>
</div>
</div>
<div style="margin-bottom: 40px;">
<label style="display: block; margin-bottom: 12px; color: var(--text-muted); font-size: 14px;">Handheld ID & Signature</label>
<div class="upload-box" style="height: 180px;" onclick="document.getElementById('file-handheld').click()">
<i class="fas fa-camera" id="icon-handheld" style="font-size: 32px;"></i>
<span id="text-handheld" style="margin-top: 10px;">Upload handheld photo with date</span>
<input type="file" name="handheld" id="file-handheld" hidden onchange="previewFile(this, 'handheld')">
</div>
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 18px; font-size: 1.1rem; border-radius: 12px; font-weight: bold;">Submit for Verification</button>
</form>
<?php elseif($status == 1): ?>
<div style="text-align: center; padding: 40px 0;">
<p style="color: var(--text-muted); line-height: 1.8;">Your identity documents have been received and are currently being reviewed. This process usually takes 1-2 business days. We will notify you once the review is complete.</p>
<div style="margin-top: 30px; padding: 20px; background: rgba(240,185,11,0.05); border-radius: 12px; border: 1px solid rgba(240,185,11,0.1); display: inline-block;">
<i class="fas fa-info-circle"></i> You can still trade while waiting for verification.
</div>
</div>
<?php elseif($status == 2): ?>
<div style="text-align: center; padding: 40px 0;">
<p style="color: var(--success-color); font-weight: 500;">Congratulations! Your identity has been fully verified.</p>
<p style="color: var(--text-muted); margin-top: 10px;">You now have full access to all withdrawal limits and advanced trading features.</p>
</div>
<?php endif; ?>
</div>
</div>
</main>
<style>
.upload-box {
border: 2px dashed var(--border-color);
height: 140px;
border-radius: 16px;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
cursor: pointer;
color: var(--text-muted);
transition: 0.3s;
background: rgba(255,255,255,0.01);
}
.upload-box:hover {
border-color: var(--primary-color);
background: rgba(0,82,255,0.02);
color: white;
}
.upload-box i { font-size: 24px; margin-bottom: 8px; }
.upload-box span { font-size: 13px; }
</style>
<script>
function previewFile(input, type) {
if (input.files && input.files[0]) {
const icon = document.getElementById('icon-' + type);
const text = document.getElementById('text-' + type);
icon.className = 'fas fa-check-circle';
icon.style.color = 'var(--success-color)';
text.innerText = input.files[0].name;
text.style.color = 'var(--success-color)';
}
}
</script>
<?php include 'footer.php'; ?>

View File

@ -1,75 +0,0 @@
<?php
require_once 'db/config.php';
require_once 'includes/i18n.php';
session_start();
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
$pdo = db();
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$username]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password'])) {
// Capture and update IP
$user_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$user_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
$pdo->prepare("UPDATE users SET last_ip = ? WHERE id = ?")->execute([$user_ip, $user['id']]);
$_SESSION['user_id'] = $user['id'];
$_SESSION['username'] = $user['username'];
$_SESSION['uid'] = $user['uid'];
header("Location: index.php");
exit;
} else {
$error = "Invalid username or password.";
}
}
?>
<?php include 'header.php'; ?>
<main style="background: #0b0e11; min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 40px 20px;">
<div style="width: 100%; max-width: 480px; background: var(--card-bg); padding: 50px; border-radius: 32px; border: 1px solid var(--border-color); box-shadow: 0 20px 40px rgba(0,0,0,0.4);">
<h2 style="font-size: 2.2rem; font-weight: 800; margin-bottom: 10px; text-align: center; color: white;">Welcome Back</h2>
<p style="text-align: center; color: var(--text-muted); margin-bottom: 40px;">Log in to your account to continue trading</p>
<?php if($error): ?>
<div style="background: rgba(246,70,93,0.1); color: var(--danger-color); padding: 15px; border-radius: 12px; margin-bottom: 25px; border: 1px solid var(--danger-color); text-align: center; font-size: 14px;">
<i class="fas fa-exclamation-circle"></i> <?php echo $error; ?>
</div>
<?php endif; ?>
<form method="POST">
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;">Account</label>
<div style="position: relative;">
<i class="fas fa-user" style="position: absolute; left: 15px; top: 15px; color: #555;"></i>
<input type="text" name="username" required placeholder="Enter your email or phone" style="width: 100%; padding: 15px 15px 15px 45px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1rem; outline: none; box-sizing: border-box;">
</div>
</div>
<div style="margin-bottom: 30px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;">Password</label>
<div style="position: relative;">
<i class="fas fa-lock" style="position: absolute; left: 15px; top: 15px; color: #555;"></i>
<input type="password" name="password" required placeholder="Enter your password" style="width: 100%; padding: 15px 15px 15px 45px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1rem; outline: none; box-sizing: border-box;">
</div>
</div>
<div style="display: flex; justify-content: flex-end; margin-bottom: 30px;">
<a href="#" style="color: var(--primary-color); text-decoration: none; font-size: 0.85rem;">Forgot Password?</a>
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 18px; font-weight: 800; font-size: 1.1rem; border-radius: 16px; box-shadow: 0 10px 20px rgba(0,82,255,0.2);"><?php echo __('nav_login'); ?></button>
</form>
<div style="text-align: center; margin-top: 30px; border-top: 1px solid var(--border-color); padding-top: 30px;">
<span style="color: var(--text-muted);">Don't have an account?</span> <a href="register.php" style="color: var(--primary-color); text-decoration: none; font-weight: bold;"><?php echo __('nav_register'); ?></a>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,5 +0,0 @@
<?php
session_start();
session_destroy();
header("Location: index.php");
exit;

View File

@ -1,106 +0,0 @@
<?php include 'header.php'; ?>
<main style="padding: 20px 0; background: #0b0e11; min-height: calc(100vh - 65px);">
<div class="container">
<h1 style="color: white; margin-bottom: 20px; font-size: 1.8rem;"><?php echo __('crypto_markets'); ?></h1>
<div class="market-stats-grid" style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; margin-bottom: 25px;">
<div style="background: #1e2329; padding: 15px; border-radius: 12px; border: 1px solid #2b3139;">
<div style="color: #848e9c; font-size: 0.8rem;"><?php echo __('24h_volume'); ?></div>
<div style="font-size: 1.1rem; color: white; margin-top: 5px; font-weight: bold;">$ 84.2B</div>
</div>
<div style="background: #1e2329; padding: 15px; border-radius: 12px; border: 1px solid #2b3139;">
<div style="color: #848e9c; font-size: 0.8rem;"><?php echo __('fear_greed'); ?></div>
<div style="font-size: 1.1rem; color: #00c087; margin-top: 5px; font-weight: bold;">74 Greed</div>
</div>
<div style="background: #1e2329; padding: 15px; border-radius: 12px; border: 1px solid #2b3139;">
<div style="color: #848e9c; font-size: 0.8rem;"><?php echo __('btc_dominance'); ?></div>
<div style="font-size: 1.1rem; color: white; margin-top: 5px; font-weight: bold;">52.1%</div>
</div>
</div>
<div style="background: #1e2329; border-radius: 16px; border: 1px solid #2b3139; overflow: hidden;">
<div class="market-tabs" style="padding: 10px 20px; border-bottom: 1px solid #2b3139; display: flex; gap: 25px; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch;">
<span style="color: white; border-bottom: 2px solid var(--primary-color); padding: 10px 0; cursor: pointer; font-size: 0.95rem; font-weight: 500;"><?php echo __('favorites'); ?></span>
<span style="color: #848e9c; padding: 10px 0; cursor: pointer; font-size: 0.95rem;"><?php echo __('all_crypto'); ?></span>
<span style="color: #848e9c; padding: 10px 0; cursor: pointer; font-size: 0.95rem;"><?php echo __('nav_spot'); ?></span>
<span style="color: #848e9c; padding: 10px 0; cursor: pointer; font-size: 0.95rem;"><?php echo __('nav_futures'); ?></span>
</div>
<div class="market-table-container">
<table style="width: 100%; border-collapse: collapse; min-width: 500px;">
<thead style="background: #161a1e;">
<tr>
<th style="padding: 12px 20px; text-align: left; color: #848e9c; font-weight: normal; font-size: 0.85rem;"><?php echo __('asset'); ?></th>
<th style="padding: 12px 20px; text-align: right; color: #848e9c; font-weight: normal; font-size: 0.85rem;"><?php echo __('price'); ?></th>
<th style="padding: 12px 20px; text-align: right; color: #848e9c; font-weight: normal; font-size: 0.85rem;">24h %</th>
<th class="desktop-only-cell" style="padding: 12px 20px; text-align: right; color: #848e9c; font-weight: normal; font-size: 0.85rem;"><?php echo __('24h_high_low'); ?></th>
<th class="desktop-only-cell" style="padding: 12px 20px; text-align: right; color: #848e9c; font-weight: normal; font-size: 0.85rem;"><?php echo __('trade_panel'); ?></th>
</tr>
</thead>
<tbody id="market-list-all">
<!-- Filled by WS -->
</tbody>
</table>
</div>
</div>
</div>
</main>
<style>
@media (max-width: 768px) {
.market-stats-grid { grid-template-columns: 1fr !important; }
.market-tabs::-webkit-scrollbar { display: none; }
.desktop-only-cell { display: none; }
}
</style>
<script>
const pairs = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT', 'ADAUSDT', 'DOGEUSDT', 'DOTUSDT', 'LINKUSDT', 'AVAXUSDT', 'MATICUSDT', 'SHIBUSDT'];
const ws = new WebSocket('wss://stream.binance.com:9443/ws/' + pairs.map(p => p.toLowerCase() + '@ticker').join('/'));
const marketData = {};
ws.onmessage = (event) => {
const data = JSON.parse(event.data);
marketData[data.s] = data;
renderMarketList();
};
function renderMarketList() {
const tbody = document.getElementById('market-list-all');
if (!tbody) return;
let html = '';
pairs.forEach(p => {
const d = marketData[p];
if(!d) return;
const price = parseFloat(d.c).toLocaleString(undefined, {minimumFractionDigits: 2});
const change = parseFloat(d.P).toFixed(2);
const color = change >= 0 ? 'var(--success-color)' : 'var(--danger-color)';
const name = p.replace('USDT', '');
html += `
<tr style="border-bottom: 1px solid #2b3139; cursor: pointer;" onclick="location.href='spot.php?symbol=${p}'">
<td style="padding: 15px 20px; display: flex; align-items: center; gap: 12px;">
<img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png" width="28" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div>
<div style="color: white; font-weight: bold; font-size: 0.95rem;">${name}</div>
<div style="color: #666; font-size: 0.75rem;">${name}/USDT</div>
</div>
</td>
<td style="padding: 15px 20px; text-align: right; color: white; font-weight: bold; font-family: monospace; font-size: 0.95rem;">$ ${price}</td>
<td style="padding: 15px 20px; text-align: right; color: ${color}; font-weight: bold; font-size: 0.95rem;">${change >= 0 ? '+' : ''}${change}%</td>
<td class="desktop-only-cell" style="padding: 15px 20px; text-align: right; color: #848e9c; font-size: 0.8rem;">
<div>H: ${parseFloat(d.h).toFixed(2)}</div>
<div>L: ${parseFloat(d.l).toFixed(2)}</div>
</td>
<td class="desktop-only-cell" style="padding: 15px 20px; text-align: right;">
<a href="spot.php?symbol=${p}" class="btn-primary" style="padding: 6px 15px; font-size: 0.8rem; border-radius: 6px; text-decoration: none;"><?php echo __('buy'); ?></a>
</td>
</tr>
`;
});
tbody.innerHTML = html;
}
</script>
<?php include 'footer.php'; ?>

View File

@ -1,50 +0,0 @@
<?php
require_once 'db/config.php';
require_once 'includes/currency_helper.php';
session_start();
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
$user_id = $_SESSION['user_id'];
$pdo = db();
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['amount'])) {
$amount = (float)$_POST['amount'];
$type = $_POST['type'] ?? 'fiat';
$currency = $_POST['currency'] ?? 'USDT';
$network = $_POST['network'] ?? '';
$fiat_rates = get_fiat_rates();
$rate = $fiat_rates[$currency] ?? 1.0;
$usdt_amount = ($rate > 0) ? ($amount / $rate) : $amount;
$expires_at = date('Y-m-d H:i:s', strtotime('+30 minutes'));
// Create order with status 'matching'
$stmt = $pdo->prepare("INSERT INTO fiat_orders (user_id, amount, usdt_amount, exchange_rate, currency, status, expires_at, created_at) VALUES (?, ?, ?, ?, ?, 'matching', ?, CURRENT_TIMESTAMP)");
$stmt->execute([$user_id, $amount, $usdt_amount, $rate, $currency, $expires_at]);
$order_id = $pdo->lastInsertId();
// Get user IP
$user_ip = $_SERVER['REMOTE_ADDR'];
if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) {
$user_ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
}
// Explicit notification message for admin/chat
$method_info = ($type === 'usdt') ? "USDT ($network)" : "法币 ($currency)";
$msg = "👉 用户发起充值,金额 $amount $currency\n订单号: #$order_id\n方式: $method_info";
$stmt = $pdo->prepare("INSERT INTO messages (user_id, sender, message) VALUES (?, 'user', ?)");
$stmt->execute([$user_id, $msg]);
// Redirect to chat
header("Location: chat.php");
exit;
} else {
header("Location: deposit.php");
exit;
}

View File

@ -1,111 +0,0 @@
<?php include 'header.php'; ?>
<main style="padding: 40px 20px; background: #0b0e11; min-height: calc(100vh - 64px);">
<div style="max-width: 1200px; margin: 0 auto;">
<a href="index.php" class="back-btn"><i class="fas fa-arrow-left"></i> Home</a>
<div style="text-align: center; margin-bottom: 60px; padding: 40px 0; background: linear-gradient(180deg, rgba(0,82,255,0.05) 0%, transparent 100%); border-radius: 30px;">
<h1 style="font-size: 3.5rem; font-weight: 800; margin-bottom: 15px; color: white;">Staking & Mining</h1>
<p style="color: var(--text-muted); font-size: 1.2rem; max-width: 700px; margin: 0 auto;">Participate in proof-of-stake and decentralized finance to earn rewards on your digital assets.</p>
</div>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 30px; margin-bottom: 60px;">
<div style="background: var(--card-bg); padding: 40px; border-radius: 24px; border: 1px solid var(--border-color); transition: 0.3s;" onmouseover="this.style.transform='translateY(-10px)'" onmouseout="this.style.transform='translateY(0)'">
<div style="width: 60px; height: 60px; background: rgba(0,82,255,0.1); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--primary-color); font-size: 28px; margin-bottom: 25px;">
<i class="fas fa-pickaxe"></i>
</div>
<h3 style="font-size: 1.5rem; margin-bottom: 15px;">Liquidity Mining</h3>
<p style="color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 25px;">Provide liquidity to automated market makers and earn a portion of the trading fees plus governance tokens.</p>
<div style="display: flex; justify-content: space-between; align-items: center; padding-top: 20px; border-top: 1px solid var(--border-color);">
<div>
<div style="color: var(--text-muted); font-size: 12px;">Est. APR</div>
<div style="font-size: 20px; font-weight: bold; color: var(--success-color);">Up to 45.8%</div>
</div>
<button class="btn-primary" style="padding: 10px 25px; border-radius: 12px;">Stake Now</button>
</div>
</div>
<div style="background: var(--card-bg); padding: 40px; border-radius: 24px; border: 1px solid var(--border-color); transition: 0.3s;" onmouseover="this.style.transform='translateY(-10px)'" onmouseout="this.style.transform='translateY(0)'">
<div style="width: 60px; height: 60px; background: rgba(14,203,129,0.1); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--success-color); font-size: 28px; margin-bottom: 25px;">
<i class="fas fa-seedling"></i>
</div>
<h3 style="font-size: 1.5rem; margin-bottom: 15px;">PoS Staking</h3>
<p style="color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 25px;">Stake your proof-of-stake assets to help secure the network and receive inflation rewards directly in your wallet.</p>
<div style="display: flex; justify-content: space-between; align-items: center; padding-top: 20px; border-top: 1px solid var(--border-color);">
<div>
<div style="color: var(--text-muted); font-size: 12px;">Est. APR</div>
<div style="font-size: 20px; font-weight: bold; color: var(--success-color);">Up to 12.5%</div>
</div>
<button class="btn-primary" style="padding: 10px 25px; border-radius: 12px;">Stake Now</button>
</div>
</div>
<div style="background: var(--card-bg); padding: 40px; border-radius: 24px; border: 1px solid var(--border-color); transition: 0.3s;" onmouseover="this.style.transform='translateY(-10px)'" onmouseout="this.style.transform='translateY(0)'">
<div style="width: 60px; height: 60px; background: rgba(240,185,11,0.1); border-radius: 16px; display: flex; align-items: center; justify-content: center; color: var(--gold-color); font-size: 28px; margin-bottom: 25px;">
<i class="fas fa-gem"></i>
</div>
<h3 style="font-size: 1.5rem; margin-bottom: 15px;">Launchpad</h3>
<p style="color: var(--text-muted); font-size: 14px; line-height: 1.6; margin-bottom: 25px;">Gain exclusive access to high-quality blockchain projects before they list on our exchange.</p>
<div style="display: flex; justify-content: space-between; align-items: center; padding-top: 20px; border-top: 1px solid var(--border-color);">
<div>
<div style="color: var(--text-muted); font-size: 12px;">Next Project</div>
<div style="font-size: 20px; font-weight: bold; color: var(--gold-color);">Coming Soon</div>
</div>
<button class="btn-primary" style="padding: 10px 25px; border-radius: 12px;">View Details</button>
</div>
</div>
</div>
<div style="background: var(--card-bg); border-radius: 30px; border: 1px solid var(--border-color); overflow: hidden;">
<div style="padding: 30px 40px; border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; align-items: center;">
<h3 style="margin: 0;">Yield Rankings</h3>
<div style="display: flex; gap: 10px;">
<button style="padding: 8px 16px; background: #2b3139; border: none; color: white; border-radius: 8px; font-size: 13px;">All</button>
<button style="padding: 8px 16px; background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); border-radius: 8px; font-size: 13px;">DeFi</button>
<button style="padding: 8px 16px; background: transparent; border: 1px solid var(--border-color); color: var(--text-muted); border-radius: 8px; font-size: 13px;">Staking</button>
</div>
</div>
<table style="width: 100%; border-collapse: collapse;">
<thead style="background: #161a1e;">
<tr>
<th style="padding: 20px 40px; text-align: left; color: var(--text-muted); font-weight: 500;">Asset</th>
<th style="padding: 20px 40px; text-align: left; color: var(--text-muted); font-weight: 500;">Est. APR</th>
<th style="padding: 20px 40px; text-align: left; color: var(--text-muted); font-weight: 500;">Duration</th>
<th style="padding: 20px 40px; text-align: right; color: var(--text-muted); font-weight: 500;">Action</th>
</tr>
</thead>
<tbody>
<?php
$mining_coins = [
['symbol' => 'USDT', 'apr' => '12.5%', 'duration' => 'Flexible'],
['symbol' => 'BTC', 'apr' => '4.2%', 'duration' => '30 Days'],
['symbol' => 'ETH', 'apr' => '5.8%', 'duration' => 'Flexible'],
['symbol' => 'SOL', 'apr' => '8.9%', 'duration' => '60 Days'],
['symbol' => 'DOT', 'apr' => '14.2%', 'duration' => '30 Days'],
];
foreach ($mining_coins as $coin):
?>
<tr style="border-bottom: 1px solid var(--border-color); transition: 0.2s;" onmouseover="this.style.background='#161a1e'" onmouseout="this.style.background='transparent'">
<td style="padding: 25px 40px;">
<div style="display: flex; align-items: center; gap: 15px;">
<img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/<?php echo strtolower($coin['symbol']); ?>.png" width="35" height="35" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<span style="font-weight: bold; font-size: 1.1rem;"><?php echo $coin['symbol']; ?></span>
</div>
</td>
<td style="padding: 25px 40px;">
<span style="color: var(--success-color); font-weight: bold; font-size: 1.1rem;"><?php echo $coin['apr']; ?></span>
</td>
<td style="padding: 25px 40px; color: var(--text-muted);"><?php echo $coin['duration']; ?></td>
<td style="padding: 25px 40px; text-align: right;">
<button class="btn-primary" style="padding: 8px 20px; border-radius: 10px;">Subscribe</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,45 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 1200px; margin: 0 auto;">
<h1 style="font-size: 3rem; font-weight: 800; margin-bottom: 50px; text-align: center;">NovaEx News & Insights</h1>
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(350px, 1fr)); gap: 40px; margin-bottom: 60px;">
<div style="grid-column: span 2; background: #161a1e; border-radius: 32px; overflow: hidden; border: 1px solid #2b3139;">
<div style="height: 400px; background: url('https://images.pexels.com/photos/6770610/pexels-photo-6770610.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1') center/cover;"></div>
<div style="padding: 40px;">
<span style="color: var(--primary-color); font-weight: bold; font-size: 0.9rem;">ANNOUNCEMENT</span>
<h2 style="font-size: 2.2rem; margin: 15px 0 20px;">NovaEx Launches Advanced Futures Trading Interface</h2>
<p style="color: var(--text-muted); line-height: 1.8; margin-bottom: 30px;">We are excited to announce the rollout of our next-generation trading engine, providing 10x faster execution and a highly customizable UI for professional traders.</p>
<a href="#" style="color: var(--primary-color); font-weight: bold; text-decoration: none;">Read More <i class="fas fa-arrow-right"></i></a>
</div>
</div>
<div style="background: #161a1e; border-radius: 24px; overflow: hidden; border: 1px solid #2b3139;">
<div style="height: 200px; background: url('https://images.pexels.com/photos/844124/pexels-photo-844124.jpeg?auto=compress&cs=tinysrgb&w=600') center/cover;"></div>
<div style="padding: 25px;">
<span style="color: #00c087; font-weight: bold; font-size: 0.8rem;">MARKET ANALYSIS</span>
<h3 style="font-size: 1.4rem; margin: 10px 0 15px;">The Rise of Layer 2 Solutions: What to Watch</h3>
<p style="color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 20px;">An in-depth look at how scaling solutions are changing the Ethereum ecosystem and what it means for investors.</p>
<a href="#" style="color: var(--primary-color); font-weight: bold; text-decoration: none; font-size: 0.9rem;">Read More</a>
</div>
</div>
<div style="background: #161a1e; border-radius: 24px; overflow: hidden; border: 1px solid #2b3139;">
<div style="height: 200px; background: url('https://images.pexels.com/photos/5980860/pexels-photo-5980860.jpeg?auto=compress&cs=tinysrgb&w=600') center/cover;"></div>
<div style="padding: 25px;">
<span style="color: #f0b90b; font-weight: bold; font-size: 0.8rem;">SECURITY</span>
<h3 style="font-size: 1.4rem; margin: 10px 0 15px;">NovaEx Completes Annual Security Audit</h3>
<p style="color: var(--text-muted); font-size: 0.9rem; line-height: 1.6; margin-bottom: 20px;">We have successfully completed our comprehensive audit with top cybersecurity firms, reinforcing our commitment to user safety.</p>
<a href="#" style="color: var(--primary-color); font-weight: bold; text-decoration: none; font-size: 0.9rem;">Read More</a>
</div>
</div>
</div>
<div style="text-align: center;">
<button class="btn-primary" style="padding: 12px 30px; border-radius: 10px;"><?php echo __('load_more', '加载更多'); ?></button>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,610 +0,0 @@
<?php
session_start();
include 'header.php';
require_once 'db/config.php';
$user_id = $_SESSION['user_id'] ?? null;
$balance = 0;
if ($user_id) {
$stmt = db()->prepare("SELECT balance FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
$balance = $user['balance'] ?? 0;
}
?>
<style>
* { box-sizing: border-box; }
:root {
--bg-color: #0b0e11;
--panel-bg: #161a1e;
--border-color: #2b3139;
--text-primary: #EAECEF;
--text-secondary: #848e9c;
--accent-color: #f0b90b;
--up-color: #00c087;
--down-color: #f6465d;
--input-bg: #1e2329;
}
body { background-color: var(--bg-color); color: var(--text-primary); font-family: 'Inter', 'PingFang SC', sans-serif; margin: 0; overflow-y: auto !important; }
.trading-layout { display: flex; gap: 1px; background: var(--border-color); padding: 0; min-height: calc(100vh - 64px); }
.panel { background: var(--panel-bg); display: flex; flex-direction: column; }
/* Market Panel */
.market-panel { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border-color); }
#pairs-list { height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: thin; }
.pair-item { display: flex; align-items: center; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); transition: 0.2s; }
.pair-item:hover { background: rgba(255,255,255,0.05); }
.pair-item.active { background: rgba(240, 185, 11, 0.08); border-left: 3px solid var(--accent-color); }
.pair-icon { width: 24px; height: 24px; margin-right: 12px; border-radius: 50%; }
/* Center Panel */
.center-panel { flex: 1; background: var(--bg-color); display: flex; flex-direction: column; min-width: 0; }
.info-bar { height: 66px; display: flex; align-items: center; padding: 0 20px; gap: 25px; border-bottom: 1px solid var(--border-color); background: var(--panel-bg); }
.chart-container { height: 550px; background: var(--bg-color); border-bottom: 1px solid var(--border-color); }
/* Option Order Panel */
.option-order-panel { padding: 20px 25px; background: var(--panel-bg); border-bottom: 1px solid var(--border-color); }
.duration-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 15px; }
.duration-item { padding: 10px 5px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; cursor: pointer; text-align: center; transition: 0.2s; position: relative; }
.duration-item:hover { border-color: rgba(240, 185, 11, 0.5); }
.duration-item.active { border-color: var(--accent-color); background: rgba(240, 185, 11, 0.1); }
.duration-item .time { font-size: 14px; font-weight: 700; color: white; display: block; }
.duration-item .profit { font-size: 11px; font-weight: 600; color: var(--accent-color); margin-top: 2px; display: block; }
.option-input-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 25px; align-items: start; }
.option-input-wrapper { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 8px; display: flex; align-items: center; padding: 10px 15px; margin-top: 6px; transition: 0.2s; }
.option-input-wrapper:focus-within { border-color: var(--accent-color); }
.option-input-wrapper input { flex: 1; background: transparent; border: none; color: white; outline: none; font-size: 18px; text-align: right; font-weight: 700; font-family: 'Roboto Mono', monospace; width: 100%; }
.action-buttons { display: flex; gap: 15px; margin-top: 20px; }
.action-btn { flex: 1; padding: 12px; border: none; border-radius: 8px; font-weight: 700; font-size: 16px; cursor: pointer; color: white; display: flex; flex-direction: column; align-items: center; gap: 4px; transition: 0.2s; text-transform: uppercase; }
.action-btn:active { transform: scale(0.98); }
.action-btn.up { background: var(--up-color); }
.action-btn.down { background: var(--down-color); }
.action-btn i { font-size: 16px; }
.action-btn span { font-size: 11px; font-weight: 500; opacity: 0.9; }
/* Order Book Panel */
.order-book-panel { width: 320px; flex-shrink: 0; border-left: 1px solid var(--border-color); display: flex; flex-direction: column; }
.ob-header { padding: 12px 16px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; font-weight: 600; }
.ob-row { display: flex; justify-content: space-between; padding: 4px 16px; font-size: 12px; position: relative; font-family: 'Roboto Mono', monospace; cursor: pointer; }
.ob-row:hover { background: rgba(255,255,255,0.05); }
.ob-vol-bar { position: absolute; top: 0; right: 0; bottom: 0; z-index: 0; opacity: 0.15; transition: width 0.3s; }
/* Countdown Modal */
.countdown-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: none; align-items: center; justify-content: center; z-index: 3000; backdrop-filter: blur(8px); }
.countdown-content { background: #1c2127; border: 1px solid var(--border-color); border-radius: 24px; width: 420px; padding: 40px; text-align: center; box-shadow: 0 25px 50px rgba(0,0,0,0.5); position: relative; overflow: hidden; }
.countdown-content::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 4px; background: linear-gradient(90deg, var(--accent-color), #ffeb3b); }
.countdown-timer-wrap { position: relative; width: 140px; height: 140px; margin: 0 auto 30px; display: flex; align-items: center; justify-content: center; }
.countdown-circle { position: absolute; top: 0; left: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.countdown-circle circle { fill: none; stroke-width: 8; stroke-linecap: round; }
.countdown-circle .bg { stroke: rgba(255,255,255,0.05); }
.countdown-circle .progress { stroke: var(--accent-color); stroke-dasharray: 414; stroke-dashoffset: 0; transition: stroke-dashoffset 1s linear; }
#countdown-number { font-size: 48px; font-weight: 900; color: white; font-family: 'Roboto Mono'; }
.modal-pair { font-size: 20px; font-weight: 800; margin-bottom: 5px; }
.modal-dir { font-size: 14px; font-weight: 700; margin-bottom: 20px; text-transform: uppercase; }
.modal-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; background: rgba(255,255,255,0.03); padding: 20px; border-radius: 16px; margin-bottom: 25px; border: 1px solid rgba(255,255,255,0.05); }
.modal-info-item { text-align: left; }
.modal-info-label { font-size: 11px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; font-weight: 700; }
.modal-info-value { font-size: 15px; font-weight: 700; color: white; margin-top: 3px; }
.modal-tips { font-size: 12px; color: var(--text-secondary); line-height: 1.6; font-style: italic; }
/* Settlement Result Modal */
.result-modal { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.9); display: none; align-items: center; justify-content: center; z-index: 3100; backdrop-filter: blur(10px); }
.result-content { background: #1c2127; border-radius: 24px; width: 380px; padding: 40px; text-align: center; border: 1px solid var(--border-color); animation: resultPop 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes resultPop { from { transform: scale(0.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.result-icon { width: 80px; height: 80px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 25px; font-size: 40px; color: white; }
.result-icon.win { background: linear-gradient(135deg, #00c087, #00d2ff); box-shadow: 0 10px 30px rgba(0,192,135,0.4); }
.result-icon.loss { background: linear-gradient(135deg, #f6465d, #ff9a9e); box-shadow: 0 10px 30px rgba(246,70,93,0.4); }
.result-title { font-size: 28px; font-weight: 900; margin-bottom: 10px; }
.result-pnl { font-size: 32px; font-weight: 900; margin-bottom: 30px; font-family: 'Roboto Mono'; }
.result-close { width: 100%; padding: 14px; border: none; border-radius: 12px; background: var(--accent-color); color: #000; font-weight: 800; cursor: pointer; font-size: 16px; }
/* Responsive */
@media (max-width: 1400px) {
.market-panel { width: 260px; }
.order-book-panel { width: 280px; }
}
@media (max-width: 1200px) {
.market-panel { display: none; }
}
@media (max-width: 992px) {
.trading-layout { flex-direction: column; }
.order-book-panel { width: 100%; border-left: none; border-top: 1px solid var(--border-color); }
.chart-container { height: 400px; }
.option-input-grid { grid-template-columns: 1fr; }
.info-bar { height: auto; padding: 15px; flex-wrap: wrap; gap: 15px; }
}
</style>
<div class="trading-layout">
<!-- Left Panel (Market Pairs) -->
<div class="panel market-panel">
<div style="padding: 15px; border-bottom: 1px solid var(--border-color);">
<div style="position: relative;">
<i class="fas fa-search" style="position: absolute; left: 12px; top: 12px; color: var(--text-secondary); font-size: 14px;"></i>
<input type="text" id="market-search" placeholder="<?php echo __('search_pair'); ?>" style="width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 10px 12px 10px 35px; border-radius: 8px; font-size: 13px; outline: none;">
</div>
</div>
<div id="pairs-list"></div>
</div>
<!-- Center Panel -->
<div class="panel center-panel">
<div class="info-bar">
<div style="display: flex; align-items: center; gap: 12px;">
<img id="current-logo" src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/btc.png" width="32" height="32" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<span id="current-pair-display" style="font-size: 20px; font-weight: 800; letter-spacing: -0.5px;">BTC/USDT</span>
</div>
<div style="display: flex; flex-direction: column;">
<span id="last-price" style="font-size: 18px; font-weight: 700; color: var(--up-color); font-family: 'Roboto Mono', monospace;">--</span>
<span id="price-change" style="font-size: 12px; color: var(--up-color); font-weight: 600;">--</span>
</div>
<div style="display: flex; gap: 30px; margin-left: auto; font-size: 12px;" class="desktop-only">
<div style="color: var(--text-secondary);">24h High <span id="high-24h" style="color: white; display: block; margin-top: 4px; font-weight: 600;">--</span></div>
<div style="color: var(--text-secondary);">24h Low <span id="low-24h" style="color: white; display: block; margin-top: 4px; font-weight: 600;">--</span></div>
<div style="color: var(--text-secondary);">24h Vol <span id="vol-24h" style="color: white; display: block; margin-top: 4px; font-weight: 600;">--</span></div>
</div>
</div>
<div class="chart-container">
<div id="tv_chart_container" style="height: 100%;"></div>
</div>
<div class="center-content">
<div class="option-order-panel">
<div style="color: var(--text-secondary); font-size: 12px; margin-bottom: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px;"><?php echo __('settlement_time'); ?></div>
<div class="duration-list">
<div class="duration-item active" data-seconds="60" data-profit="8">
<span class="time">60S</span>
<span class="profit"><?php echo __('profit'); ?> 8%</span>
</div>
<div class="duration-item" data-seconds="90" data-profit="12">
<span class="time">90S</span>
<span class="profit"><?php echo __('profit'); ?> 12%</span>
</div>
<div class="duration-item" data-seconds="120" data-profit="20">
<span class="time">120S</span>
<span class="profit"><?php echo __('profit'); ?> 20%</span>
</div>
<div class="duration-item" data-seconds="180" data-profit="20">
<span class="time">180S</span>
<span class="profit"><?php echo __('profit'); ?> 20%</span>
</div>
<div class="duration-item" data-seconds="300" data-profit="32">
<span class="time">300S</span>
<span class="profit"><?php echo __('profit'); ?> 32%</span>
</div>
</div>
<div class="option-input-grid">
<div>
<div style="font-size: 12px; color: var(--text-secondary); font-weight: 700; margin-bottom: 8px;">
<span><?php echo __('buy_amount'); ?></span>
</div>
<div class="option-input-wrapper">
<input type="number" id="order-amount" placeholder="<?php echo __('min_order'); ?> 10" oninput="calculateExpectedProfit()">
<span style="color: var(--text-secondary); margin-left: 10px; font-size: 14px; font-weight: 700;">USDT</span>
</div>
</div>
<div>
<div style="background: rgba(255,255,255,0.02); padding: 12px 18px; border-radius: 8px; border: 1px solid var(--border-color); height: 50px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px;">
<span style="color: var(--text-secondary); font-size: 12px; font-weight: 600;"><?php echo __('expected_profit'); ?>:</span>
<span id="expected-profit-display" style="color: var(--accent-color); font-weight: 800; font-size: 16px; font-family: 'Roboto Mono';">0.00 USDT</span>
</div>
<div style="display: flex; justify-content: space-between; align-items: center; padding: 0 5px;">
<span style="color: var(--text-secondary); font-size: 12px; font-weight: 600;"><?php echo __('available'); ?>:</span>
<span style="color: var(--accent-color); font-weight: 800; font-size: 16px;"><span id="user-balance"><?php echo number_format($balance, 2); ?></span> USDT</span>
</div>
</div>
</div>
<div class="action-buttons">
<button class="action-btn up" onclick="placeOptionOrder('up')">
<i class="fas fa-arrow-up"></i>
<?php echo __('buy_up'); ?>
<span id="up-profit-text"><?php echo __('profit'); ?> 8%</span>
</button>
<button class="action-btn down" onclick="placeOptionOrder('down')">
<i class="fas fa-arrow-down"></i>
<?php echo __('buy_down'); ?>
<span id="down-profit-text"><?php echo __('profit'); ?> 8%</span>
</button>
</div>
</div>
<div style="padding: 20px; background: var(--panel-bg); margin-bottom: 20px;">
<div style="display: flex; gap: 20px; border-bottom: 1px solid var(--border-color); margin-bottom: 15px;">
<button class="tab-btn active" onclick="switchTab(this, 'pending')" style="background: none; border: none; color: var(--accent-color); padding: 12px 0; border-bottom: 2px solid var(--accent-color); font-size: 14px; font-weight: 700; cursor: pointer;"><?php echo __('in_progress'); ?></button>
<button class="tab-btn" onclick="switchTab(this, 'completed')" style="background: none; border: none; color: var(--text-secondary); padding: 12px 0; font-size: 14px; font-weight: 700; cursor: pointer;"><?php echo __('settled'); ?></button>
</div>
<div style="overflow-x: auto;">
<table style="width: 100%; border-collapse: collapse; min-width: 800px; font-size: 13px;">
<thead style="color: var(--text-secondary); text-align: left; background: rgba(255,255,255,0.01);">
<tr>
<th style="padding: 12px 10px;"><?php echo __('time'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('pair'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('direction'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('amount'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('opening_price'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('closing_price'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('status'); ?></th>
<th style="padding: 12px 10px; text-align: right;"><?php echo __('pnl'); ?></th>
</tr>
</thead>
<tbody id="orders-tbody"></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Right Panel (Order Book) -->
<div class="panel order-book-panel">
<div class="ob-header">
<span>Price(USDT)</span>
<span>Amount(<span class="asset-name">BTC</span>)</span>
</div>
<div id="asks-list" style="display: flex; flex-direction: column-reverse; flex: 1; overflow: hidden;"></div>
<div style="padding: 15px; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); text-align: center; background: rgba(255,255,255,0.01);">
<div id="ob-mid-price" style="font-size: 18px; font-weight: 800; font-family: 'Roboto Mono', monospace;">--</div>
</div>
<div id="bids-list" style="flex: 1; overflow: hidden;"></div>
</div>
</div>
<!-- Countdown Modal -->
<div class="countdown-modal" id="order-modal">
<div class="countdown-content">
<div class="countdown-timer-wrap">
<svg class="countdown-circle">
<circle class="bg" cx="70" cy="70" r="66"></circle>
<circle class="progress" id="progress-circle" cx="70" cy="70" r="66"></circle>
</svg>
<div id="countdown-number">60</div>
</div>
<div class="modal-pair" id="modal-pair-text">BTC/USDT</div>
<div class="modal-dir" id="modal-dir-text">BUY UP</div>
<div class="modal-info-grid">
<div class="modal-info-item">
<div class="modal-info-label"><?php echo __('opening_price'); ?></div>
<div class="modal-info-value" id="modal-open-price">--</div>
</div>
<div class="modal-info-item">
<div class="modal-info-label"><?php echo __('amount'); ?></div>
<div class="modal-info-value" id="modal-amount">0.00 USDT</div>
</div>
<div class="modal-info-item">
<div class="modal-info-label"><?php echo __('current_price'); ?></div>
<div class="modal-info-value" id="modal-curr-price" style="color: var(--accent-color);">--</div>
</div>
<div class="modal-info-item">
<div class="modal-info-label"><?php echo __('expected_profit'); ?></div>
<div class="modal-info-value" id="modal-expected" style="color: var(--up-color);">0.00 USDT</div>
</div>
</div>
<div class="modal-tips">
<?php echo __('order_processing_tip'); ?>: <?php echo __('market_volatility_notice'); ?>
</div>
</div>
</div>
<!-- Settlement Result Modal -->
<div class="result-modal" id="result-modal">
<div class="result-content">
<div class="result-icon" id="result-icon">
<i class="fas fa-check"></i>
</div>
<div class="result-title" id="result-title">CONGRATULATIONS!</div>
<div style="color: var(--text-secondary); font-size: 14px; margin-bottom: 20px;"><?php echo __('settlement_complete'); ?></div>
<div class="result-pnl" id="result-pnl">+0.00 USDT</div>
<button class="result-close" onclick="closeResult()"><?php echo __('confirm'); ?></button>
</div>
</div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script>
let currentPair = 'BTCUSDT';
let currentPrice = 0;
let selectedDuration = 60;
let selectedProfit = 0.08;
let marketData = {};
let activeTab = 'pending';
let countdownInterval;
let currentOrderId = null;
const lang = '<?php echo $lang; ?>';
const pairs = [
'BTCUSDT', 'ETHUSDT', 'BNBUSDT', 'SOLUSDT', 'XRPUSDT', 'ADAUSDT', 'AVAXUSDT', 'DOGEUSDT', 'DOTUSDT', 'LINKUSDT',
'MATICUSDT', 'NEARUSDT', 'LTCUSDT', 'ATOMUSDT', 'UNIUSDT', 'XLMUSDT', 'ALGOUSDT', 'TRXUSDT', 'BCHUSDT', 'SHIBUSDT'
];
function initChart(symbol) {
new TradingView.widget({
"width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "1", "theme": "dark", "style": "1", "locale": lang === 'zh' ? 'zh_CN' : 'en', "container_id": "tv_chart_container", "backgroundColor": "#0b0e11", "hide_side_toolbar": true, "allow_symbol_change": false, "save_image": false
});
}
initChart(currentPair);
let ws;
function connectWS() {
const streams = pairs.map(p => p.toLowerCase() + '@ticker').join('/');
ws = new WebSocket(`wss://stream.binance.com:9443/ws/${streams}`);
ws.onmessage = (e) => {
const data = JSON.parse(e.data);
marketData[data.s] = data;
renderPairs();
if (data.s === currentPair) updateUI(data);
};
}
connectWS();
function updateUI(data) {
currentPrice = parseFloat(data.c);
document.getElementById('last-price').innerText = currentPrice.toLocaleString();
document.getElementById('last-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('price-change').innerText = (data.P >= 0 ? '+' : '') + data.P + '%';
document.getElementById('price-change').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('high-24h').innerText = parseFloat(data.h).toLocaleString();
document.getElementById('low-24h').innerText = parseFloat(data.l).toLocaleString();
document.getElementById('vol-24h').innerText = parseFloat(data.v).toLocaleString();
document.getElementById('ob-mid-price').innerText = currentPrice.toLocaleString();
document.getElementById('ob-mid-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
if (document.getElementById('order-modal').style.display === 'flex') {
document.getElementById('modal-curr-price').innerText = currentPrice.toLocaleString();
const openPrice = parseFloat(document.getElementById('modal-open-price').innerText.replace(/,/g, ''));
const dir = document.getElementById('modal-dir-text').innerText.toLowerCase();
const isWin = (dir.includes('up') && currentPrice > openPrice) || (dir.includes('down') && currentPrice < openPrice);
document.getElementById('modal-curr-price').style.color = isWin ? 'var(--up-color)' : 'var(--down-color)';
}
updateOrderBook();
}
function renderPairs() {
const list = document.getElementById('pairs-list');
if (!list) return;
let html = '';
pairs.forEach(p => {
const d = marketData[p] || {c: 0, P: 0, v: 0};
const name = p.replace('USDT', '');
const icon = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png`;
html += `
<div class="pair-item ${currentPair === p ? 'active' : ''}" onclick="switchPair('${p}')">
<img src="${icon}" class="pair-icon" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div style="flex: 1;">
<div style="font-weight: 700; font-size: 14px;">${name}/USDT</div>
<div style="font-size: 11px; color: var(--text-secondary);">Vol ${parseFloat(d.v).toLocaleString()}</div>
</div>
<div style="text-align: right;">
<div style="font-weight: 600; font-family: 'Roboto Mono', monospace; font-size: 13px;">${parseFloat(d.c).toLocaleString()}</div>
<div style="color: ${d.P >= 0 ? 'var(--up-color)' : 'var(--down-color)'}; font-size: 11px; font-weight: 600;">${(d.P >= 0 ? '+' : '') + d.P}%</div>
</div>
</div>
`;
});
list.innerHTML = html;
}
function switchPair(p) {
if (currentPair === p) return;
currentPair = p;
const name = p.replace('USDT', '');
document.getElementById('current-pair-display').innerText = name + '/USDT';
document.getElementById('current-logo').src = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png`;
document.querySelectorAll('.asset-name').forEach(el => el.innerText = name);
initChart(p);
}
function updateOrderBook() {
const asks = document.getElementById('asks-list');
const bids = document.getElementById('bids-list');
if (!asks || !bids) return;
let asksHtml = ''; let bidsHtml = '';
let maxVol = 0;
const rows = 15;
const askData = []; const bidData = [];
for(let i=0; i<rows; i++) {
const av = Math.random() * 2 + 0.1; const bv = Math.random() * 2 + 0.1;
askData.push(av); bidData.push(bv); maxVol = Math.max(maxVol, av, bv);
}
for(let i=0; i<rows; i++) {
const ap = currentPrice * (1 + (i+1)*0.0002); const bp = currentPrice * (1 - (i+1)*0.0002);
const av = askData[i]; const bv = bidData[i];
asksHtml += `
<div class="ob-row">
<div class="ob-vol-bar" style="width: ${(av/maxVol*100)}%; background: var(--down-color);"></div>
<span style="color: var(--down-color); font-weight: 600; z-index: 1;">${ap.toFixed(2)}</span>
<span style="color: white; opacity: 0.9; z-index: 1;">${av.toFixed(4)}</span>
</div>`;
bidsHtml += `
<div class="ob-row">
<div class="ob-vol-bar" style="width: ${(bv/maxVol*100)}%; background: var(--up-color);"></div>
<span style="color: var(--up-color); font-weight: 600; z-index: 1;">${bp.toFixed(2)}</span>
<span style="color: white; opacity: 0.9; z-index: 1;">${bv.toFixed(4)}</span>
</div>`;
}
asks.innerHTML = asksHtml; bids.innerHTML = bidsHtml;
}
document.querySelectorAll('.duration-item').forEach(item => {
item.addEventListener('click', function() {
document.querySelectorAll('.duration-item').forEach(i => i.classList.remove('active'));
this.classList.add('active');
selectedDuration = parseInt(this.dataset.seconds);
selectedProfit = parseInt(this.dataset.profit) / 100;
document.getElementById('up-profit-text').innerText = `${lang === 'zh' ? '收益' : 'Profit'} ${this.dataset.profit}%`;
document.getElementById('down-profit-text').innerText = `${lang === 'zh' ? '收益' : 'Profit'} ${this.dataset.profit}%`;
calculateExpectedProfit();
});
});
function calculateExpectedProfit() {
const amount = parseFloat(document.getElementById('order-amount').value) || 0;
const profit = amount * selectedProfit;
document.getElementById('expected-profit-display').innerText = `${profit.toFixed(2)} USDT`;
}
async function placeOptionOrder(direction) {
const amount = parseFloat(document.getElementById('order-amount').value);
if (!amount || amount <= 0) return alert(lang === 'zh' ? '请输入有效金额' : 'Please enter a valid amount');
if (currentPrice <= 0) return alert(lang === 'zh' ? '正在获取价格,请稍后' : 'Fetching price, please wait');
const resp = await fetch('api/place_option_order.php', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
symbol: currentPair,
amount: amount,
direction: direction,
duration: selectedDuration,
opening_price: currentPrice
})
});
const res = await resp.json();
if (res.success) {
currentOrderId = res.order_id;
document.getElementById('user-balance').innerText = res.new_balance.toFixed(2);
showCountdownModal(direction, amount, currentPrice, selectedDuration);
fetchOrders();
} else {
alert(res.error);
}
}
function showCountdownModal(dir, amount, price, duration) {
const modal = document.getElementById('order-modal');
document.getElementById('modal-pair-text').innerText = currentPair.replace('USDT', '/USDT');
document.getElementById('modal-dir-text').innerText = (dir === 'up' ? (lang === 'zh' ? '买涨' : 'BUY UP') : (lang === 'zh' ? '买跌' : 'BUY DOWN'));
document.getElementById('modal-dir-text').style.color = dir === 'up' ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('modal-open-price').innerText = price.toLocaleString();
document.getElementById('modal-amount').innerText = amount.toFixed(2) + ' USDT';
document.getElementById('modal-expected').innerText = (amount * selectedProfit).toFixed(2) + ' USDT';
document.getElementById('modal-curr-price').innerText = price.toLocaleString();
const num = document.getElementById('countdown-number');
const progress = document.getElementById('progress-circle');
let timeLeft = duration;
num.innerText = timeLeft;
modal.style.display = 'flex';
const totalOffset = 414;
progress.style.strokeDashoffset = 0;
if (countdownInterval) clearInterval(countdownInterval);
countdownInterval = setInterval(() => {
timeLeft--;
num.innerText = timeLeft;
const offset = totalOffset - (timeLeft / duration) * totalOffset;
progress.style.strokeDashoffset = offset;
if (timeLeft <= 0) {
clearInterval(countdownInterval);
checkResult();
}
}, 1000);
}
async function checkResult() {
const resp = await fetch(`api/get_option_orders.php?status=completed&limit=1`);
const res = await resp.json();
document.getElementById('order-modal').style.display = 'none';
if (res.success && res.data.length > 0) {
const order = res.data[0];
const isWin = parseFloat(order.profit) > 0;
const resultModal = document.getElementById('result-modal');
const icon = document.getElementById('result-icon');
const title = document.getElementById('result-title');
const pnl = document.getElementById('result-pnl');
icon.className = 'result-icon ' + (isWin ? 'win' : 'loss');
icon.innerHTML = isWin ? '<i class="fas fa-trophy"></i>' : '<i class="fas fa-times"></i>';
title.innerText = isWin ? (lang === 'zh' ? '恭喜获利' : 'CONGRATULATIONS!') : (lang === 'zh' ? '结算完成' : 'SETTLED');
title.style.color = isWin ? 'var(--up-color)' : 'var(--text-primary)';
pnl.innerText = (isWin ? '+' : '') + parseFloat(order.profit).toFixed(2) + ' USDT';
pnl.style.color = isWin ? 'var(--up-color)' : 'var(--down-color)';
resultModal.style.display = 'flex';
fetchOrders();
// Refresh balance
const bResp = await fetch('api/get_assets.php');
const bRes = await bResp.json();
if (bRes.success) {
const usdt = bRes.data.find(a => a.symbol === 'USDT');
if (usdt) document.getElementById('user-balance').innerText = parseFloat(usdt.amount).toFixed(2);
}
}
}
function closeResult() {
document.getElementById('result-modal').style.display = 'none';
}
async function fetchOrders() {
const resp = await fetch(`api/get_option_orders.php?status=${activeTab}`);
const res = await resp.json();
const tbody = document.getElementById('orders-tbody');
if (res.success && res.data.length > 0) {
tbody.innerHTML = res.data.map(o => `
<tr style="border-bottom: 1px solid var(--border-color);">
<td style="padding: 12px 10px;">${o.created_at}</td>
<td style="padding: 12px 10px; font-weight: 700;">${o.symbol}</td>
<td style="padding: 12px 10px; color: ${o.direction === 'up' ? 'var(--up-color)' : 'var(--down-color)'}; font-weight: 700; text-transform: uppercase;">${o.direction === 'up' ? (lang === 'zh' ? '买涨' : 'UP') : (lang === 'zh' ? '买跌' : 'DOWN')}</td>
<td style="padding: 12px 10px;">${parseFloat(o.amount).toFixed(2)}</td>
<td style="padding: 12px 10px; font-family: 'Roboto Mono';">${parseFloat(o.opening_price).toLocaleString()}</td>
<td style="padding: 12px 10px; font-family: 'Roboto Mono';">${o.closing_price ? parseFloat(o.closing_price).toLocaleString() : '--'}</td>
<td style="padding: 12px 10px;"><span style="background: rgba(255,255,255,0.05); padding: 3px 8px; border-radius: 4px; font-size: 11px;">${o.status === 'pending' ? (lang === 'zh' ? '进行中' : 'pending') : (lang === 'zh' ? '已结算' : 'settled')}</span></td>
<td style="padding: 12px 10px; text-align: right; color: ${o.profit > 0 ? 'var(--up-color)' : (o.profit < 0 ? 'var(--down-color)' : 'white')}; font-weight: 700;">
${o.status === 'completed' ? (o.profit > 0 ? '+' : '') + parseFloat(o.profit).toFixed(2) : '--'}
</td>
</tr>
`).join('');
} else {
tbody.innerHTML = `<tr><td colspan="8" style="text-align: center; padding: 40px; color: var(--text-secondary);"><?php echo __('no_records'); ?></td></tr>`;
}
}
function switchTab(btn, tab) {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
btn.style.borderBottom = '2px solid var(--accent-color)';
btn.style.color = 'var(--accent-color)';
document.querySelectorAll('.tab-btn').forEach(b => {
if (b !== btn) {
b.style.borderBottom = 'none';
b.style.color = 'var(--text-secondary)';
}
});
activeTab = tab;
fetchOrders();
}
document.getElementById('market-search').addEventListener('input', function(e) {
const q = e.target.value.toUpperCase();
document.querySelectorAll('.pair-item').forEach(item => {
const text = item.querySelector('div div').innerText;
item.style.display = text.includes(q) ? 'flex' : 'none';
});
});
fetchOrders();
setInterval(fetchOrders, 3000);
</script>
<?php include 'footer.php'; ?>

View File

@ -1,52 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 900px; margin: 0 auto; background: #161a1e; padding: 60px; border-radius: 32px; border: 1px solid #2b3139;">
<h1 style="font-size: 2.5rem; margin-bottom: 20px;">Legal & Privacy Policy</h1>
<p style="color: var(--text-muted); margin-bottom: 40px;">Last Updated: February 2026</p>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px; color: #4facfe;">1. Introduction</h2>
<p style="color: var(--text-muted); line-height: 1.8;">NovaEx ("we", "our", or "us") is committed to protecting your privacy. This Privacy Policy explains how we collect, use, disclose, and safeguard your information when you visit our website or use our services.</p>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px; color: #4facfe;">2. Information We Collect</h2>
<p style="color: var(--text-muted); line-height: 1.8;">We collect information that you provide directly to us, such as when you create an account, verify your identity (KYC), or contact support. This includes:</p>
<ul style="color: var(--text-muted); line-height: 1.8; margin-top: 15px;">
<li>Personal identifiers (Name, Email, Phone Number)</li>
<li>Identity documentation (Passport, ID Card, Driver's License)</li>
<li>Financial information (Wallet addresses, Transaction history)</li>
<li>Technical data (IP address, Browser type, Device info)</li>
</ul>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px; color: #4facfe;">3. How We Use Your Information</h2>
<p style="color: var(--text-muted); line-height: 1.8;">We use your information to provide and improve our services, including:</p>
<ul style="color: var(--text-muted); line-height: 1.8; margin-top: 15px;">
<li>Processing transactions and managing your account</li>
<li>Complying with legal and regulatory requirements (AML/KYC)</li>
<li>Detecting and preventing fraudulent activities</li>
<li>Communicating with you about updates and promotions</li>
</ul>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px; color: #4facfe;">4. Data Security</h2>
<p style="color: var(--text-muted); line-height: 1.8;">We implement robust security measures to protect your data, including end-to-end encryption, multi-factor authentication, and secure cold storage for digital assets. However, no method of transmission over the internet is 100% secure.</p>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.8rem; margin-bottom: 20px; color: #4facfe;">5. Your Rights</h2>
<p style="color: var(--text-muted); line-height: 1.8;">Depending on your location, you may have rights regarding your personal data, including the right to access, correct, or delete your information. Contact our privacy team at privacy@novaex.com for assistance.</p>
</section>
<div style="margin-top: 60px; padding-top: 40px; border-top: 1px solid #2b3139; text-align: center;">
<p style="color: var(--text-muted);">If you have any questions about this policy, please contact us.</p>
<a href="request.php" class="btn-primary" style="margin-top: 20px; display: inline-block;">Submit a Privacy Request</a>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,251 +0,0 @@
<?php
session_start();
include 'header.php';
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once 'db/config.php';
$db = db();
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$kyc_status = $user['kyc_status'] ?? 0;
$kyc_labels = [
0 => __('kyc_none', '未认证'),
1 => __('kyc_pending', '审核中'),
2 => __('kyc_approved', '已认证'),
3 => __('kyc_rejected', '未通过'),
];
$kyc_colors = [0 => '#888', 1 => '#f0b90b', 2 => 'var(--success-color)', 3 => 'var(--danger-color)'];
?>
<style>
.profile-tabs { display: flex; gap: 30px; border-bottom: 1px solid var(--border-color); margin-bottom: 25px; overflow-x: auto; white-space: nowrap; }
.profile-tab-btn { background: none; border: none; color: var(--text-muted); padding: 10px 0; font-size: 1rem; font-weight: 600; cursor: pointer; border-bottom: 2px solid transparent; }
.profile-tab-btn.active { color: white; border-bottom-color: var(--primary-color); }
.record-item { padding: 15px; background: rgba(255,255,255,0.02); border-radius: 12px; border: 1px solid var(--border-color); margin-bottom: 10px; }
.profile-grid { display: grid; grid-template-columns: 350px 1fr; gap: 30px; }
.balance-amount { font-size: 3rem; font-weight: bold; letter-spacing: -1px; color: white; line-height: 1.2; }
@media (max-width: 992px) {
.profile-grid { grid-template-columns: 1fr; gap: 20px; }
.balance-amount { font-size: 2.2rem; }
.profile-header-actions { flex-direction: column; gap: 10px !important; width: 100%; }
.profile-header-actions a { width: 100%; justify-content: center; }
.profile-main-card { padding: 25px !important; border-radius: 16px !important; }
}
</style>
<main style="padding: 20px 0; background: #0b0e11; min-height: 100vh;">
<div class="container">
<div style="margin-bottom: 20px;">
<a href="index.php" class="back-btn" style="margin: 0;"><i class="fas fa-arrow-left"></i> <?php echo __('nav_home'); ?></a>
</div>
<div class="profile-grid">
<!-- Left Panel -->
<div class="profile-sidebar-panel">
<div style="background: var(--card-bg); padding: 30px; border-radius: 20px; border: 1px solid var(--border-color); text-align: center;">
<div style="width: 80px; height: 80px; background: linear-gradient(135deg, #4facfe, #00f2fe); border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 15px; font-size: 2rem; font-weight: bold; color: white; box-shadow: 0 10px 20px rgba(79,172,254,0.2);">
<?php echo strtoupper(substr($user['username'], 0, 1)); ?>
</div>
<h2 style="margin-bottom: 5px; color: white; font-size: 1.5rem;"><?php echo $user['username']; ?></h2>
<div style="background: rgba(255,255,255,0.05); display: inline-block; padding: 4px 12px; border-radius: 20px; color: var(--text-muted); font-size: 0.8rem; margin-bottom: 20px;">UID: <?php echo $user['uid'] ?: '618120'; ?></div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 10px; padding-top: 20px; border-top: 1px solid var(--border-color);">
<div>
<div style="color: var(--text-muted); font-size: 0.75rem; margin-bottom: 3px;"><?php echo __('credit_score', '信用分'); ?></div>
<div style="font-weight: bold; font-size: 1.1rem; color: var(--success-color);"><?php echo $user['credit_score'] ?? 100; ?></div>
</div>
<div style="border-left: 1px solid var(--border-color);">
<div style="color: var(--text-muted); font-size: 0.75rem; margin-bottom: 3px;"><?php echo __('level', '等级'); ?></div>
<div style="font-weight: bold; font-size: 1.1rem; color: #f0b90b;">VIP 0</div>
</div>
</div>
</div>
<div style="margin-top: 20px; display: flex; flex-direction: column; gap: 12px;">
<div style="background: var(--card-bg); padding: 18px; border-radius: 16px; border: 1px solid var(--border-color);">
<a href="kyc.php" style="display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: white;">
<div style="display: flex; align-items: center; gap: 12px;">
<div style="width: 36px; height: 36px; background: rgba(79,172,254,0.1); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--primary-color);">
<i class="fas fa-id-card"></i>
</div>
<span style="font-weight: 500; font-size: 0.95rem;"><?php echo __('kyc_status'); ?></span>
</div>
<span style="font-size: 0.8rem; font-weight: bold; color: <?php echo $kyc_colors[$kyc_status]; ?>"><?php echo $kyc_labels[$kyc_status]; ?> <i class="fas fa-chevron-right" style="margin-left: 5px; font-size: 10px;"></i></span>
</a>
</div>
<div style="background: var(--card-bg); padding: 18px; border-radius: 16px; border: 1px solid var(--border-color);">
<a href="security.php" style="display: flex; align-items: center; justify-content: space-between; text-decoration: none; color: white;">
<div style="display: flex; align-items: center; gap: 12px;">
<div style="width: 36px; height: 36px; background: rgba(14,203,129,0.1); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--success-color);">
<i class="fas fa-shield-alt"></i>
</div>
<span style="font-weight: 500; font-size: 0.95rem;"><?php echo __('security_settings'); ?></span>
</div>
<i class="fas fa-chevron-right" style="color: var(--text-muted); font-size: 10px;"></i>
</a>
</div>
</div>
</div>
<!-- Right Panel -->
<div class="profile-main-card" style="background: var(--card-bg); padding: 40px; border-radius: 24px; border: 1px solid var(--border-color);">
<div style="display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 35px; flex-wrap: wrap; gap: 20px;">
<div>
<div style="color: var(--text-muted); margin-bottom: 8px; font-size: 13px;"><?php echo __('total_balance'); ?> (USDT)</div>
<div class="balance-amount">
<?php echo number_format($user['balance'] ?? 0, 2); ?>
</div>
<div style="color: var(--text-muted); font-size: 0.9rem; margin-top: 5px;"> $ <?php echo number_format($user['balance'] ?? 0, 2); ?></div>
</div>
<div class="profile-header-actions" style="display: flex; gap: 12px;">
<a href="deposit.php" class="btn-primary" style="padding: 10px 25px; border-radius: 8px; font-weight: bold; font-size: 0.9rem;"><i class="fas fa-arrow-down" style="margin-right: 8px;"></i> <?php echo __('nav_deposit'); ?></a>
<a href="withdraw.php" class="btn-primary" style="background: #2b3139; padding: 10px 25px; border-radius: 8px; font-weight: bold; font-size: 0.9rem;"><i class="fas fa-arrow-up" style="margin-right: 8px;"></i> <?php echo __('nav_withdraw'); ?></a>
</div>
</div>
<div class="profile-tabs">
<button class="profile-tab-btn active" onclick="switchProfileTab(this, 'assets-tab')"><?php echo __('asset_details'); ?></button>
<button class="profile-tab-btn" onclick="switchProfileTab(this, 'records-tab')"><?php echo __('transaction_records'); ?></button>
</div>
<!-- Assets Tab -->
<div id="assets-tab" class="tab-content">
<div style="display: flex; flex-direction: column; gap: 10px;">
<?php
$coins = [
['symbol' => 'USDT', 'name' => 'Tether', 'balance' => $user['balance'] ?? 0, 'price' => 1.00],
['symbol' => 'BTC', 'name' => 'Bitcoin', 'balance' => 0.0000, 'price' => 0],
['symbol' => 'ETH', 'name' => 'Ethereum', 'balance' => 0.0000, 'price' => 0],
['symbol' => 'SOL', 'name' => 'Solana', 'balance' => 0.0000, 'price' => 0],
['symbol' => 'BNB', 'name' => 'Binance Coin', 'balance' => 0.0000, 'price' => 0],
];
// Fetch real user assets if table exists
try {
$asset_stmt = $db->prepare("SELECT * FROM user_assets WHERE user_id = ?");
$asset_stmt->execute([$_SESSION['user_id']]);
$db_assets = $asset_stmt->fetchAll();
foreach ($db_assets as $da) {
$found = false;
foreach ($coins as &$c) {
if ($c['symbol'] === $da['symbol']) {
$c['balance'] = $da['amount'];
$found = true;
}
}
if (!$found) {
$coins[] = ['symbol' => $da['symbol'], 'name' => '', 'balance' => $da['amount'], 'price' => 0];
}
}
} catch (Exception $e) {}
foreach ($coins as $coin):
?>
<div style="display: flex; align-items: center; justify-content: space-between; padding: 15px; background: rgba(255,255,255,0.02); border-radius: 14px; border: 1px solid transparent;">
<div style="display: flex; align-items: center; gap: 12px;">
<img src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/<?php echo strtolower($coin['symbol']); ?>.png" width="32" height="32" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div>
<div style="font-weight: bold; font-size: 1rem; color: white;"><?php echo $coin['symbol']; ?></div>
<div style="font-size: 0.75rem; color: var(--text-muted);"><?php echo $coin['name']; ?></div>
</div>
</div>
<div style="text-align: right;">
<div style="font-weight: bold; font-family: monospace; font-size: 1rem; color: white;"><?php echo number_format($coin['balance'], $coin['symbol'] === 'USDT' ? 2 : 6); ?></div>
<div style="font-size: 0.75rem; color: var(--text-muted);">USDT</div>
</div>
</div>
<?php endforeach; ?>
</div>
</div>
<!-- Records Tab -->
<div id="records-tab" class="tab-content" style="display: none;">
<div id="records-list">
<div style="text-align: center; padding: 40px; color: var(--text-muted);">加载中...</div>
</div>
</div>
</div>
</div>
</div>
</main>
<script>
function switchProfileTab(btn, tabId) {
document.querySelectorAll('.profile-tab-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
document.querySelectorAll('.tab-content').forEach(c => c.style.display = 'none');
document.getElementById(tabId).style.display = 'block';
if (tabId === 'records-tab') {
loadTransactionRecords();
}
}
async function loadTransactionRecords() {
const container = document.getElementById('records-list');
try {
const [spotResp, futuresResp] = await Promise.all([
fetch('api/get_orders.php?type=spot&status=history'),
fetch('api/get_orders.php?type=futures&status=history')
]);
const spotRes = await spotResp.json();
const futuresRes = await futuresResp.json();
let allRecords = [];
if (spotRes.success) {
spotRes.data.forEach(r => { r.trade_type = '现货'; allRecords.push(r); });
}
if (futuresRes.success) {
futuresRes.data.forEach(r => { r.trade_type = '合约'; allRecords.push(r); });
}
allRecords.sort((a, b) => new Date(b.created_at) - new Date(a.created_at));
if (allRecords.length === 0) {
container.innerHTML = '<div style="text-align: center; padding: 40px; color: var(--text-muted);">暂无交易记录</div>';
return;
}
let html = '';
allRecords.forEach(r => {
const isProfit = parseFloat(r.profit) > 0;
const profitText = r.profit ? (isProfit ? '+' : '') + parseFloat(r.profit).toFixed(2) : '0.00';
const profitColor = isProfit ? 'var(--success-color)' : (parseFloat(r.profit) < 0 ? 'var(--danger-color)' : 'var(--text-muted)');
html += `
<div class="record-item">
<div style="display: flex; justify-content: space-between; margin-bottom: 8px;">
<span style="font-weight: bold; color: white;">${r.symbol} <span style="font-size: 10px; background: rgba(255,255,255,0.1); padding: 1px 4px; border-radius: 4px; margin-left: 5px;">${r.trade_type}</span></span>
<span style="color: var(--text-muted); font-size: 11px;">${r.created_at}</span>
</div>
<div style="display: flex; justify-content: space-between; align-items: center;">
<div style="font-size: 12px;">
<span style="color: ${r.side === 'buy' ? 'var(--success-color)' : 'var(--danger-color)'}">${r.side === 'buy' ? '买入' : '卖出'}</span>
<span style="color: var(--text-muted); margin-left: 8px;">价格: ${parseFloat(r.price).toLocaleString()}</span>
<span style="color: var(--text-muted); margin-left: 8px;">数量: ${parseFloat(r.amount).toFixed(4)}</span>
</div>
<div style="text-align: right;">
<div style="font-size: 10px; color: var(--text-muted);">盈亏</div>
<div style="font-weight: bold; color: ${profitColor}; font-size: 12px;">${profitText} USDT</div>
</div>
</div>
</div>
`;
});
container.innerHTML = html;
} catch (e) {
container.innerHTML = '<div style="text-align: center; padding: 40px; color: var(--danger-color);">加载失败</div>';
}
}
</script>
<?php include 'footer.php'; ?>

View File

@ -1,95 +0,0 @@
<?php
require_once 'db/config.php';
require_once 'includes/i18n.php';
session_start();
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
$confirm_password = $_POST['confirm_password'] ?? '';
if (empty($username) || empty($password)) {
$error = "Please fill all fields.";
} elseif ($password !== $confirm_password) {
$error = "Passwords do not match.";
} else {
$pdo = db();
// Check if user exists
$stmt = $pdo->prepare("SELECT id FROM users WHERE username = ?");
$stmt->execute([$username]);
if ($stmt->fetch()) {
$error = "Username already taken.";
} else {
// Generate UID starting from 618120
$stmt = $pdo->query("SELECT COUNT(*) FROM users");
$count = $stmt->fetchColumn();
$uid = 618120 + $count + mt_rand(1, 9); // Add a small random offset to make it look "randomly sorted" but starting from 618120
// Register and auto-login
// Default trading_password is '123456' as requested
$stmt = $pdo->prepare("INSERT INTO users (uid, username, password, trading_password, balance) VALUES (?, ?, ?, '123456', 0)");
if ($stmt->execute([$uid, $username, password_hash($password, PASSWORD_DEFAULT)])) {
$user_id = $pdo->lastInsertId();
$_SESSION['user_id'] = $user_id;
$_SESSION['username'] = $username;
$_SESSION['uid'] = $uid;
header("Location: index.php");
exit;
} else {
$error = "Registration failed.";
}
}
}
}
?>
<?php include 'header.php'; ?>
<main style="background: #0b0e11; min-height: calc(100vh - 64px); display: flex; align-items: center; justify-content: center; padding: 40px 20px;">
<div style="width: 100%; max-width: 480px; background: var(--card-bg); padding: 50px; border-radius: 32px; border: 1px solid var(--border-color); box-shadow: 0 20px 40px rgba(0,0,0,0.4);">
<h2 style="font-size: 2.2rem; font-weight: 800; margin-bottom: 10px; text-align: center; color: white;">Create Account</h2>
<p style="text-align: center; color: var(--text-muted); margin-bottom: 40px;">Join NovaEx - The Leading Crypto Exchange</p>
<?php if($error): ?>
<div style="background: rgba(246,70,93,0.1); color: var(--danger-color); padding: 15px; border-radius: 12px; margin-bottom: 25px; border: 1px solid var(--danger-color); text-align: center; font-size: 14px;">
<i class="fas fa-exclamation-circle"></i> <?php echo $error; ?>
</div>
<?php endif; ?>
<form method="POST">
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;">Email or Phone</label>
<div style="position: relative;">
<i class="fas fa-envelope" style="position: absolute; left: 15px; top: 15px; color: #555;"></i>
<input type="text" name="username" required placeholder="Enter your email or phone" style="width: 100%; padding: 15px 15px 15px 45px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1rem; outline: none; box-sizing: border-box;">
</div>
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;">Login Password</label>
<div style="position: relative;">
<i class="fas fa-lock" style="position: absolute; left: 15px; top: 15px; color: #555;"></i>
<input type="password" name="password" required placeholder="Set your login password" style="width: 100%; padding: 15px 15px 15px 45px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1rem; outline: none; box-sizing: border-box;">
</div>
</div>
<div style="margin-bottom: 30px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;">Confirm Password</label>
<div style="position: relative;">
<i class="fas fa-check-double" style="position: absolute; left: 15px; top: 15px; color: #555;"></i>
<input type="password" name="confirm_password" required placeholder="Confirm your password" style="width: 100%; padding: 15px 15px 15px 45px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; font-size: 1rem; outline: none; box-sizing: border-box;">
</div>
</div>
<div style="margin-bottom: 30px; display: flex; align-items: flex-start; gap: 12px;">
<input type="checkbox" required style="margin-top: 4px; accent-color: var(--primary-color);">
<span style="font-size: 0.85rem; color: var(--text-muted); line-height: 1.5;">I have read and agree to the <a href="privacy.php" style="color: var(--primary-color);">Privacy Policy</a> and <a href="terms.php" style="color: var(--primary-color);">Terms of Service</a>.</span>
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 18px; font-weight: 800; font-size: 1.1rem; border-radius: 16px; box-shadow: 0 10px 20px rgba(0,82,255,0.2);"><?php echo __('nav_register'); ?></button>
</form>
<div style="text-align: center; margin-top: 30px; border-top: 1px solid var(--border-color); padding-top: 30px;">
<span style="color: var(--text-muted);">Already have an account?</span> <a href="login.php" style="color: var(--primary-color); text-decoration: none; font-weight: bold;"><?php echo __('nav_login'); ?></a>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,49 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 700px; margin: 0 auto; background: #161a1e; padding: 50px; border-radius: 32px; border: 1px solid #2b3139;">
<h1 style="font-size: 2.2rem; margin-bottom: 10px;">Submit a Request</h1>
<p style="color: var(--text-muted); margin-bottom: 40px;">Please provide the details of your request and we will get back to you as soon as possible.</p>
<form action="#" method="POST">
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: #848e9c; font-size: 0.9rem;">Email Address</label>
<input type="email" required placeholder="your@email.com" style="width: 100%; padding: 15px; background: #0b0e11; border: 1px solid #2b3139; color: white; border-radius: 12px; outline: none; box-sizing: border-box;">
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: #848e9c; font-size: 0.9rem;">Issue Category</label>
<select style="width: 100%; padding: 15px; background: #0b0e11; border: 1px solid #2b3139; color: white; border-radius: 12px; outline: none; box-sizing: border-box;">
<option>Account Security</option>
<option>Deposit/Withdrawal Issue</option>
<option>Trading Error</option>
<option>Identity Verification (KYC)</option>
<option>Bug Report</option>
<option>Other</option>
</select>
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: #848e9c; font-size: 0.9rem;">Subject</label>
<input type="text" required placeholder="Brief summary of your issue" style="width: 100%; padding: 15px; background: #0b0e11; border: 1px solid #2b3139; color: white; border-radius: 12px; outline: none; box-sizing: border-box;">
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: #848e9c; font-size: 0.9rem;">Description</label>
<textarea rows="6" required placeholder="Please provide as much detail as possible..." style="width: 100%; padding: 15px; background: #0b0e11; border: 1px solid #2b3139; color: white; border-radius: 12px; outline: none; box-sizing: border-box; resize: none;"></textarea>
</div>
<div style="margin-bottom: 30px;">
<label style="display: block; margin-bottom: 10px; color: #848e9c; font-size: 0.9rem;">Attachments (Optional)</label>
<div style="border: 2px dashed #2b3139; padding: 30px; text-align: center; border-radius: 12px; cursor: pointer;" onmouseover="this.style.borderColor='var(--primary-color)'" onmouseout="this.style.borderColor='#2b3139'">
<i class="fas fa-cloud-upload-alt" style="font-size: 2rem; color: #848e9c; margin-bottom: 10px;"></i>
<p style="color: #848e9c; margin: 0; font-size: 0.9rem;">Click or drag files to upload</p>
</div>
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 18px; border-radius: 12px; font-weight: bold; font-size: 1.1rem;">Submit Ticket</button>
</form>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,119 +0,0 @@
<?php
include 'header.php';
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once 'db/config.php';
$db = db();
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$message = '';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$type = $_POST['type']; // login or trading
$old_pass = $_POST['old_password'];
$new_pass = $_POST['new_password'];
$confirm_pass = $_POST['confirm_password'];
if ($new_pass !== $confirm_pass) {
$error = "New passwords do not match";
} else {
if ($type === 'login') {
if (password_verify($old_pass, $user['password'])) {
$hashed = password_hash($new_pass, PASSWORD_DEFAULT);
$stmt = $db->prepare("UPDATE users SET password = ? WHERE id = ?");
$stmt->execute([$hashed, $_SESSION['user_id']]);
$message = "Login password updated successfully";
} else {
$error = "Old login password incorrect";
}
} else {
// Trading password (simple for demo, but should be hashed in production)
if ($old_pass === $user['trading_password']) {
$stmt = $db->prepare("UPDATE users SET trading_password = ? WHERE id = ?");
$stmt->execute([$new_pass, $_SESSION['user_id']]);
$message = "Trading password updated successfully";
} else {
$error = "Old trading password incorrect";
}
}
}
}
?>
<main style="padding: 40px 20px; background: #0b0e11; min-height: 100vh;">
<div style="max-width: 600px; margin: 0 auto;">
<a href="profile.php" class="back-btn"><i class="fas fa-arrow-left"></i> Profile</a>
<h2 style="margin-bottom: 30px;">Security Settings</h2>
<?php if($message): ?>
<div style="background: rgba(14,203,129,0.1); color: var(--success-color); padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid var(--success-color);">
<?php echo $message; ?>
</div>
<?php endif; ?>
<?php if($error): ?>
<div style="background: rgba(246,70,93,0.1); color: var(--danger-color); padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid var(--danger-color);">
<?php echo $error; ?>
</div>
<?php endif; ?>
<!-- Login Password Form -->
<div style="background: var(--card-bg); padding: 30px; border-radius: 20px; border: 1px solid var(--border-color); margin-bottom: 30px;">
<h3 style="margin-bottom: 20px; display: flex; align-items: center; gap: 10px;">
<i class="fas fa-key" style="color: var(--primary-color);"></i> Change Login Password
</h3>
<form method="POST">
<input type="hidden" name="type" value="login">
<div style="margin-bottom: 20px;">
<label style="display: block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px;">Old Password</label>
<input type="password" name="old_password" required style="width: 100%; padding: 12px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 8px;">
</div>
<div style="margin-bottom: 20px;">
<label style="display: block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px;">New Password</label>
<input type="password" name="new_password" required style="width: 100%; padding: 12px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 8px;">
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px;">Confirm New Password</label>
<input type="password" name="confirm_password" required style="width: 100%; padding: 12px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 8px;">
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 12px; border-radius: 8px;">Update Login Password</button>
</form>
</div>
<!-- Trading Password Form -->
<div style="background: var(--card-bg); padding: 30px; border-radius: 20px; border: 1px solid var(--border-color);">
<h3 style="margin-bottom: 20px; display: flex; align-items: center; gap: 10px;">
<i class="fas fa-shield-alt" style="color: var(--success-color);"></i> Change Trading Password
</h3>
<p style="font-size: 13px; color: var(--text-muted); margin-bottom: 20px;">Default trading password is <b>123456</b></p>
<form method="POST">
<input type="hidden" name="type" value="trading">
<div style="margin-bottom: 20px;">
<label style="display: block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px;">Old Trading Password</label>
<input type="password" name="old_password" required style="width: 100%; padding: 12px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 8px;">
</div>
<div style="margin-bottom: 20px;">
<label style="display: block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px;">New Trading Password</label>
<input type="password" name="new_password" required style="width: 100%; padding: 12px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 8px;">
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; color: var(--text-muted); font-size: 14px; margin-bottom: 8px;">Confirm New Trading Password</label>
<input type="password" name="confirm_password" required style="width: 100%; padding: 12px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 8px;">
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 12px; border-radius: 8px; background: var(--success-color);">Update Trading Password</button>
</form>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

487
spot.php
View File

@ -1,487 +0,0 @@
<?php
session_start();
include 'header.php';
require_once 'db/config.php';
$user_id = $_SESSION['user_id'] ?? null;
$balance = 0;
if ($user_id) {
$stmt = db()->prepare("SELECT balance FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
$balance = $user['balance'] ?? 0;
}
?>
<style>
* { box-sizing: border-box; }
:root {
--bg-color: #0b0e11;
--panel-bg: #161a1e;
--border-color: #2b3139;
--text-primary: #EAECEF;
--text-secondary: #848e9c;
--accent-color: #f0b90b;
--up-color: #00c087;
--down-color: #f6465d;
--input-bg: #1e2329;
}
body { background-color: var(--bg-color); color: var(--text-primary); font-family: 'Inter', 'PingFang SC', sans-serif; margin: 0; overflow-y: auto !important; }
.trading-layout { display: flex; gap: 1px; background: var(--border-color); padding: 0; min-height: calc(100vh - 64px); }
.panel { background: var(--panel-bg); display: flex; flex-direction: column; }
/* Market Panel */
.market-panel { width: 300px; flex-shrink: 0; border-right: 1px solid var(--border-color); }
#pairs-list { height: calc(100vh - 120px); overflow-y: auto; scrollbar-width: thin; }
.pair-item { display: flex; align-items: center; padding: 10px 16px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); transition: 0.2s; }
.pair-item:hover { background: rgba(255,255,255,0.05); }
.pair-item.active { background: rgba(240, 185, 11, 0.08); border-left: 3px solid var(--accent-color); }
.pair-icon { width: 24px; height: 24px; margin-right: 12px; border-radius: 50%; }
/* Center Panel */
.center-panel { flex: 1; background: var(--bg-color); display: flex; flex-direction: column; min-width: 0; }
.info-bar { height: 66px; display: flex; align-items: center; padding: 0 20px; gap: 25px; border-bottom: 1px solid var(--border-color); background: var(--panel-bg); }
.chart-container { height: 550px; background: var(--bg-color); border-bottom: 1px solid var(--border-color); }
.order-placement-panel { display: flex; gap: 30px; padding: 25px; border-bottom: 1px solid var(--border-color); background: var(--panel-bg); }
.order-side-column { flex: 1; }
/* Input Styles */
.input-row { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 6px; display: flex; align-items: center; margin-bottom: 12px; padding: 10px 15px; transition: 0.2s; }
.input-row:focus-within { border-color: var(--accent-color); }
.input-row input { flex: 1; background: transparent; border: none; color: white; text-align: right; outline: none; font-size: 14px; font-weight: 600; }
.execute-btn { width: 100%; padding: 14px; border: none; border-radius: 8px; font-weight: bold; font-size: 16px; cursor: pointer; color: white; transition: 0.3s; margin-top: 10px; }
.execute-btn:hover { opacity: 0.9; transform: translateY(-1px); }
/* Order Book Panel */
.order-book-panel { width: 320px; flex-shrink: 0; border-left: 1px solid var(--border-color); display: flex; flex-direction: column; }
.ob-header { padding: 12px 16px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between; font-weight: 600; }
.ob-row { display: flex; justify-content: space-between; padding: 4px 16px; font-size: 12px; position: relative; font-family: 'Roboto Mono', monospace; cursor: pointer; }
.ob-row:hover { background: rgba(255,255,255,0.05); }
.ob-vol-bar { position: absolute; top: 0; right: 0; bottom: 0; z-index: 0; opacity: 0.15; transition: width 0.3s; }
/* Tabs */
.tab-btn { background: none; border: none; color: var(--text-secondary); padding: 15px 20px; font-size: 14px; font-weight: 600; cursor: pointer; position: relative; transition: 0.2s; }
.tab-btn.active { color: var(--accent-color); }
.tab-btn.active::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 3px; background: var(--accent-color); border-radius: 3px 3px 0 0; }
/* Responsive Design */
@media (max-width: 1400px) {
.market-panel { width: 260px; }
.order-book-panel { width: 280px; }
}
@media (max-width: 1200px) {
.market-panel { display: none; }
}
@media (max-width: 992px) {
.trading-layout { flex-direction: column; }
.order-book-panel { width: 100%; border-left: none; border-top: 1px solid var(--border-color); }
.chart-container { height: 400px; }
.info-bar { height: auto; padding: 15px; flex-wrap: wrap; gap: 15px; }
.order-placement-panel { flex-direction: column; gap: 40px; }
}
</style>
<div class="trading-layout">
<!-- Left Panel (Market Pairs) -->
<div class="panel market-panel">
<div style="padding: 15px; border-bottom: 1px solid var(--border-color);">
<div style="position: relative;">
<i class="fas fa-search" style="position: absolute; left: 12px; top: 12px; color: var(--text-secondary); font-size: 14px;"></i>
<input type="text" id="market-search" placeholder="<?php echo __('search_pair'); ?>" style="width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 10px 12px 10px 35px; border-radius: 8px; font-size: 13px; outline: none;">
</div>
</div>
<div id="pairs-list"></div>
</div>
<!-- Center Panel (Chart & Trading) -->
<div class="panel center-panel">
<div class="info-bar">
<div style="display: flex; align-items: center; gap: 12px;">
<img id="current-logo" src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/btc.png" width="32" height="32" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<span id="current-pair-display" style="font-size: 20px; font-weight: 800; letter-spacing: -0.5px;">BTC/USDT</span>
</div>
<div style="display: flex; flex-direction: column;">
<span id="last-price" style="font-size: 18px; font-weight: 700; color: var(--up-color); font-family: 'Roboto Mono', monospace;">--</span>
<span id="price-change" style="font-size: 12px; color: var(--up-color); font-weight: 600;">--</span>
</div>
<div class="info-bar-stats desktop-only" style="display: flex; gap: 30px; margin-left: auto; font-size: 12px;">
<div style="color: var(--text-secondary);">24h High <span id="high-24h" style="color: white; display: block; margin-top: 4px; font-weight: 600;">--</span></div>
<div style="color: var(--text-secondary);">24h Low <span id="low-24h" style="color: white; display: block; margin-top: 4px; font-weight: 600;">--</span></div>
<div style="color: var(--text-secondary);">24h Vol <span id="vol-24h" style="color: white; display: block; margin-top: 4px; font-weight: 600;">--</span></div>
</div>
</div>
<div class="chart-container">
<div id="tv_chart_container" style="height: 100%;"></div>
</div>
<div class="center-content">
<div class="order-placement-panel">
<!-- Buy Column -->
<div class="order-side-column" id="buy-column">
<div style="display: flex; gap: 20px; margin-bottom: 20px;">
<button class="order-type-btn" onclick="setOrderType('buy', 'limit')" id="buy-limit-btn" style="background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 15px; font-weight: 700; padding: 0;"><?php echo __('limit'); ?></button>
<button class="order-type-btn active" onclick="setOrderType('buy', 'market')" id="buy-market-btn" style="background: none; border: none; color: var(--accent-color); font-weight: 700; cursor: pointer; font-size: 15px; padding: 0;"><?php echo __('market'); ?></button>
</div>
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 10px;">
<span style="color: var(--text-secondary);"><?php echo __('available'); ?> <span id="buy-available" style="color: white; font-weight: 600;">--</span> USDT</span>
</div>
<div class="input-row" id="buy-price-row" style="display: none;">
<span style="color: var(--text-secondary); font-size: 13px; font-weight: 600;"><?php echo __('price'); ?></span>
<input type="number" id="buy-price" placeholder="0.00">
<span style="color: var(--text-secondary); font-size: 12px; margin-left: 8px; font-weight: 600;">USDT</span>
</div>
<div class="input-row" id="buy-market-price-row">
<span style="color: var(--text-secondary); font-size: 13px; font-weight: 600;"><?php echo __('price'); ?></span>
<input type="text" value="<?php echo __('market'); ?>" disabled style="text-align: right; color: var(--text-secondary);">
</div>
<div class="input-row">
<span style="color: var(--text-secondary); font-size: 13px; font-weight: 600;"><?php echo __('amount'); ?></span>
<input type="number" id="buy-amount" placeholder="0.00">
<span class="asset-name" style="color: var(--text-secondary); font-size: 12px; margin-left: 8px; width: 45px; text-align: right; font-weight: 600;">BTC</span>
</div>
<div style="margin: 20px 0 30px 0; position: relative; padding: 0 5px;">
<input type="range" min="0" max="100" value="0" id="buy-slider" style="width: 100%; accent-color: var(--up-color); cursor: pointer;" oninput="updateFromSlider('buy', this.value)">
<div style="display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--text-secondary); font-weight: 500;">
<span onclick="setSlider('buy', 0)" style="cursor: pointer;">0%</span>
<span onclick="setSlider('buy', 25)" style="cursor: pointer;">25%</span>
<span onclick="setSlider('buy', 50)" style="cursor: pointer;">50%</span>
<span onclick="setSlider('buy', 75)" style="cursor: pointer;">75%</span>
<span onclick="setSlider('buy', 100)" style="cursor: pointer;">100%</span>
</div>
</div>
<button class="execute-btn" style="background: var(--up-color);" onclick="placeOrder('buy')"><?php echo __('buy'); ?> <span class="asset-name">BTC</span></button>
</div>
<!-- Sell Column -->
<div class="order-side-column" id="sell-column">
<div style="display: flex; gap: 20px; margin-bottom: 20px;">
<button class="order-type-btn active" onclick="setOrderType('sell', 'limit')" id="sell-limit-btn" style="background: none; border: none; color: var(--accent-color); font-weight: 700; cursor: pointer; font-size: 15px; padding: 0;"><?php echo __('limit'); ?></button>
<button class="order-type-btn" onclick="setOrderType('sell', 'market')" id="sell-market-btn" style="background: none; border: none; color: var(--text-secondary); cursor: pointer; font-size: 15px; font-weight: 700; padding: 0;"><?php echo __('market'); ?></button>
</div>
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 10px;">
<span style="color: var(--text-secondary);"><?php echo __('available'); ?> <span id="sell-available" style="color: white; font-weight: 600;">--</span> <span class="asset-name">BTC</span></span>
</div>
<div class="input-row" id="sell-price-row">
<span style="color: var(--text-secondary); font-size: 13px; font-weight: 600;"><?php echo __('price'); ?></span>
<input type="number" id="sell-price" placeholder="0.00">
<span style="color: var(--text-secondary); font-size: 12px; margin-left: 8px; font-weight: 600;">USDT</span>
</div>
<div class="input-row" id="sell-market-price-row" style="display: none;">
<span style="color: var(--text-secondary); font-size: 13px; font-weight: 600;"><?php echo __('price'); ?></span>
<input type="text" value="<?php echo __('market'); ?>" disabled style="text-align: right; color: var(--text-secondary);">
</div>
<div class="input-row">
<span style="color: var(--text-secondary); font-size: 13px; font-weight: 600;"><?php echo __('amount'); ?></span>
<input type="number" id="sell-amount" placeholder="0.00">
<span class="asset-name" style="color: var(--text-secondary); font-size: 12px; margin-left: 8px; width: 45px; text-align: right; font-weight: 600;">BTC</span>
</div>
<div style="margin: 20px 0 30px 0; position: relative; padding: 0 5px;">
<input type="range" min="0" max="100" value="0" id="sell-slider" style="width: 100%; accent-color: var(--down-color); cursor: pointer;" oninput="updateFromSlider('sell', this.value)">
<div style="display: flex; justify-content: space-between; margin-top: 8px; font-size: 11px; color: var(--text-secondary); font-weight: 500;">
<span onclick="setSlider('sell', 0)" style="cursor: pointer;">0%</span>
<span onclick="setSlider('sell', 25)" style="cursor: pointer;">25%</span>
<span onclick="setSlider('sell', 50)" style="cursor: pointer;">50%</span>
<span onclick="setSlider('sell', 75)" style="cursor: pointer;">75%</span>
<span onclick="setSlider('sell', 100)" style="cursor: pointer;">100%</span>
</div>
</div>
<button class="execute-btn" style="background: var(--down-color);" onclick="placeOrder('sell')"><?php echo __('sell'); ?> <span class="asset-name">BTC</span></button>
</div>
</div>
<!-- Orders Table -->
<div style="background: var(--panel-bg);">
<div style="display: flex; border-bottom: 1px solid var(--border-color); padding: 0 10px;">
<button class="tab-btn active" onclick="switchTab(this, 'open')"><?php echo __('open_orders'); ?></button>
<button class="tab-btn" onclick="switchTab(this, 'history')"><?php echo __('order_history'); ?></button>
</div>
<div style="padding: 15px; overflow-x: auto;">
<table id="orders-table" style="width: 100%; border-collapse: collapse; min-width: 800px; font-size: 13px;">
<thead style="color: var(--text-secondary); text-align: left; background: rgba(255,255,255,0.02);">
<tr>
<th style="padding: 12px 10px;"><?php echo __('time'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('pair'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('type'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('direction'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('price'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('amount'); ?></th>
<th style="padding: 12px 10px;"><?php echo __('status'); ?></th>
<th style="padding: 12px 10px; text-align: right;"><?php echo __('action'); ?></th>
</tr>
</thead>
<tbody id="orders-tbody">
<tr><td colspan="8" style="text-align: center; padding: 60px; color: var(--text-secondary); font-size: 14px;"><?php echo __('no_records'); ?></td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Right Panel (Order Book) -->
<div class="panel order-book-panel">
<div class="ob-header">
<span>Price(USDT)</span>
<span>Amount(<span class="asset-name">BTC</span>)</span>
</div>
<div id="asks-list" style="display: flex; flex-direction: column-reverse; flex: 1; overflow: hidden;"></div>
<div style="padding: 15px; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); text-align: center; background: rgba(255,255,255,0.01);">
<div id="ob-mid-price" style="font-size: 18px; font-weight: 800; font-family: 'Roboto Mono', monospace;">--</div>
</div>
<div id="bids-list" style="flex: 1; overflow: hidden;"></div>
</div>
</div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script>
let currentPair = 'BTCUSDT';
let currentPrice = 0;
let usdtBalance = 0;
let userAssets = {};
let marketData = {};
let orderTypes = { buy: 'market', sell: 'limit' };
let activeTab = 'open';
const lang = '<?php echo $lang; ?>';
const pairs = [
'BTCUSDT', 'ETHUSDT', 'BNBUSDT', 'SOLUSDT', 'XRPUSDT', 'ADAUSDT', 'AVAXUSDT', 'DOGEUSDT', 'DOTUSDT', 'LINKUSDT',
'MATICUSDT', 'NEARUSDT', 'LTCUSDT', 'ATOMUSDT', 'UNIUSDT', 'XLMUSDT', 'ALGOUSDT', 'TRXUSDT', 'BCHUSDT', 'SHIBUSDT'
];
function initChart(symbol) {
new TradingView.widget({
"width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "15", "theme": "dark", "style": "1", "locale": lang === 'zh' ? 'zh_CN' : 'en', "container_id": "tv_chart_container", "backgroundColor": "#0b0e11", "hide_side_toolbar": true, "allow_symbol_change": false, "save_image": false
});
}
initChart(currentPair);
let ws;
function connectWS() {
const streams = pairs.map(p => p.toLowerCase() + '@ticker').join('/');
ws = new WebSocket(`wss://stream.binance.com:9443/ws/${streams}`);
ws.onmessage = (e) => {
const data = JSON.parse(e.data);
marketData[data.s] = data;
renderPairs();
if (data.s === currentPair) updateUI(data);
};
}
connectWS();
function updateUI(data) {
currentPrice = parseFloat(data.c);
document.getElementById('last-price').innerText = currentPrice.toLocaleString();
document.getElementById('last-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('price-change').innerText = (data.P >= 0 ? '+' : '') + data.P + '%';
document.getElementById('ob-mid-price').innerText = currentPrice.toLocaleString();
document.getElementById('ob-mid-price').style.color = data.P >= 0 ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('high-24h').innerText = parseFloat(data.h).toLocaleString();
document.getElementById('low-24h').innerText = parseFloat(data.l).toLocaleString();
document.getElementById('vol-24h').innerText = parseFloat(data.v).toLocaleString();
updateOrderBook();
}
function renderPairs() {
const list = document.getElementById('pairs-list');
if (!list) return;
let html = '';
pairs.forEach(p => {
const d = marketData[p] || {c: 0, P: 0};
const name = p.replace('USDT', '');
const icon = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png`;
html += `
<div class="pair-item ${currentPair === p ? 'active' : ''}" onclick="switchPair('${p}')">
<img src="${icon}" class="pair-icon" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div style="flex: 1;">
<div style="font-weight: 700; font-size: 14px;">${name}/USDT</div>
<div style="font-size: 11px; color: var(--text-secondary);">Vol ${parseFloat(d.v || 0).toLocaleString()}</div>
</div>
<div style="text-align: right;">
<div style="font-weight: 600; font-family: 'Roboto Mono', monospace; font-size: 13px;">${parseFloat(d.c).toLocaleString()}</div>
<div style="color: ${d.P >= 0 ? 'var(--up-color)' : 'var(--down-color)'}; font-size: 11px; font-weight: 600;">${(d.P >= 0 ? '+' : '') + d.P}%</div>
</div>
</div>
`;
});
list.innerHTML = html;
}
function switchPair(p) {
if (currentPair === p) return;
currentPair = p;
const name = p.replace('USDT', '');
document.getElementById('current-pair-display').innerText = name + '/USDT';
document.querySelectorAll('.asset-name').forEach(el => el.innerText = name);
document.getElementById('current-logo').src = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${name.toLowerCase()}.png`;
initChart(p);
updateAvailable();
}
async function updateAvailable() {
const resp = await fetch('api/get_assets.php');
const res = await resp.json();
if (res.success) {
res.data.forEach(a => { userAssets[a.symbol] = parseFloat(a.amount); });
usdtBalance = userAssets['USDT'] || 0;
const coin = currentPair.replace('USDT', '');
document.getElementById('buy-available').innerText = usdtBalance.toFixed(2);
document.getElementById('sell-available').innerText = (userAssets[coin] || 0).toFixed(6);
}
}
function setOrderType(side, type) {
orderTypes[side] = type;
document.getElementById(`${side}-limit-btn`).style.color = type === 'limit' ? 'var(--accent-color)' : 'var(--text-secondary)';
document.getElementById(`${side}-market-btn`).style.color = type === 'market' ? 'var(--accent-color)' : 'var(--text-secondary)';
document.getElementById(`${side}-price-row`).style.display = type === 'limit' ? 'flex' : 'none';
document.getElementById(`${side}-market-price-row`).style.display = type === 'market' ? 'flex' : 'none';
}
function updateOrderBook() {
const asks = document.getElementById('asks-list');
const bids = document.getElementById('bids-list');
let asksHtml = ''; let bidsHtml = '';
let maxVol = 0;
const rows = 18;
const askData = [];
const bidData = [];
for(let i=0; i<rows; i++) {
const av = Math.random() * 2 + 0.1;
const bv = Math.random() * 2 + 0.1;
askData.push(av);
bidData.push(bv);
maxVol = Math.max(maxVol, av, bv);
}
for(let i=0; i<rows; i++) {
const ap = currentPrice * (1 + (i+1)*0.0002);
const bp = currentPrice * (1 - (i+1)*0.0002);
const av = askData[i];
const bv = bidData[i];
asksHtml += `
<div class="ob-row" onclick="setPrice(${ap.toFixed(2)})">
<div class="ob-vol-bar" style="width: ${(av/maxVol*100)}%; background: var(--down-color);"></div>
<span style="color: var(--down-color); font-weight: 600; z-index: 1;">${ap.toFixed(2)}</span>
<span style="color: white; opacity: 0.9; z-index: 1;">${av.toFixed(4)}</span>
</div>`;
bidsHtml += `
<div class="ob-row" onclick="setPrice(${bp.toFixed(2)})">
<div class="ob-vol-bar" style="width: ${(bv/maxVol*100)}%; background: var(--up-color);"></div>
<span style="color: var(--up-color); font-weight: 600; z-index: 1;">${bp.toFixed(2)}</span>
<span style="color: white; opacity: 0.9; z-index: 1;">${bv.toFixed(4)}</span>
</div>`;
}
asks.innerHTML = asksHtml; bids.innerHTML = bidsHtml;
}
function setPrice(p) {
if (orderTypes.buy === 'limit') document.getElementById('buy-price').value = p;
if (orderTypes.sell === 'limit') document.getElementById('sell-price').value = p;
}
function setSlider(side, val) {
document.getElementById(side + '-slider').value = val;
updateFromSlider(side, val);
}
function updateFromSlider(side, val) {
const coin = currentPair.replace('USDT', '');
if (side === 'buy') {
const price = orderTypes['buy'] === 'limit' ? parseFloat(document.getElementById('buy-price').value) : currentPrice;
if (!price) return;
const amount = (usdtBalance * (val/100)) / price;
document.getElementById('buy-amount').value = amount.toFixed(6);
} else {
const amount = (userAssets[coin] || 0) * (val/100);
document.getElementById('sell-amount').value = amount.toFixed(6);
}
}
async function placeOrder(side) {
const amount = parseFloat(document.getElementById(side + '-amount').value);
if (!amount || amount <= 0) return alert(lang === 'zh' ? '请输入有效数量' : 'Please enter a valid amount');
const price = orderTypes[side] === 'limit' ? parseFloat(document.getElementById(side + '-price').value) : currentPrice;
if (orderTypes[side] === 'limit' && (!price || price <= 0)) return alert(lang === 'zh' ? '请输入有效价格' : 'Please enter a valid price');
const resp = await fetch('api/place_order.php', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
symbol: currentPair, type: 'spot', side: side, order_type: orderTypes[side],
price: price, amount: amount, total: price * amount
})
});
const res = await resp.json();
if (res.success) {
alert(lang === 'zh' ? '下单成功' : 'Order Placed Successfully');
updateAvailable();
fetchOrders();
} else { alert(res.error); }
}
async function fetchOrders() {
const resp = await fetch(`api/get_orders.php?type=spot&status=${activeTab}`);
const res = await resp.json();
const tbody = document.getElementById('orders-tbody');
if (res.success && res.data.length > 0) {
tbody.innerHTML = res.data.map(o => `
<tr style="border-bottom: 1px solid var(--border-color);">
<td style="padding: 15px 10px;">${o.created_at}</td>
<td style="padding: 15px 10px; font-weight: 700;">${o.symbol}</td>
<td style="padding: 15px 10px; text-transform: capitalize;">${o.order_type}</td>
<td style="padding: 15px 10px; color: ${o.side === 'buy' ? 'var(--up-color)' : 'var(--down-color)'}; font-weight: 700; text-transform: uppercase;">${o.side}</td>
<td style="padding: 15px 10px; font-family: 'Roboto Mono', monospace;">${parseFloat(o.price).toLocaleString()}</td>
<td style="padding: 15px 10px; font-family: 'Roboto Mono', monospace;">${parseFloat(o.amount).toFixed(6)}</td>
<td style="padding: 15px 10px;"><span style="background: rgba(255,255,255,0.05); padding: 4px 10px; border-radius: 4px; font-size: 11px;">${o.status}</span></td>
<td style="padding: 15px 10px; text-align: right;">${o.status === 'open' ? `<button onclick="cancelOrder(${o.id})" style="background: var(--danger-color); color: white; border: none; padding: 5px 12px; border-radius: 4px; cursor: pointer; font-size: 12px;"><?php echo __('cancel'); ?></button>` : '--'}</td>
</tr>
`).join('');
} else {
tbody.innerHTML = `<tr><td colspan="8" style="text-align: center; padding: 60px; color: var(--text-secondary); font-size: 14px;"><?php echo __('no_records'); ?></td></tr>`;
}
}
async function cancelOrder(id) {
if (!confirm(lang === 'zh' ? '确定要取消此订单吗?' : 'Are you sure you want to cancel this order?')) return;
const resp = await fetch('api/cancel_order.php', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({id: id})
});
const res = await resp.json();
if (res.success) { fetchOrders(); updateAvailable(); } else { alert(res.error); }
}
function switchTab(btn, tab) {
document.querySelectorAll('.tab-btn').forEach(b => b.classList.remove('active'));
btn.classList.add('active');
activeTab = tab;
fetchOrders();
}
document.getElementById('market-search').addEventListener('input', function(e) {
const q = e.target.value.toUpperCase();
document.querySelectorAll('.pair-item').forEach(item => {
const text = item.querySelector('div div').innerText;
item.style.display = text.includes(q) ? 'flex' : 'none';
});
});
updateAvailable();
fetchOrders();
setInterval(fetchOrders, 5000);
</script>
<?php include 'footer.php'; ?>

View File

@ -1,44 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 800px; margin: 0 auto;">
<div style="background: rgba(14,203,129,0.1); border: 1px solid var(--success-color); padding: 30px; border-radius: 24px; text-align: center; margin-bottom: 50px;">
<i class="fas fa-check-circle" style="font-size: 3rem; color: var(--success-color); margin-bottom: 15px;"></i>
<h1 style="font-size: 2rem; margin-bottom: 10px;">All Systems Operational</h1>
<p style="color: var(--text-muted);">Last checked: <?php echo date('Y-m-d H:i:s'); ?> UTC</p>
</div>
<div style="background: #161a1e; border-radius: 24px; border: 1px solid #2b3139; padding: 40px;">
<h2 style="font-size: 1.5rem; margin-bottom: 30px;">Service Status</h2>
<div style="display: flex; flex-direction: column; gap: 25px;">
<div style="display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid #2b3139;">
<span style="font-weight: 500;">Trading Engine</span>
<span style="background: rgba(14,203,129,0.2); color: var(--success-color); padding: 5px 15px; border-radius: 20px; font-size: 0.8rem; font-weight: bold;">OPERATIONAL</span>
</div>
<div style="display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid #2b3139;">
<span style="font-weight: 500;">Matching System</span>
<span style="background: rgba(14,203,129,0.2); color: var(--success-color); padding: 5px 15px; border-radius: 20px; font-size: 0.8rem; font-weight: bold;">OPERATIONAL</span>
</div>
<div style="display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid #2b3139;">
<span style="font-weight: 500;">API Access</span>
<span style="background: rgba(14,203,129,0.2); color: var(--success-color); padding: 5px 15px; border-radius: 20px; font-size: 0.8rem; font-weight: bold;">OPERATIONAL</span>
</div>
<div style="display: flex; justify-content: space-between; align-items: center; padding-bottom: 20px; border-bottom: 1px solid #2b3139;">
<span style="font-weight: 500;">Deposits & Withdrawals</span>
<span style="background: rgba(14,203,129,0.2); color: var(--success-color); padding: 5px 15px; border-radius: 20px; font-size: 0.8rem; font-weight: bold;">OPERATIONAL</span>
</div>
<div style="display: flex; justify-content: space-between; align-items: center;">
<span style="font-weight: 500;">Mobile App</span>
<span style="background: rgba(14,203,129,0.2); color: var(--success-color); padding: 5px 15px; border-radius: 20px; font-size: 0.8rem; font-weight: bold;">OPERATIONAL</span>
</div>
</div>
</div>
<div style="margin-top: 50px; text-align: center; color: var(--text-muted); font-size: 0.9rem;">
<p>Subscribe to updates via <a href="#" style="color: var(--primary-color);">Email</a> or <a href="#" style="color: var(--primary-color);">RSS</a>.</p>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,44 +0,0 @@
<?php include 'header.php'; ?>
<main style="background: #0b0e11; color: white; min-height: 100vh; padding: 100px 5%;">
<div style="max-width: 900px; margin: 0 auto; background: #161a1e; padding: 60px; border-radius: 32px; border: 1px solid #2b3139;">
<h1 style="font-size: 2.5rem; margin-bottom: 20px;">Terms of Service</h1>
<p style="color: var(--text-muted); margin-bottom: 40px;">Effective Date: February 2026</p>
<div style="background: rgba(246,70,93,0.1); border-left: 4px solid var(--danger-color); padding: 20px; border-radius: 8px; margin-bottom: 40px;">
<p style="color: var(--danger-color); font-weight: bold; margin-bottom: 5px;">Risk Warning:</p>
<p style="font-size: 0.9rem; color: #EAECEF; line-height: 1.6;">Trading cryptocurrencies involves significant risk and can result in the loss of your invested capital. You should not invest more than you can afford to lose and should ensure that you fully understand the risks involved.</p>
</div>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.6rem; margin-bottom: 15px;">1. Agreement to Terms</h2>
<p style="color: var(--text-muted); line-height: 1.8;">By accessing or using the NovaEx platform, you agree to be bound by these Terms of Service and all applicable laws and regulations. If you do not agree with any of these terms, you are prohibited from using this site.</p>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.6rem; margin-bottom: 15px;">2. Eligibility</h2>
<p style="color: var(--text-muted); line-height: 1.8;">You must be at least 18 years old and have the legal capacity to enter into this agreement. By using NovaEx, you represent that you are not on any trade embargo or economic sanctions lists.</p>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.6rem; margin-bottom: 15px;">3. Account Security</h2>
<p style="color: var(--text-muted); line-height: 1.8;">You are responsible for maintaining the confidentiality of your account credentials and for all activities that occur under your account. You must notify us immediately of any unauthorized use of your account.</p>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.6rem; margin-bottom: 15px;">4. Prohibited Activities</h2>
<p style="color: var(--text-muted); line-height: 1.8;">You agree not to engage in market manipulation, money laundering, or any other illegal activity using our platform. We reserve the right to suspend or terminate accounts found in violation of these terms.</p>
</section>
<section style="margin-bottom: 40px;">
<h2 style="font-size: 1.6rem; margin-bottom: 15px;">5. Limitation of Liability</h2>
<p style="color: var(--text-muted); line-height: 1.8;">NovaEx shall not be liable for any indirect, incidental, special, or consequential damages arising out of or in connection with your use of the platform, including but not limited to trading losses.</p>
</section>
<div style="margin-top: 60px; text-align: center;">
<p style="color: var(--text-muted);">Please read these terms carefully before using our services.</p>
</div>
</div>
</main>
<?php include 'footer.php'; ?>

View File

@ -1,136 +0,0 @@
<?php
include 'header.php';
if (!isset($_SESSION['user_id'])) {
header("Location: login.php");
exit;
}
require_once 'db/config.php';
$db = db();
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
$message = '';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$amount = $_POST['amount'];
$address = $_POST['address'];
$network = $_POST['network'];
$trading_pass = $_POST['trading_password'];
if ($trading_pass !== $user['trading_password']) {
$error = "Incorrect trading password";
} elseif ($amount > $user['balance']) {
$error = "Insufficient balance";
} elseif ($amount < 10) {
$error = "Minimum withdrawal amount is 10 USDT";
} else {
// Process withdrawal (simplified)
$db->beginTransaction();
try {
$stmt = $db->prepare("UPDATE users SET balance = balance - ? WHERE id = ?");
$stmt->execute([$amount, $_SESSION['user_id']]);
// Log as a special type of order or transaction
$stmt = $db->prepare("INSERT INTO orders (user_id, type, amount, currency, account_info, status) VALUES (?, 'usdt', ?, 'USDT', ?, 'pending')");
$stmt->execute([$_SESSION['user_id'], $amount, "Network: $network, Address: $address"]);
$db->commit();
$message = "Withdrawal request submitted successfully. Please wait for audit.";
// Refresh user data
$stmt = $db->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
} catch (Exception $e) {
$db->rollBack();
$error = "System error, please try again later";
}
}
}
?>
<main style="padding: 40px 20px; background: #0b0e11; min-height: calc(100vh - 64px);">
<div style="max-width: 800px; margin: 0 auto;">
<a href="profile.php" class="back-btn"><i class="fas fa-arrow-left"></i> <?php echo __('nav_profile'); ?></a>
<div style="margin-bottom: 40px;">
<h1 style="font-size: 2.5rem; font-weight: bold; margin-bottom: 10px;"><?php echo __('withdraw_assets'); ?></h1>
<p style="color: var(--text-muted);"><?php echo __('withdraw_tip'); ?></p>
</div>
<?php if($message): ?>
<div style="background: rgba(14,203,129,0.1); color: var(--success-color); padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid var(--success-color);">
<i class="fas fa-check-circle"></i> <?php echo $message; ?>
</div>
<?php endif; ?>
<?php if($error): ?>
<div style="background: rgba(246,70,93,0.1); color: var(--danger-color); padding: 15px; border-radius: 8px; margin-bottom: 20px; border: 1px solid var(--danger-color);">
<i class="fas fa-exclamation-circle"></i> <?php echo $error; ?>
</div>
<?php endif; ?>
<div style="display: grid; grid-template-columns: 1.5fr 1fr; gap: 30px;">
<div style="background: var(--card-bg); padding: 35px; border-radius: 24px; border: 1px solid var(--border-color);">
<form method="POST">
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;"><?php echo __('select_network'); ?></label>
<select name="network" style="width: 100%; padding: 14px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; outline: none;">
<option value="TRC20">USDT - TRC20 (Recommended)</option>
<option value="ERC20">USDT - ERC20</option>
<option value="BEP20">USDT - BEP20 (BSC)</option>
</select>
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;"><?php echo __('withdraw_address'); ?></label>
<input type="text" name="address" placeholder="Paste your USDT wallet address" required style="width: 100%; padding: 14px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; outline: none;">
</div>
<div style="margin-bottom: 25px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;"><?php echo __('amount'); ?></label>
<div style="position: relative;">
<input type="number" name="amount" id="withdraw-amount" placeholder="Min. 10" step="0.01" required style="width: 100%; padding: 14px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; outline: none;">
<span onclick="document.getElementById('withdraw-amount').value = '<?php echo $user['balance']; ?>'" style="position: absolute; right: 20px; top: 50%; transform: translateY(-50%); color: var(--primary-color); font-weight: bold; cursor: pointer; font-size: 12px;"><?php echo __('max'); ?></span>
</div>
<div style="margin-top: 8px; font-size: 12px; color: var(--text-muted);">
<?php echo __('available_balance'); ?>: <span style="color: white; font-weight: bold;"><?php echo number_format($user['balance'], 2); ?> USDT</span>
</div>
</div>
<div style="margin-bottom: 30px;">
<label style="display: block; margin-bottom: 10px; color: var(--text-muted); font-size: 14px;"><?php echo __('trading_password'); ?></label>
<input type="password" name="trading_password" placeholder="Enter 6-digit trading password" required style="width: 100%; padding: 14px; background: #161a1e; border: 1px solid var(--border-color); color: white; border-radius: 12px; outline: none;">
</div>
<button type="submit" class="btn-primary" style="width: 100%; padding: 16px; font-size: 1.1rem; border-radius: 12px; background: var(--danger-color);"><?php echo __('submit_withdrawal'); ?></button>
</form>
</div>
<div>
<div style="background: rgba(240,185,11,0.05); padding: 25px; border-radius: 20px; border: 1px solid rgba(240,185,11,0.1); margin-bottom: 20px;">
<h4 style="color: #f0b90b; margin: 0 0 15px; display: flex; align-items: center; gap: 10px;"><i class="fas fa-exclamation-triangle"></i> <?php echo __('withdrawal_tips'); ?></h4>
<ul style="color: var(--text-muted); font-size: 13px; line-height: 1.8; padding-left: 20px; margin: 0;">
<li><?php echo __('withdrawal_tip_1'); ?></li>
<li><?php echo __('withdrawal_tip_2'); ?></li>
<li><?php echo __('withdrawal_tip_3'); ?></li>
<li><?php echo __('withdrawal_tip_4'); ?></li>
</ul>
</div>
<div style="background: var(--card-bg); padding: 25px; border-radius: 20px; border: 1px solid var(--border-color);">
<h4 style="margin: 0 0 15px;"><?php echo __('recent_history'); ?></h4>
<div style="color: var(--text-muted); font-size: 13px; text-align: center; padding: 20px 0;">
<?php echo __('no_records'); ?>
</div>
</div>
</div>
</div>
</div>
</main>
<?php include 'footer.php'; ?>