Compare commits

..

11 Commits

Author SHA1 Message Date
Flatlogic Bot
238c9e0d22 Autosave: 20260212-080055 2026-02-12 08:00:55 +00:00
Flatlogic Bot
c93c7ad3ca Autosave: 20260212-050303 2026-02-12 05:03:03 +00:00
Flatlogic Bot
b61cbbc19a Revert to version 5464b9a 2026-02-12 02:24:15 +00:00
Flatlogic Bot
f5c7fa12cc Revert to version 5e2fe8c 2026-02-12 02:23:53 +00:00
Flatlogic Bot
5464b9a32d Revert to version 79b0724 2026-02-12 02:23:13 +00:00
Flatlogic Bot
a22438663d Autosave: 20260212-020231 2026-02-12 02:02:32 +00:00
Flatlogic Bot
5e2fe8c059 LOGO更改 2026-02-11 15:49:10 +00:00
Flatlogic Bot
79b07243ce 交易所 2026-02-11 15:18:19 +00:00
Flatlogic Bot
7c4904baad Autosave: 20260211-133533 2026-02-11 13:35:33 +00:00
Flatlogic Bot
cc38735373 Autosave: 20260211-115218 2026-02-11 11:52:19 +00:00
Flatlogic Bot
396b0e8f02 Autosave: 20260211-081917 2026-02-11 08:19:17 +00:00
63 changed files with 7107 additions and 441 deletions

67
about.php Normal file
View File

@ -0,0 +1,67 @@
<?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'; ?>

158
admin/chat.php Normal file
View File

@ -0,0 +1,158 @@
<?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>

241
admin/chat_iframe.php Normal file
View File

@ -0,0 +1,241 @@
<?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>

164
admin/futures_orders.php Normal file
View File

@ -0,0 +1,164 @@
<?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>

99
admin/index.php Normal file
View File

@ -0,0 +1,99 @@
<?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="../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; }
.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; }
.stat-card { background: #F9FAFB; padding: 20px; border-radius: 8px; border: 1px solid #EAECEF; }
</style>
</head>
<body style="background-color: #FFFFFF; color: #1E2329;">
<div class="admin-layout">
<div class="sidebar">
<h3 style="color: #1E2329; margin-bottom: 2rem;">NovaEx 管理员</h3>
<a href="index.php" class="menu-item active"><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 审核
<?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-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"><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">
<h2 style="color: #1E2329; margin-bottom: 2rem;">系统概览</h2>
<div style="grid-template-columns: repeat(4, 1fr); display: grid; gap: 1.5rem;">
<div class="stat-card">
<div style="color: #707A8A; font-size: 0.9rem;">总注册人数</div>
<div style="font-size: 2rem; color: #1E2329; margin-top: 10px;"><?php echo $total_users; ?></div>
</div>
<div class="stat-card">
<div style="color: #707A8A; font-size: 0.9rem;">待处理 KYC</div>
<div style="font-size: 2rem; color: #F0B90B; margin-top: 10px;"><?php echo $pending_kyc; ?></div>
</div>
<div class="stat-card">
<div style="color: #707A8A; font-size: 0.9rem;">待匹配/审核充值</div>
<div style="font-size: 2rem; color: #F0B90B; margin-top: 10px;"><?php echo $pending_orders; ?></div>
</div>
<div class="stat-card">
<div style="color: #707A8A; font-size: 0.9rem;">未读消息</div>
<div style="font-size: 2rem; color: #00C087; margin-top: 10px;"><?php echo $unread_msgs; ?></div>
</div>
</div>
<div style="margin-top: 3rem; background: #F9FAFB; padding: 25px; border-radius: 8px; border: 1px solid #EAECEF;">
<h3 style="color: #1E2329; margin-bottom: 20px;">控制中心</h3>
<div style="display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px;">
<div style="border: 1px solid #EAECEF; padding: 20px; border-radius: 6px; background: white;">
<h4 style="color: #474D57;">客服与充值管理</h4>
<p style="color: #707A8A; font-size: 0.8rem;">与用户对话并处理实时的充值匹配请求。</p>
<a href="chat.php" class="btn-primary" style="display: inline-block; margin-top: 15px; font-size: 0.8rem; padding: 8px 15px;">进入工作台</a>
</div>
<div style="border: 1px solid #EAECEF; padding: 20px; border-radius: 6px; background: white;">
<h4 style="color: #474D57;">交易管理</h4>
<p style="color: #707A8A; font-size: 0.8rem;">审核并处理现货及合约交易订单。</p>
<div style="display:flex; gap: 10px; margin-top: 15px;">
<a href="options_orders.php" class="btn-primary" style="font-size: 0.75rem; padding: 5px 10px; background: #6c757d;">秒合约</a>
<a href="spot_orders.php" class="btn-primary" style="font-size: 0.75rem; padding: 5px 10px; background: #377aff;">现货</a>
<a href="futures_orders.php" class="btn-primary" style="font-size: 0.75rem; padding: 5px 10px; background: #f0b90b; color: white;">合约</a>
</div>
</div>
<div style="border: 1px solid #EAECEF; padding: 20px; border-radius: 6px; background: white;">
<h4 style="color: #474D57;">价格控制</h4>
<p style="color: #707A8A; font-size: 0.8rem;">手动覆盖特定交易对的实时价格及插针控制。</p>
<a href="settings.php" class="btn-primary" style="display: inline-block; margin-top: 15px; font-size: 0.8rem; padding: 8px 15px;">立即配置</a>
</div>
</div>
</div>
</div>
</div>
</body>
</html>

91
admin/kyc.php Normal file
View File

@ -0,0 +1,91 @@
<?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>

93
admin/options_orders.php Normal file
View File

@ -0,0 +1,93 @@
<?php
require_once '../db/config.php';
session_start();
$pdo = db();
$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();
$orders = $pdo->query("SELECT o.*, u.username FROM option_orders o JOIN users u ON o.user_id = u.id ORDER BY o.created_at 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: #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; }
</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 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">
<h2>秒合约交易记录</h2>
<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']); ?></td>
<td><?php echo $o['symbol']; ?></td>
<td style="color: <?php echo $o['direction'] == 'up' ? '#00c087' : '#f6465d'; ?>">
<?php echo $o['direction'] == 'up' ? '买涨 ↑' : '买跌 ↓'; ?>
</td>
<td><b><?php echo number_format($o['amount'], 2); ?></b></td>
<td><?php echo $o['duration']; ?>s</td>
<td><?php echo $o['profit_rate'] * 100; ?>%</td>
<td><?php echo number_format($o['opening_price'], 4); ?></td>
<td><?php echo $o['closing_price'] ? number_format($o['closing_price'], 4) : '--'; ?></td>
<td style="color: <?php echo $o['result'] == 'win' ? '#00c087' : ($o['result'] == 'loss' ? '#f6465d' : 'inherit'); ?>">
<?php echo $o['result'] == 'none' ? '--' : number_format($o['profit'], 2); ?>
</td>
<td>
<?php echo $o['status'] == 'pending' ? '<span style="color: #f0b90b;">进行中</span>' : '<span style="color: #848e9c;">已完成</span>'; ?>
</td>
<td><?php echo $o['created_at']; ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</body>
</html>

147
admin/orders.php Normal file
View File

@ -0,0 +1,147 @@
<?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>

115
admin/settings.php Normal file
View File

@ -0,0 +1,115 @@
<?php
require_once '../db/config.php';
session_start();
$db = db();
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 = "系统设置已成功更新。";
}
$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>系统设置 - 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; }
.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; }
.form-group { margin-bottom: 25px; background: #1E2329; padding: 20px; border-radius: 8px; border: 1px solid #2B3139; }
.form-group label { display: block; margin-bottom: 10px; color: #848E9C; font-weight: bold; }
input[type="text"], input[type="number"], select, textarea { width: 100%; padding: 10px; background: #0B0E11; border: 1px solid #2B3139; color: white; border-radius: 4px; outline: none; }
.back-btn { color: #848E9C; text-decoration: none; font-size: 0.9rem; margin-bottom: 20px; display: inline-block; }
.back-btn:hover { color: white; }
</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 > 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 active"><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>
<?php if(isset($message)): ?>
<div style="background: rgba(0,255,0,0.1); color: #00ff00; padding: 15px; border-radius: 4px; margin-bottom: 20px;"><i class="fas fa-check-circle"></i> <?php echo $message; ?></div>
<?php endif; ?>
<form method="POST">
<h3 style="margin: 30px 0 15px 0; color: #F0B90B;">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">
<p style="font-size: 0.8rem; color: #5e6673; margin-top: 5px;">设置用户在秒合约/永续合约中的全局获利概率 (0-100)</p>
</div>
<h3 style="margin: 30px 0 15px 0; color: #F0B90B;">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">
<p style="font-size: 0.75rem; color: #f6465d; margin-top: 5px;">插针价格用于瞬间触发用户的止盈或爆仓。</p>
</div>
</div>
<h3 style="margin: 30px 0 15px 0; color: #F0B90B;">3. 客服系统设置</h3>
<div class="form-group">
<label>客服自动问候语</label>
<textarea name="settings[chat_greeting]" rows="3"><?php echo $settings['chat_greeting'] ?? '您好!欢迎咨询 NovaEx 官方客服,请问有什么可以帮您?如果是充值咨询,请提供您的充值金额和币种。'; ?></textarea>
<p style="font-size: 0.8rem; color: #5e6673; margin-top: 5px;">用户首次进入聊天页面时看到的欢迎消息。</p>
</div>
<h3 style="margin: 30px 0 15px 0; color: #F0B90B;">4. 其他配置</h3>
<div class="form-group">
<label>系统公告内容 (简体中文)</label>
<input type="text" name="settings[announcement_zh]" value="<?php echo $settings['announcement_zh'] ?? ''; ?>" placeholder="输入显示在首页顶部的公告...">
</div>
<button type="submit" class="btn-primary" style="padding: 12px 40px; font-weight: bold; border-radius: 8px; cursor: pointer; background: #f0b90b; color: black; border: none;">保存所有设置</button>
</form>
</div>
</div>
</body>
</html>

150
admin/spot_orders.php Normal file
View File

@ -0,0 +1,150 @@
<?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>

341
admin/users.php Normal file
View File

@ -0,0 +1,341 @@
<?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']; // 'up' or 'down'
$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 == 'delete_user') {
$id = $_POST['id'];
$pdo->prepare("DELETE FROM users WHERE id = ?")->execute([$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();
?>
<!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>
: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; letter-spacing: 0.5px; }
.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; }
.btn-sm { padding: 5px 10px; font-size: 0.75rem; }
.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); }
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; }
.form-group { margin-bottom: 20px; }
.form-group label { display: block; margin-bottom: 8px; font-weight: 600; color: #474d57; font-size: 0.9rem; }
.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; }
.form-group input:focus { border-color: var(--primary); }
</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="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('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'];
$wc_label = ['none' => '正常', 'win' => '起盈', 'loss' => '起亏'];
$wc_class = ['none' => '', 'win' => 'color: #00c087; font-weight: bold;', 'loss' => 'color: #f6465d; font-weight: bold;'];
echo "<span style='{$wc_class[$wc]}'>{$wc_label[$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 date('Y-m-d H:i', strtotime($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-sm btn-info" onclick='editUser(<?php echo json_encode($user); ?>)' title="编辑"><i class="fas fa-edit"></i></button>
<button class="btn btn-sm btn-success" onclick="adjustBalance(<?php echo $user['id']; ?>, '<?php echo $user['username']; ?>')" title="上下分"><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-sm btn-info" title="冻结/解冻"><i class="fas fa-ban"></i></button>
</form>
<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="delete_user">
<button type="submit" class="btn btn-sm btn-danger" title="删除"><i class="fas fa-trash"></i></button>
</form>
</div>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Add Modal -->
<div id="addModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>添加新用户</h3>
<i class="fas fa-times" onclick="hideModal('addModal')" style="cursor: pointer;"></i>
</div>
<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" style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
<div>
<label>初始余额 (USDT)</label>
<input type="number" name="balance" step="0.01" value="0">
</div>
<div>
<label>初始信用分</label>
<input type="number" name="credit_score" value="80">
</div>
</div>
<div class="modal-footer" style="text-align: right; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('addModal')">取消</button>
<button type="submit" class="btn btn-primary">确认添加</button>
</div>
</form>
</div>
</div>
<!-- Edit Modal -->
<div id="editModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>编辑用户信息</h3>
<i class="fas fa-times" onclick="hideModal('editModal')" style="cursor: pointer;"></i>
</div>
<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-group" style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
<div>
<label>余额 (USDT)</label>
<input type="number" name="balance" id="edit_balance" step="0.00000001">
</div>
<div>
<label>信用分</label>
<input type="number" name="credit_score" id="edit_credit_score">
</div>
</div>
<div class="form-group" style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px;">
<div>
<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>
<label>账户状态</label>
<select name="status" id="edit_status">
<option value="active">正常</option>
<option value="disabled">冻结</option>
</select>
</div>
</div>
<div class="modal-footer" style="text-align: right; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('editModal')">取消</button>
<button type="submit" class="btn btn-primary">确认保存</button>
</div>
</form>
</div>
</div>
<!-- Balance Adjust Modal -->
<div id="adjustModal" class="modal">
<div class="modal-content">
<div class="modal-header">
<h3>上下分 - <span id="adjust_name"></span></h3>
<i class="fas fa-times" onclick="hideModal('adjustModal')" style="cursor: pointer;"></i>
</div>
<form method="POST">
<input type="hidden" name="action" value="adjust_balance">
<input type="hidden" name="id" id="adjust_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="请输入金额">
</div>
<div class="modal-footer" style="text-align: right; margin-top: 20px;">
<button type="button" class="btn" onclick="hideModal('adjustModal')">取消</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 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_score').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('adjust_id').value = id;
document.getElementById('adjust_name').innerText = name;
showModal('adjustModal');
}
// Close modal on outside click
window.onclick = function(event) {
if (event.target.className === 'modal') {
event.target.style.display = 'none';
}
}
</script>
</body>
</html>

59
api-docs.php Normal file
View File

@ -0,0 +1,59 @@
<?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'; ?>

64
api/cancel_order.php Normal file
View File

@ -0,0 +1,64 @@
<?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()]);
}

22
api/check_order.php Normal file
View File

@ -0,0 +1,22 @@
<?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

@ -0,0 +1,26 @@
<?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']);
}

39
api/get_assets.php Normal file
View File

@ -0,0 +1,39 @@
<?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()]);
}

42
api/get_messages.php Normal file
View File

@ -0,0 +1,42 @@
<?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]);

62
api/get_option_orders.php Normal file
View File

@ -0,0 +1,62 @@
<?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');
$stmt = $pdo->prepare("SELECT o.*, u.win_loss_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
if ($order['win_loss_control'] === 'win') {
$result = 'win';
} elseif ($order['win_loss_control'] === 'loss') {
$result = 'loss';
} else {
// Normal: Random or could be based on real price.
// For simplicity in these "second contract" systems, it's often slightly biased or random if not controlled.
// Let's do 50/50 for "none" control.
$result = (rand(0, 100) > 50) ? 'win' : 'loss';
}
if ($result === 'win') {
$profit = $order['amount'] * $order['profit_rate'];
$total_return = $order['amount'] + $profit;
// Add balance
$stmt_bal = $pdo->prepare("UPDATE users SET balance = balance + ? WHERE id = ?");
$stmt_bal->execute([$total_return, $order['user_id']]);
// Update closing price slightly higher or lower based on direction
$closing_price = ($order['direction'] === 'up') ? $order['opening_price'] * 1.001 : $order['opening_price'] * 0.999;
} else {
$profit = -$order['amount'];
$closing_price = ($order['direction'] === 'up') ? $order['opening_price'] * 0.999 : $order['opening_price'] * 1.001;
}
$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 orders
$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]);

38
api/get_orders.php Normal file
View File

@ -0,0 +1,38 @@
<?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

@ -0,0 +1,54 @@
<?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;
}
$data = json_decode(file_get_contents('php://input'), true);
$symbol = $data['symbol'] ?? '';
$amount = floatval($data['amount'] ?? 0);
$direction = $data['direction'] ?? '';
$duration = intval($data['duration'] ?? 0);
$profit_rate = floatval($data['profit_rate'] ?? 0);
$opening_price = floatval($data['opening_price'] ?? 0);
if (!$symbol || $amount <= 0 || !in_array($direction, ['up', 'down']) || !in_array($duration, [60, 90, 120, 180, 300])) {
echo json_encode(['success' => false, 'error' => '参数错误']);
exit;
}
$pdo = db();
try {
$pdo->beginTransaction();
// Check balance
$stmt = $pdo->prepare("SELECT balance FROM users WHERE id = ? FOR UPDATE");
$stmt->execute([$user_id]);
$user = $stmt->fetch();
if (!$user || $user['balance'] < $amount) {
throw new Exception('余额不足');
}
// Deduct balance
$stmt = $pdo->prepare("UPDATE users SET balance = balance - ? WHERE id = ?");
$stmt->execute([$amount, $user_id]);
// Create order
$settle_at = date('Y-m-d H:i:s', time() + $duration);
$stmt = $pdo->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]);
$pdo->commit();
echo json_encode(['success' => true, 'new_balance' => $user['balance'] - $amount]);
} catch (Exception $e) {
$pdo->rollBack();
echo json_encode(['success' => false, 'error' => $e->getMessage()]);
}

95
api/place_order.php Normal file
View File

@ -0,0 +1,95 @@
<?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()]);
}

77
api/upload_chat_image.php Normal file
View File

@ -0,0 +1,77 @@
<?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 Normal file
View File

@ -0,0 +1,366 @@
<?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,346 +1,240 @@
* { box-sizing: border-box; }
:root { :root {
--color-bg: #ffffff; --bg-color: #0B0E11;
--color-text: #1a1a1a; --nav-bg: #0B0E11;
--color-primary: #2563EB; /* Vibrant Blue */ --primary-color: #0052FF;
--color-secondary: #000000; --text-color: #FFFFFF;
--color-accent: #A3E635; /* Lime Green */ --text-muted: #848E9C;
--color-surface: #f8f9fa; --border-color: #2B3139;
--font-heading: 'Space Grotesk', sans-serif; --card-bg: #1E2329;
--font-body: 'Inter', sans-serif; --danger-color: #F6465D;
--border-width: 2px; --success-color: #0ECB81;
--shadow-hard: 5px 5px 0px #000; --gold-color: #F0B90B;
--shadow-hover: 8px 8px 0px #000;
--radius-pill: 50rem;
--radius-card: 1rem;
} }
body { body {
font-family: var(--font-body); margin: 0;
background-color: var(--color-bg); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
color: var(--color-text); background-color: var(--bg-color);
overflow-x: hidden; color: var(--text-color);
line-height: 1.5;
padding-bottom: 0;
} }
h1, h2, h3, h4, h5, h6, .navbar-brand { /* Scrollbar */
font-family: var(--font-heading); ::-webkit-scrollbar { width: 6px; height: 6px; }
letter-spacing: -0.03em; ::-webkit-scrollbar-track { background: var(--bg-color); }
} ::-webkit-scrollbar-thumb { background: #2b3139; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #3b4149; }
/* 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 { .navbar {
background: rgba(255, 255, 255, 0.9); background-color: var(--nav-bg);
backdrop-filter: blur(10px); padding: 0 1.5rem;
border-bottom: var(--border-width) solid transparent; height: 64px;
transition: all 0.3s; display: flex;
padding-top: 1rem; justify-content: space-between;
padding-bottom: 1rem; align-items: center;
border-bottom: 1px solid var(--border-color);
position: sticky;
top: 0;
z-index: 1000;
} }
.navbar.scrolled { .nav-links {
border-bottom-color: #000; display: flex;
padding-top: 0.5rem; gap: 1.5rem;
padding-bottom: 0.5rem; align-items: center;
} }
.brand-text { .nav-links a {
font-size: 1.5rem; color: var(--text-color);
font-weight: 800; text-decoration: none;
} font-size: 14px;
.nav-link {
font-weight: 500; font-weight: 500;
color: var(--color-text); transition: color 0.2s;
margin-left: 1rem; 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 {
position: relative; position: relative;
display: inline-block;
} }
.nav-link:hover, .nav-link.active { .dropdown-content {
color: var(--color-primary); 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%;
} }
/* Buttons */ .dropdown:hover .dropdown-content {
.btn { display: block;
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);
} }
.btn:hover { .dropdown-content a {
transform: translate(-2px, -2px); color: white;
box-shadow: var(--shadow-hover); padding: 12px 16px;
text-decoration: none;
display: block;
font-size: 14px;
} }
.btn:active { .dropdown-content a:hover {
transform: translate(2px, 2px); background-color: #2B3139;
box-shadow: 0 0 0 #000;
} }
.btn-primary { .btn-primary {
background-color: var(--color-primary); background-color: var(--primary-color);
border-color: #000; color: white;
color: #fff; border: none;
} padding: 8px 20px;
border-radius: 8px;
.btn-primary:hover { cursor: pointer;
background-color: #1d4ed8; font-weight: 600;
border-color: #000;
color: #fff;
}
.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; text-decoration: none;
color: #000;
font-weight: 700;
display: inline-flex; display: inline-flex;
align-items: center; align-items: center;
margin-top: auto; justify-content: center;
transition: 0.2s;
} }
.link-arrow i { transition: transform 0.2s; margin-left: 5px; } .btn-primary:hover { opacity: 0.9; transform: translateY(-1px); }
.link-arrow:hover i { transform: translateX(5px); }
/* About */ /* Mobile Bottom Nav */
.about-image-stack { .mobile-bottom-nav {
position: relative; display: none;
height: 400px; position: fixed;
width: 100%; 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);
} }
.stack-card { .mobile-nav-item {
position: absolute; display: flex;
width: 80%; flex-direction: column;
align-items: center;
text-decoration: none;
color: var(--text-muted);
font-size: 11px;
gap: 4px;
}
.mobile-nav-item i { font-size: 20px; }
.mobile-nav-item.active { color: var(--primary-color); }
/* Sidebar Drawer */
.mobile-sidebar {
position: fixed;
top: 0;
left: -100%;
width: 280px;
height: 100%; height: 100%;
border-radius: var(--radius-card); background: #0B0E11;
border: 2px solid #000; z-index: 2000;
box-shadow: var(--shadow-hard); transition: 0.3s;
left: 10%; box-shadow: 10px 0 30px rgba(0,0,0,0.5);
transform: rotate(-3deg); padding: 20px;
background-size: cover; overflow-y: auto;
} }
/* Forms */ .mobile-sidebar.open { left: 0; }
.form-control { .sidebar-overlay {
border: 2px solid #000; display: none;
border-radius: 0.5rem; position: fixed;
padding: 1rem; top: 0;
font-weight: 500; left: 0;
background: #f8f9fa; 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;
} }
.form-control:focus { /* Responsive Grid Helper */
box-shadow: 4px 4px 0 var(--color-primary); .container {
border-color: #000; max-width: 1200px;
background: #fff; margin: 0 auto;
padding: 0 20px;
} }
/* Animations */ .grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 30px; }
.animate-up { .grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 30px; }
opacity: 0;
transform: translateY(30px); /* Mobile Optimizations */
animation: fadeUp 0.8s ease forwards; @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; }
} }
.delay-100 { animation-delay: 0.1s; } @media (max-width: 576px) {
.delay-200 { animation-delay: 0.2s; } .logo-text { font-size: 1.4rem !important; }
.logo-svg { width: 28px !important; height: 28px !important; }
@keyframes fadeUp {
to { .btn-login-hide { display: none; }
opacity: 1;
transform: translateY(0); .market-table th, .market-table td { padding: 12px 15px !important; }
} .market-table td div { font-size: 0.9rem !important; }
} }
/* Social */ /* User Profile Dropdown Adjustments */
.social-links a { .user-info-header {
transition: transform 0.2s; padding: 15px;
border-bottom: 1px solid var(--border-color);
}
.uid-badge {
display: inline-block; display: inline-block;
} background: rgba(79, 172, 254, 0.1);
.social-links a:hover { color: var(--primary-color);
transform: scale(1.2) rotate(10deg); font-size: 11px;
color: var(--color-accent) !important; padding: 2px 8px;
} border-radius: 4px;
margin-top: 5px;
/* 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.

After

Width:  |  Height:  |  Size: 158 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 212 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 229 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 86 KiB

55
careers.php Normal file
View File

@ -0,0 +1,55 @@
<?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 Normal file
View File

@ -0,0 +1,293 @@
<?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'; ?>

99
chat_iframe.php Normal file
View File

@ -0,0 +1,99 @@
<?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>

87
convert.php Normal file
View File

@ -0,0 +1,87 @@
<?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

@ -0,0 +1,9 @@
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

@ -0,0 +1,16 @@
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
);

218
deposit.php Normal file
View File

@ -0,0 +1,218 @@
<?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'; ?>

90
fees.php Normal file
View File

@ -0,0 +1,90 @@
<?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'; ?>

81
footer.php Normal file
View File

@ -0,0 +1,81 @@
<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>

327
futures.php Normal file
View File

@ -0,0 +1,327 @@
<?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: '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: 280px; flex-shrink: 0; border-right: 1px solid var(--border-color); }
#pairs-list { height: 600px; overflow-y: auto; }
.pair-item { display: flex; justify-content: space-between; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); }
.pair-item.active { background: rgba(79, 172, 254, 0.1); }
/* Center Panel */
.center-panel { flex: 1; background: var(--bg-color); display: flex; flex-direction: column; }
.info-bar { height: 60px; display: flex; align-items: center; padding: 0 15px; gap: 15px; border-bottom: 1px solid var(--border-color); background: var(--panel-bg); flex-wrap: wrap; }
.chart-container { height: 420px; background: var(--bg-color); border-bottom: 1px solid var(--border-color); }
.order-form-panel { padding: 20px; background: var(--panel-bg); border-bottom: 1px solid var(--border-color); }
.order-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 30px; }
.input-row { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 4px; display: flex; align-items: center; margin-bottom: 10px; padding: 8px 12px; }
.input-row input { flex: 1; background: transparent; border: none; color: white; text-align: right; outline: none; font-size: 14px; }
.btn-trade { padding: 12px; border: none; border-radius: 6px; font-weight: bold; font-size: 15px; cursor: pointer; color: white; }
/* Responsive */
@media (max-width: 1200px) {
.market-panel { display: none; }
}
@media (max-width: 992px) {
.trading-layout { flex-direction: column; }
.order-book-panel { display: none; }
.chart-container { height: 350px; }
.order-form-grid { grid-template-columns: 1fr; gap: 10px; }
.info-bar { height: auto; padding: 10px 15px; }
}
</style>
<div class="trading-layout">
<!-- Left Panel -->
<div class="panel market-panel">
<div style="padding: 12px; border-bottom: 1px solid var(--border-color);">
<input type="text" id="market-search" placeholder="搜索合约" style="width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 8px 12px; border-radius: 6px; font-size: 13px;">
</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: 10px;">
<img id="current-logo" src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/btc.png" width="28" height="28" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<div>
<div id="current-pair-display" style="font-size: 15px; font-weight: bold;">BTC/USDT 永续</div>
<div id="leverage-display" style="font-size: 11px; color: var(--accent-color); cursor: pointer;" onclick="showLevModal()">20x</div>
</div>
</div>
<div style="display: flex; flex-direction: column;">
<span id="last-price" style="font-size: 18px; font-weight: bold; color: var(--up-color);">--</span>
<span id="price-change" style="font-size: 11px;">--</span>
</div>
<div style="margin-left: auto; display: flex; gap: 15px; font-size: 11px;" class="desktop-only">
<div style="color: var(--text-secondary);">标记 <span id="mark-price" style="color: white;">--</span></div>
<div style="color: var(--text-secondary);">24h额 <span id="vol-24h" style="color: white;">--</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: 10px; margin-bottom: 15px;">
<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: 5px 12px; border-radius: 4px; font-size: 12px; cursor: pointer;">逐仓</button>
<button class="ctrl-btn" onclick="showLevModal()" style="background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 5px 12px; border-radius: 4px; font-size: 12px; cursor: pointer;"><span id="leverage-val">20</span>x</button>
<div style="display: flex; gap: 15px; margin-left: 10px; align-items: center;">
<button onclick="setOrderType('limit')" id="order-type-limit" style="background: none; border: none; color: var(--text-secondary); font-size: 13px; cursor: pointer;">限价</button>
<button onclick="setOrderType('market')" id="order-type-market" style="background: none; border: none; color: var(--accent-color); font-weight: bold; font-size: 13px; cursor: pointer;">市价</button>
</div>
</div>
<div class="order-form-grid">
<div>
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px;">
<span style="color: var(--text-secondary);">可用余额</span>
<span id="available-bal" style="color: white;"><?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: 40px;">价格</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: 40px;">数量</span>
<input type="number" id="order-amount" placeholder="张数">
</div>
</div>
<div>
<div style="margin: 10px 0;">
<input type="range" min="0" max="100" value="0" id="order-slider" style="width: 100%; accent-color: var(--accent-color);" oninput="updateFromSlider(this.value)">
<div style="display: flex; justify-content: space-between; font-size: 10px; color: var(--text-secondary); margin-top: 5px;">
<span onclick="setSlider(0)">0%</span><span onclick="setSlider(25)">25%</span><span onclick="setSlider(50)">50%</span><span onclick="setSlider(75)">75%</span><span onclick="setSlider(100)">100%</span>
</div>
</div>
<div style="font-size: 13px; display: flex; justify-content: space-between; margin-top: 15px;">
<span style="color: var(--text-secondary);">预计保证金</span>
<span><span id="order-cost">0.00</span> USDT</span>
</div>
</div>
</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-top: 20px;">
<button class="btn-trade" style="background: var(--up-color);" onclick="placeOrder('buy')">开多 (买入)</button>
<button class="btn-trade" style="background: var(--down-color);" onclick="placeOrder('sell')">开空 (卖出)</button>
</div>
</div>
<div style="background: var(--panel-bg);">
<div style="display: flex; border-bottom: 1px solid var(--border-color); padding: 0 15px; overflow-x: auto;">
<button class="tab-btn active" onclick="switchTab(this, 'positions')" style="background: none; border: none; color: var(--accent-color); padding: 12px 15px; font-size: 14px; border-bottom: 2px solid var(--accent-color); cursor: pointer; white-space: nowrap;">当前持仓</button>
<button class="tab-btn" onclick="switchTab(this, 'open')" style="background: none; border: none; color: var(--text-secondary); padding: 12px 15px; font-size: 14px; cursor: pointer; white-space: nowrap;">当前委托</button>
</div>
<div style="padding: 15px; overflow-x: auto;">
<table style="width: 100%; font-size: 11px; border-collapse: collapse; min-width: 600px;">
<thead id="data-thead" style="color: var(--text-secondary); text-align: left;"></thead>
<tbody id="data-tbody"></tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Right Panel (Order Book) -->
<div class="panel order-book-panel">
<div style="padding: 10px 15px; font-size: 12px; color: var(--text-secondary);">价格 / 数量</div>
<div id="asks-list" style="display: flex; flex-direction: column-reverse;"></div>
<div id="ob-mid-price" style="padding: 10px 0; text-align: center; font-weight: bold; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);">--</div>
<div id="bids-list"></div>
</div>
</div>
<div id="lev-modal" style="position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); display: none; align-items: center; justify-content: center; z-index: 2000;">
<div style="background: var(--panel-bg); padding: 30px; border-radius: 12px; width: 320px; text-align: center;">
<h3 style="margin-bottom: 20px;">调整杠杆</h3>
<div id="lev-val-big" style="font-size: 36px; font-weight: bold; color: var(--accent-color); margin-bottom: 20px;">20x</div>
<input type="range" min="1" max="125" value="20" id="lev-range" style="width: 100%;" oninput="document.getElementById('lev-val-big').innerText = this.value + 'x'">
<div style="display: flex; gap: 15px; margin-top: 30px;">
<button onclick="hideLevModal()" style="flex: 1; padding: 10px; background: #2b3139; border: none; color: white; border-radius: 6px;">取消</button>
<button onclick="confirmLev()" style="flex: 1; padding: 10px; background: var(--accent-color); border: none; color: white; border-radius: 6px;">确认</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 pairs = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT', 'ADAUSDT', 'DOGEUSDT', 'AVAXUSDT'];
function initChart(symbol) {
new TradingView.widget({
"width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "15", "theme": "dark", "style": "1", "locale": "zh_CN", "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();
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};
html += `<div class="pair-item ${currentPair === p ? 'active' : ''}" onclick="switchPair('${p}')">
<span>${p}/USDT</span>
<span style="color: ${d.P >= 0 ? 'var(--up-color)' : 'var(--down-color)'}">${parseFloat(d.c).toLocaleString()}</span>
</div>`;
});
list.innerHTML = html;
}
function switchPair(p) {
currentPair = p;
document.getElementById('current-pair-display').innerText = p + '/USDT 永续';
initChart(p);
}
function updateOrderBook() {
const asks = document.getElementById('asks-list');
const bids = document.getElementById('bids-list');
let aH = ''; let bH = '';
for(let i=0; i<10; i++) {
aH += `<div style="display: flex; justify-content: space-between; padding: 2px 15px; font-size: 11px;"><span style="color: var(--down-color);">${(currentPrice*(1+(i+1)*0.0005)).toFixed(1)}</span><span>${(Math.random()*100).toFixed(0)}</span></div>`;
bH += `<div style="display: flex; justify-content: space-between; padding: 2px 15px; font-size: 11px;"><span style="color: var(--up-color);">${(currentPrice*(1-(i+1)*0.0005)).toFixed(1)}</span><span>${(Math.random()*100).toFixed(0)}</span></div>`;
}
asks.innerHTML = aH; bids.innerHTML = bH;
}
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').innerText = leverage;
hideLevModal();
}
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) return alert('数量错误');
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('成功'); 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: 10px 5px;">合约</th><th style="padding: 10px 5px;">仓位</th><th style="padding: 10px 5px;">开仓价</th><th style="padding: 10px 5px;">盈亏</th><th style="padding: 10px 5px; text-align: right;">操作</th></tr>`;
} else {
thead.innerHTML = `<tr><th style="padding: 10px 5px;">时间</th><th style="padding: 10px 5px;">合约</th><th style="padding: 10px 5px;">方向</th><th style="padding: 10px 5px;">价格</th><th style="padding: 10px 5px;">数量</th><th style="padding: 10px 5px; text-align: right;">操作</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)';
return `<tr style="border-bottom: 1px solid var(--border-color);">
<td style="padding: 10px 5px;">${o.symbol}</td>
<td style="padding: 10px 5px; color: ${color};">${o.side === 'buy' ? '多' : '空'} ${o.leverage}x</td>
<td style="padding: 10px 5px;">${parseFloat(o.price).toLocaleString()}</td>
<td style="padding: 10px 5px;">--</td>
<td style="padding: 10px 5px; text-align: right;"><button onclick="closePos(${o.id})">平仓</button></td>
</tr>`;
}).join('');
} else { tbody.innerHTML = '<tr><td colspan="5" style="text-align: center; padding: 40px;">暂无记录</td></tr>'; }
}
function switchTab(btn, tab) {
document.querySelectorAll('.tab-btn').forEach(b => { b.classList.remove('active'); b.style.color = 'var(--text-secondary)'; b.style.borderBottom = 'none'; });
btn.classList.add('active'); btn.style.color = 'var(--accent-color)'; btn.style.borderBottom = '2px solid var(--accent-color)';
activeTab = tab; fetchOrders();
}
fetchOrders(); setInterval(fetchOrders, 4000);
</script>
<?php include 'footer.php'; ?>

193
header.php Normal file
View File

@ -0,0 +1,193 @@
<?php require_once 'includes/i18n.php'; ?>
<!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>
<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; }
/* 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; }
</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;">
<div class="logo-text" style="font-size: 1.5rem;">NovaEx</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="convert.php"><i class="fas fa-bolt" style="color: #fbc02d;"></i> <?php echo __('nav_convert'); ?></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', '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: 8px 15px; background: #1e2329; border-radius: 6px; font-size: 14px; flex: 1; border: none; justify-content: center;">English</a>
<a href="?lang=zh" style="padding: 8px 15px; background: #1e2329; border-radius: 6px; font-size: 14px; flex: 1; border: none; justify-content: center;">简体中文</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: 1rem;">
<!-- 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">
<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>
</div>
</a>
<div class="nav-links">
<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>
<a href="profile.php"><?php echo __('nav_assets'); ?></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: 5px;">
<i class="fas fa-globe"></i>
<span style="font-size: 13px;"><?php echo strtoupper($lang); ?></span>
</a>
<div class="dropdown-content" style="right: 0; min-width: 120px;">
<a href="?lang=en" style="display: flex; align-items: center; gap: 10px;">
<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: 10px;">
<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;">
<i class="fas fa-user-circle" style="font-size: 1.5rem;"></i>
<i class="fas fa-chevron-down desktop-only" style="font-size: 10px;"></i>
</a>
<div class="dropdown-content user-profile-dropdown" style="right: 0;">
<div class="user-info-header">
<div style="font-weight: bold; margin-bottom: 4px;"><?php echo $_SESSION['username'] ?? 'User'; ?></div>
<div class="uid-badge">UID: <?php echo $_SESSION['uid'] ?? '------'; ?></div>
</div>
<a href="profile.php"><i class="fas fa-wallet" style="color: #03a9f4;"></i> <?php echo __('nav_assets'); ?></a>
<a href="deposit.php"><i class="fas fa-plus-circle" style="color: #00f2fe;"></i> <?php echo __('nav_deposit'); ?></a>
<a href="security.php"><i class="fas fa-shield-alt" style="color: #ffd600;"></i> <?php echo __('nav_security', '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"></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;"><?php echo __('nav_login'); ?></a>
<a href="register.php" class="btn-primary" style="padding: 6px 15px; font-size: 13px;"><?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', '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>
<style>
@media (max-width: 992px) {
#mobileMenuBtn { display: block !important; }
.desktop-only { display: none !important; }
.logo-name { font-size: 1.4rem; }
}
</style>
<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>

54
help.php Normal file
View File

@ -0,0 +1,54 @@
<?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

@ -0,0 +1,33 @@
<?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;
}

340
includes/i18n.php Normal file
View File

@ -0,0 +1,340 @@
<?php
session_start();
$translations = [
'en' => [
'nav_home' => 'Home',
'nav_market' => 'Markets',
'nav_trade' => 'Trade',
'nav_spot' => 'Spot',
'nav_futures' => 'Futures',
'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',
'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',
'market_trends' => 'Market Trends',
'view_more_markets' => 'View More Markets',
'why_choose_us' => 'Why Choose Us?',
'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' => 'Industry 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.',
'partners' => 'Our 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',
'personal_center' => 'Personal Center',
'uid' => 'UID',
'credit_score' => 'Credit Score',
'kyc_status' => 'Identity Verification',
'kyc_none' => 'Not Verified',
'kyc_pending' => 'Pending Review',
'kyc_approved' => 'Verified',
'kyc_rejected' => 'Verification Failed',
'kyc_submit' => 'Submit Verification',
'total_balance' => 'Total Balance',
'available_balance' => 'Available',
'order_book' => 'Order Book',
'trade_panel' => 'Trade Panel',
'k_line' => 'K-Line',
'open_orders' => 'Open Orders',
'order_history' => 'Order History',
'trade_history' => 'Trade History',
'funds_flow' => 'Funds Flow',
'current_positions' => 'Current Positions',
'limit' => 'Limit',
'market' => 'Market',
'price' => 'Price',
'amount' => 'Amount',
'total' => 'Total',
'buy' => 'Buy',
'sell' => 'Sell',
'leverage' => 'Leverage',
'tp_sl' => 'TP/SL',
'take_profit' => 'Take Profit',
'stop_loss' => 'Stop Loss',
'cost' => 'Cost',
'open_long' => 'Open Long',
'open_short' => 'Open Short',
'security_settings' => 'Security Settings',
'asset_details' => 'Asset Details',
'transaction_records' => 'Transaction Records',
'level' => 'Level',
'crypto_markets' => 'Crypto Markets',
'24h_volume' => '24h Volume',
'fear_greed' => 'Fear & Greed Index',
'btc_dominance' => 'BTC Dominance',
'favorites' => 'Favorites',
'all_crypto' => 'All Crypto',
'asset' => 'Asset',
'24h_high_low' => '24h High/Low',
'deposit_assets' => 'Deposit Assets',
'deposit_method_tip' => 'Select your preferred method to fund your account.',
'fiat_deposit' => 'Fiat Deposit',
'crypto_deposit' => 'Crypto Deposit',
'bank_transfer' => 'Local Bank Transfer',
'blockchain_transfer' => 'Blockchain Transfer',
'support_20_global' => 'Support 20+ Global Currencies',
'safe_compliant' => 'Safe & Compliant Channel',
'fast_processing' => '24/7 Fast Processing',
'no_service_fee' => 'No Service Fee',
'select_currency' => 'Select Currency',
'deposit_amount' => 'Deposit Amount',
'matching_instructions' => 'Matching Instructions',
'matching_tip' => 'Our intelligent matching system will pair you with a verified merchant. After confirming, you will receive the bank account details. Please complete the transfer within the time limit.',
'match_now' => 'Match Merchant Now',
'select_network' => 'Select Network',
'get_address' => 'Get Deposit Address',
'withdraw_assets' => 'Withdraw Assets',
'withdraw_tip' => 'Securely withdraw USDT to your external wallet.',
'withdraw_address' => 'Withdrawal Address',
'trading_password' => 'Trading Password',
'submit_withdrawal' => 'Submit Withdrawal',
'withdrawal_tips' => 'Withdrawal Tips',
'withdrawal_tip_1' => 'Double check the destination address. We cannot recover funds sent to wrong addresses.',
'withdrawal_tip_2' => 'TRC20 withdrawals usually take 5-10 minutes to arrive.',
'withdrawal_tip_3' => 'Withdrawals are processed manually for security audits during peak hours.',
'withdrawal_tip_4' => 'Handling fee: 1 USDT per transaction.',
'recent_history' => 'Recent History',
'no_records' => 'No records found',
'max' => 'MAX',
'customer_service' => 'Online Support',
'chat_welcome' => 'Hello! How can we help you today?',
'type_message' => 'Type your message...',
'matching_account' => 'Matching Payment Account...',
'matching_desc' => 'Our system is matching a secure local account for your deposit. Please wait a moment.',
'crypto' => 'Cryptocurrency',
'search_market' => 'Search Market',
'more_pairs' => 'More Pairs',
'limit_order' => 'Limit',
'market_order' => 'Market',
'available' => 'Available',
'buy_long' => 'Buy / Long',
'sell_short' => 'Sell / Short',
'open_position' => 'Open',
'close_position' => 'Close',
'cross' => 'Cross',
'isolated' => 'Isolated',
'positions' => 'Positions',
'no_positions' => 'No positions found',
'perpetual' => 'Perpetual',
'delivery' => 'Delivery',
'fee' => 'Fee',
'max_open' => 'Max Open',
'time' => 'Time',
'pair' => 'Pair',
'side' => 'Side',
'filled' => 'Filled',
'status' => 'Status',
'load_more' => 'Load More',
],
'zh' => [
'nav_home' => '首页',
'nav_market' => '行情',
'nav_trade' => '交易',
'nav_spot' => '现货交易',
'nav_futures' => '合约交易',
'nav_mining' => '挖矿',
'nav_convert' => '闪兑',
'nav_assets' => '资产',
'nav_total_assets' => '总资产',
'nav_deposit' => '充值',
'nav_withdraw' => '提现',
'nav_login' => '登录',
'nav_register' => '注册',
'nav_profile' => '个人中心',
'nav_logout' => '退出登录',
'hero_title' => '在 NovaEx 购买、交易和持有 350 多种加密货币',
'hero_subtitle' => '加入全球最大的加密货币交易所,享受最低的费用和最好的安全性。',
'btn_start' => '立即开始',
'btn_download' => '下载应用',
'app_download' => 'APP 下载',
'download_qr_tip' => '下载应用并获得高达 50 USDT 的奖励',
'market_trends' => '市场趋势',
'view_more_markets' => '查看更多市场',
'why_choose_us' => '为什么选择我们?',
'secure_storage' => '安全存储',
'secure_storage_desc' => '我们将绝大部分数字资产存储在安全的离线存储中。',
'protected_insurance' => '保险保护',
'protected_insurance_desc' => '存储在我们服务器上的加密货币受我们的保险政策保护。',
'industry_best_practices' => '行业最佳实践',
'industry_best_practices_desc' => 'NovaEx 支持多种最流行的数字货币。',
'platform_desc' => '我们的平台为零售和机构交易者提供具有先进功能和稳健基础设施的无缝交易体验。',
'partners' => '合作伙伴',
'partners_subtitle' => '深受全球领先组织和金融机构的信任。',
'footer_desc' => 'NovaEx 是全球领先的数字资产交易平台,为全球用户提供安全稳定的交易服务。',
'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' => '系统状态:正常',
'personal_center' => '个人中心',
'uid' => 'UID',
'credit_score' => '信用分',
'kyc_status' => '身份认证',
'kyc_none' => '未认证',
'kyc_pending' => '审核中',
'kyc_approved' => '已认证',
'kyc_rejected' => '认证失败',
'kyc_submit' => '提交认证',
'total_balance' => '总资产',
'available_balance' => '可用余额',
'order_book' => '订单簿',
'trade_panel' => '下单面板',
'k_line' => 'K线图',
'open_orders' => '当前委托',
'order_history' => '历史委托',
'trade_history' => '成交记录',
'funds_flow' => '资金流水',
'current_positions' => '当前持仓',
'limit' => '限价',
'market' => '市价',
'price' => '价格',
'amount' => '数量',
'total' => '总额',
'buy' => '买入',
'sell' => '卖出',
'leverage' => '杠杆',
'tp_sl' => '止盈止损',
'take_profit' => '止盈',
'stop_loss' => '止损',
'cost' => '成本',
'open_long' => '做多',
'open_short' => '做空',
'security_settings' => '安全设置',
'asset_details' => '资产详情',
'transaction_records' => '交易记录',
'level' => '等级',
'crypto_markets' => '加密货币行情',
'24h_volume' => '24小时成交量',
'fear_greed' => '贪婪恐惧指数',
'btc_dominance' => '比特币占有率',
'favorites' => '自选',
'all_crypto' => '所有币种',
'asset' => '资产',
'24h_high_low' => '24小时最高/最低',
'deposit_assets' => '充值资产',
'deposit_method_tip' => '请选择您偏好的充值方式。',
'fiat_deposit' => '法币充值',
'crypto_deposit' => '加密货币充值',
'bank_transfer' => '本地银行转账',
'blockchain_transfer' => '区块链转账',
'support_20_global' => '支持20多种全球货币',
'safe_compliant' => '安全合规的通道',
'fast_processing' => '24/7 快速处理',
'no_service_fee' => '无服务费',
'select_currency' => '选择币种',
'deposit_amount' => '充值金额',
'matching_instructions' => '匹配说明',
'matching_tip' => '我们的智能匹配系统将为您匹配认证商户。确认后,您将收到银行账户详情。请在时限内完成转账。',
'match_now' => '立即匹配商户',
'select_network' => '选择网络',
'get_address' => '获取充值地址',
'withdraw_assets' => '提现资产',
'withdraw_tip' => '安全地将 USDT 提现到您的外部钱包。',
'withdraw_address' => '提现地址',
'trading_password' => '交易密码',
'submit_withdrawal' => '提交提现',
'withdrawal_tips' => '提现提示',
'withdrawal_tip_1' => '请仔细检查目标地址。我们无法找回发送到错误地址的资金。',
'withdrawal_tip_2' => 'TRC20 提现通常在 5-10 分钟内到账。',
'withdrawal_tip_3' => '高峰时段,提现将进行人工安全审计。',
'withdrawal_tip_4' => '手续费:每笔交易 1 USDT。',
'recent_history' => '最近记录',
'no_records' => '暂无记录',
'max' => '最大',
'customer_service' => '在线客服',
'chat_welcome' => '您好!请问有什么可以帮您?',
'type_message' => '输入消息...',
'matching_account' => '正在匹配收款账户...',
'matching_desc' => '系统正在为您匹配安全的本地收款账户。请稍候。',
'crypto' => '加密货币',
'search_market' => '搜索币种',
'more_pairs' => '更多币种',
'limit_order' => '限价',
'market_order' => '市价',
'available' => '可用',
'buy_long' => '买入开多',
'sell_short' => '卖出开空',
'open_position' => '开仓',
'close_position' => '平仓',
'cross' => '全仓',
'isolated' => '逐仓',
'positions' => '当前持仓',
'no_positions' => '暂无持仓',
'perpetual' => '永续合约',
'delivery' => '交割合约',
'fee' => '手续费',
'max_open' => '最大可开',
'time' => '时间',
'pair' => '币对',
'side' => '方向',
'filled' => '已成交',
'status' => '状态',
'load_more' => '加载更多',
]
];
$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);
}

411
index.php
View File

@ -1,150 +1,279 @@
<?php <?php
declare(strict_types=1); session_start();
@ini_set('display_errors', '1'); include 'header.php';
@error_reporting(E_ALL); require_once 'db/config.php';
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION; // Fetch market data for the home page table
$now = date('Y-m-d H:i:s'); $trending_pairs = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT'];
?> ?>
<!doctype html>
<html lang="en"> <main>
<head> <!-- Carousel Section (Constrained Width) -->
<meta charset="utf-8" /> <section class="hero-carousel-section" style="padding: 10px 0; background: #0b0e11;">
<meta name="viewport" content="width=device-width, initial-scale=1" /> <div class="carousel-container" style="max-width: 1200px; margin: 0 auto; position: relative; height: 450px; overflow: hidden; border-radius: 24px; box-shadow: 0 20px 50px rgba(0,0,0,0.5);">
<title>New Style</title> <div class="carousel-track" id="carouselTrack" style="display: flex; height: 100%; transition: transform 0.5s ease-in-out;">
<?php <div class="carousel-slide" style="min-width: 100%; position: relative;">
// Read project preview data from environment <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;">
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <div class="carousel-content" style="position: absolute; top: 50%; left: 8%; transform: translateY(-50%); color: white; max-width: 600px;">
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; <h2 class="carousel-title" style="font-size: 3rem; font-weight: 800; margin-bottom: 20px; text-shadow: 0 5px 15px rgba(0,0,0,0.5);">NovaEx Global Launch</h2>
?> <p class="carousel-desc" style="font-size: 1.1rem; opacity: 0.9; margin-bottom: 30px;">Experience the next generation of digital asset trading with ultra-low latency and bank-grade security.</p>
<?php if ($projectDescription): ?> <a href="register.php" class="btn-primary" style="padding: 12px 35px; border-radius: 8px; font-weight: bold; text-decoration: none; display: inline-block; background: var(--primary-color); color: white;"><?php echo __('join_now', 'Join Now'); ?></a>
<!-- Meta description --> </div>
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' /> </div>
<!-- Open Graph meta tags --> <div class="carousel-slide" style="min-width: 100%; position: relative;">
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" /> <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;">
<!-- Twitter meta tags --> <div class="carousel-content" style="position: absolute; top: 50%; left: 8%; transform: translateY(-50%); color: white; max-width: 600px;">
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" /> <h2 class="carousel-title" style="font-size: 3rem; font-weight: 800; margin-bottom: 20px; text-shadow: 0 5px 15px rgba(0,0,0,0.5);">Trade Futures with 100x Leverage</h2>
<?php endif; ?> <p class="carousel-desc" style="font-size: 1.1rem; opacity: 0.9; margin-bottom: 30px;">Maximize your capital efficiency with our professional perpetual futures contracts.</p>
<?php if ($projectImageUrl): ?> <a href="futures.php" class="btn-primary" style="padding: 12px 35px; border-radius: 8px; font-weight: bold; text-decoration: none; display: inline-block; background: var(--primary-color); color: white;"><?php echo __('start_trading', 'Start Trading'); ?></a>
<!-- Open Graph image --> </div>
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> </div>
<!-- Twitter image --> <div class="carousel-slide" style="min-width: 100%; position: relative;">
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> <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;">
<?php endif; ?> <div class="carousel-content" style="position: absolute; top: 50%; left: 8%; transform: translateY(-50%); color: white; max-width: 600px;">
<link rel="preconnect" href="https://fonts.googleapis.com"> <h2 class="carousel-title" style="font-size: 3rem; font-weight: 800; margin-bottom: 20px; text-shadow: 0 5px 15px rgba(0,0,0,0.5);">Secure Crypto Staking</h2>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <p class="carousel-desc" style="font-size: 1.1rem; opacity: 0.9; margin-bottom: 30px;">Earn passive income on your idle assets with our high-yield staking pools.</p>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet"> <a href="mining.php" class="btn-primary" style="padding: 12px 35px; border-radius: 8px; font-weight: bold; text-decoration: none; display: inline-block; background: var(--primary-color); color: white;"><?php echo __('earn_now', 'Earn Now'); ?></a>
<style> </div>
:root { </div>
--bg-color-start: #6a11cb; </div>
--bg-color-end: #2575fc; <div class="carousel-dots" style="position: absolute; bottom: 30px; left: 8%; display: flex; gap: 12px;">
--text-color: #ffffff; <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>
--card-bg-color: rgba(255, 255, 255, 0.01); <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>
--card-border-color: rgba(255, 255, 255, 0.1); <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: 40px 20px;">
<div style="display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 20px;">
<h2 class="section-title-home" style="font-size: 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: 14px;"><?php echo __('view_more_markets', '查看更多'); ?> <i class="fas fa-chevron-right" style="font-size: 10px;"></i></a>
</div>
<div class="market-table-container" style="background: var(--card-bg); border-radius: 20px; border: 1px solid var(--border-color); overflow: hidden; box-shadow: 0 10px 30px rgba(0,0,0,0.2);">
<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.02);">
<th style="padding: 15px 20px; color: var(--text-muted); font-weight: 500; font-size: 13px;"><?php echo __('pair', '币对'); ?></th>
<th style="padding: 15px 20px; color: var(--text-muted); font-weight: 500; font-size: 13px;"><?php echo __('last_price', '最新价'); ?></th>
<th style="padding: 15px 20px; color: var(--text-muted); font-weight: 500; font-size: 13px;"><?php echo __('24h_change', '24h 涨跌'); ?></th>
<th class="desktop-only-cell" style="padding: 15px 20px; color: var(--text-muted); font-weight: 500; font-size: 13px;"><?php echo __('market_cap', '市值'); ?></th>
</tr>
</thead>
<tbody id="home-market-list">
<!-- JS Filled -->
</tbody>
</table>
</div>
</section>
<!-- Download Section -->
<section style="padding: 60px 0; background: #0b0e11; border-top: 1px solid rgba(255,255,255,0.05);">
<div class="container">
<div class="download-grid" style="display: flex; align-items: center; justify-content: space-between; gap: 40px; flex-wrap: wrap;">
<div style="flex: 1.2; min-width: 300px;">
<h2 class="section-title-small" style="font-size: 2.2rem; font-weight: 800; margin-bottom: 20px; background: linear-gradient(135deg, #fff 0%, #848e9c 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent;">Trade Anywhere, Anytime</h2>
<p style="color: var(--text-muted); font-size: 1rem; line-height: 1.6; margin-bottom: 30px;">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: 20px; margin-top: 30px;">
<div style="display: flex; gap: 12px; align-items: flex-start;">
<div style="width: 36px; height: 36px; border-radius: 10px; 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: 14px;"></i>
</div>
<div>
<h4 style="margin: 0 0 3px; font-weight: 700; font-size: 0.95rem;">Fast & Secure</h4>
<p style="font-size: 0.85rem; color: #848e9c; margin: 0;">Military-grade encryption.</p>
</div>
</div>
<div style="display: flex; gap: 12px; align-items: flex-start;">
<div style="width: 36px; height: 36px; border-radius: 10px; 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: 14px;"></i>
</div>
<div>
<h4 style="margin: 0 0 3px; font-weight: 700; font-size: 0.95rem;">Real-time</h4>
<p style="font-size: 0.85rem; color: #848e9c; margin: 0;">Low-latency updates.</p>
</div>
</div>
</div>
</div>
<div style="flex: 1; display: flex; flex-direction: column; gap: 15px; min-width: 280px;">
<a href="app.php" style="text-decoration: none;">
<div class="download-card-new" style="background: rgba(255,255,255,0.03); padding: 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 15px; transition: 0.3s;">
<div style="width: 50px; height: 50px; background: #000; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.6rem;">
<i class="fab fa-apple" style="color: white;"></i>
</div>
<div style="flex: 1;">
<div style="font-size: 0.75rem; color: #848e9c;">Download on the</div>
<div style="font-size: 1.1rem; 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: 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.08); display: flex; align-items: center; gap: 15px; transition: 0.3s;">
<div style="width: 50px; height: 50px; background: #000; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem;">
<i class="fab fa-google-play" style="color: #3DDC84;"></i>
</div>
<div style="flex: 1;">
<div style="font-size: 0.75rem; color: #848e9c;">Get it on</div>
<div style="font-size: 1.1rem; 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: 15px; align-items: center; background: linear-gradient(135deg, rgba(79, 172, 254, 0.1) 0%, rgba(0, 242, 254, 0.1) 100%); padding: 15px; border-radius: 16px; border: 1px solid rgba(79, 172, 254, 0.2);">
<div style="background: white; padding: 8px; border-radius: 10px;">
<i class="fas fa-qrcode" style="font-size: 2rem; color: #000;"></i>
</div>
<div>
<div style="font-weight: 700; color: white; font-size: 0.9rem;">Scan to Download</div>
<div style="font-size: 0.75rem; color: #848e9c;">iOS & Android</div>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Why Choose Us -->
<section class="container" style="padding: 60px 20px;">
<div style="text-align: center; margin-bottom: 50px;">
<h2 class="section-title-home" style="font-size: 2.2rem; font-weight: 800; margin-bottom: 15px;"><?php echo __('why_choose_us', '为什么选择 NovaEx'); ?></h2>
<p style="color: var(--text-muted); max-width: 600px; margin: 0 auto; font-size: 1rem;"><?php echo __('platform_desc'); ?></p>
</div>
<div class="grid-3">
<div class="choose-card" style="padding: 40px 30px; background: rgba(255,255,255,0.02); border-radius: 24px; border: 1px solid rgba(255,255,255,0.05); text-align: center; transition: all 0.4s;">
<div style="width: 70px; height: 70px; background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 25px; color: white; font-size: 1.8rem;">
<i class="fas fa-shield-alt"></i>
</div>
<h3 style="margin-bottom: 15px; font-size: 1.4rem; font-weight: 700;"><?php echo __('secure_storage', 'Secure Storage'); ?></h3>
<p style="color: var(--text-muted); line-height: 1.6; font-size: 0.9rem;"><?php echo __('secure_storage_desc'); ?></p>
</div>
<div class="choose-card" style="padding: 40px 30px; background: rgba(255,255,255,0.02); border-radius: 24px; border: 1px solid rgba(255,255,255,0.05); text-align: center; transition: all 0.4s;">
<div style="width: 70px; height: 70px; background: linear-gradient(135deg, #00c087 0%, #00d2ff 100%); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 25px; color: white; font-size: 1.8rem;">
<i class="fas fa-user-lock"></i>
</div>
<h3 style="margin-bottom: 15px; font-size: 1.4rem; font-weight: 700;"><?php echo __('protected_insurance', 'Protected by Insurance'); ?></h3>
<p style="color: var(--text-muted); line-height: 1.6; font-size: 0.9rem;"><?php echo __('protected_insurance_desc'); ?></p>
</div>
<div class="choose-card" style="padding: 40px 30px; background: rgba(255,255,255,0.02); border-radius: 24px; border: 1px solid rgba(255,255,255,0.05); text-align: center; transition: all 0.4s;">
<div style="width: 70px; height: 70px; background: linear-gradient(135deg, #f0b90b 0%, #ff9a00 100%); border-radius: 20px; display: flex; align-items: center; justify-content: center; margin: 0 auto 25px; color: white; font-size: 1.8rem;">
<i class="fas fa-microchip"></i>
</div>
<h3 style="margin-bottom: 15px; font-size: 1.4rem; font-weight: 700;"><?php echo __('industry_best_practices', 'Best Practices'); ?></h3>
<p style="color: var(--text-muted); line-height: 1.6; font-size: 0.9rem;"><?php echo __('industry_best_practices_desc'); ?></p>
</div>
</div>
</section>
<!-- Partners -->
<section style="padding: 60px 0; background: #161a1e;">
<div class="container" style="text-align: center;">
<h2 style="font-size: 1.8rem; font-weight: 800; margin-bottom: 40px;"><?php echo __('global_partners'); ?></h2>
<div class="partners-grid-custom" style="display: grid; grid-template-columns: repeat(6, 1fr); gap: 20px;">
<div class="partner-item"><i class="fab fa-google-pay" style="font-size: 2rem; color: #4285F4;"></i></div>
<div class="partner-item"><i class="fab fa-apple-pay" style="font-size: 2rem; color: #ffffff;"></i></div>
<div class="partner-item"><i class="fab fa-visa" style="font-size: 2rem; color: #1a1f71;"></i></div>
<div class="partner-item"><i class="fab fa-mastercard" style="font-size: 2rem; color: #eb001b;"></i></div>
<div class="partner-item"><i class="fab fa-paypal" style="font-size: 2rem; color: #003087;"></i></div>
<div class="partner-item"><i class="fab fa-stripe" style="font-size: 2rem; color: #6772e5;"></i></div>
</div>
</div>
</section>
</main>
<style>
.carousel-dot.active { opacity: 1 !important; width: 30px !important; border-radius: 6px !important; background: var(--primary-color) !important; }
.partner-item { padding: 25px 15px; background: rgba(255,255,255,0.02); border-radius: 16px; transition: 0.3s; display: flex; align-items: center; justify-content: center; }
.partner-item:hover { background: rgba(255,255,255,0.05); transform: translateY(-3px); }
.download-card-new:hover { background: rgba(255,255,255,0.06) !important; border-color: var(--primary-color) !important; }
.choose-card:hover { transform: translateY(-10px); border-color: var(--primary-color) !important; background: rgba(79, 172, 254, 0.05) !important; }
@media (max-width: 992px) {
.carousel-container { height: 350px !important; border-radius: 0 !important; }
.carousel-title { font-size: 1.8rem !important; }
.carousel-desc { font-size: 0.9rem !important; margin-bottom: 20px !important; }
.partners-grid-custom { grid-template-columns: repeat(3, 1fr) !important; }
} }
body {
margin: 0; @media (max-width: 576px) {
font-family: 'Inter', sans-serif; .carousel-container { height: 300px !important; }
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); .carousel-title { font-size: 1.5rem !important; }
color: var(--text-color); .section-title-home { font-size: 1.5rem !important; }
display: flex; .partners-grid-custom { grid-template-columns: repeat(2, 1fr) !important; }
justify-content: center; .desktop-only-cell { display: none; }
align-items: center; .features-mini-grid { grid-template-columns: 1fr !important; }
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
} }
body::before { </style>
content: '';
position: absolute; <script>
top: 0; // Carousel Logic
left: 0; let currentSlide = 0;
width: 100%; const track = document.getElementById('carouselTrack');
height: 100%; const dots = document.querySelectorAll('.carousel-dot');
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; function updateCarousel() {
z-index: -1; if (!track) return;
track.style.transform = `translateX(-${currentSlide * 100}%)`;
dots.forEach((dot, i) => {
dot.classList.toggle('active', i === currentSlide);
});
} }
@keyframes bg-pan {
0% { background-position: 0% 0%; } function goToSlide(n) {
100% { background-position: 100% 100%; } currentSlide = n;
updateCarousel();
} }
main {
padding: 2rem; function nextSlide() {
currentSlide = (currentSlide + 1) % 3;
updateCarousel();
} }
.card {
background: var(--card-bg-color); setInterval(nextSlide, 5000);
border: 1px solid var(--card-border-color);
border-radius: 16px; const trendingPairs = <?php echo json_encode($trending_pairs); ?>;
padding: 2rem; const homeWs = new WebSocket('wss://stream.binance.com:9443/ws/' + trendingPairs.map(p => p.toLowerCase() + '@ticker').join('/'));
backdrop-filter: blur(20px); const homeMarketData = {};
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1); 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: 15px 20px; display: flex; align-items: center; gap: 10px;">
<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="font-weight: 700; font-size: 0.95rem;">${name}</div>
<div style="font-size: 0.75rem; color: var(--text-muted);">USDT</div>
</div>
</td>
<td style="padding: 15px 20px; font-weight: 600; font-size: 0.95rem; color: #EAECEF;">$ ${parseFloat(d.c).toLocaleString()}</td>
<td style="padding: 15px 20px; color: ${color}; font-weight: 700; font-size: 0.95rem;">${d.P >= 0 ? '+' : ''}${d.P}%</td>
<td class="desktop-only-cell" style="padding: 15px 20px; color: var(--text-muted); font-size: 0.85rem;">$ ${(parseFloat(d.q) / 1000000).toFixed(2)}M</td>
</tr>
`;
});
tbody.innerHTML = html;
} }
.loader { </script>
margin: 1.25rem auto 1.25rem;
width: 48px; <?php include 'footer.php'; ?>
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>
</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>
<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 Normal file
View File

@ -0,0 +1,185 @@
<?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'; ?>

75
login.php Normal file
View File

@ -0,0 +1,75 @@
<?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'; ?>

5
logout.php Normal file
View File

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

106
markets.php Normal file
View File

@ -0,0 +1,106 @@
<?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'; ?>

50
matching.php Normal file
View File

@ -0,0 +1,50 @@
<?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;
}

111
mining.php Normal file
View File

@ -0,0 +1,111 @@
<?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'; ?>

45
news.php Normal file
View File

@ -0,0 +1,45 @@
<?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'; ?>

359
options.php Normal file
View File

@ -0,0 +1,359 @@
<?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: '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: 280px; flex-shrink: 0; border-right: 1px solid var(--border-color); }
#pairs-list { height: 600px; overflow-y: auto; }
.pair-item { display: flex; justify-content: space-between; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); }
.pair-item.active { background: rgba(240, 185, 11, 0.1); }
/* Center Panel */
.center-panel { flex: 1; background: var(--bg-color); display: flex; flex-direction: column; }
.info-bar { height: 60px; display: flex; align-items: center; padding: 0 15px; gap: 15px; border-bottom: 1px solid var(--border-color); background: var(--panel-bg); }
.chart-container { height: 420px; background: var(--bg-color); border-bottom: 1px solid var(--border-color); }
/* Option Order Panel */
.option-order-panel { padding: 20px; background: var(--panel-bg); border-bottom: 1px solid var(--border-color); }
.duration-list { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 5px; -webkit-overflow-scrolling: touch; }
.duration-item { flex-shrink: 0; padding: 8px 15px; background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 6px; cursor: pointer; text-align: center; min-width: 85px; }
.duration-item.active { border-color: var(--accent-color); color: var(--accent-color); background: rgba(240, 185, 11, 0.1); }
.duration-item .profit { display: block; font-size: 10px; margin-top: 2px; }
.option-input-wrapper { background: var(--input-bg); border: 1px solid var(--border-color); border-radius: 6px; display: flex; align-items: center; padding: 10px 15px; margin-top: 8px; }
.option-input-wrapper input { flex: 1; background: transparent; border: none; color: white; outline: none; font-size: 16px; text-align: right; }
.action-buttons { display: flex; gap: 15px; margin-top: 20px; }
.action-btn { flex: 1; padding: 15px; border: none; border-radius: 8px; font-weight: bold; font-size: 16px; cursor: pointer; color: white; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.action-btn.up { background: var(--up-color); }
.action-btn.down { background: var(--down-color); }
.action-btn span { font-size: 11px; font-weight: normal; opacity: 0.9; }
/* Responsive */
@media (max-width: 1200px) {
.market-panel { display: none; }
}
@media (max-width: 992px) {
.trading-layout { flex-direction: column; }
.order-book-panel { display: none; }
.chart-container { height: 320px; }
.info-bar { height: auto; padding: 10px 15px; flex-wrap: wrap; }
}
@media (max-width: 576px) {
.action-buttons { gap: 10px; }
.action-btn { padding: 12px 5px; font-size: 14px; }
.countdown-card { width: 90% !important; margin: 0 5%; }
}
#order-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: 9999; backdrop-filter: blur(5px); }
.countdown-card { background: #1e2329; width: 380px; border-radius: 24px; border: 1px solid #2b3139; overflow: hidden; box-shadow: 0 20px 60px rgba(0,0,0,0.5); }
.timer-circle { width: 100px; height: 100px; border: 4px solid var(--accent-color); border-radius: 50%; margin: 0 auto 20px; display: flex; align-items: center; justify-content: center; font-size: 28px; font-weight: bold; color: var(--accent-color); }
</style>
<div class="trading-layout">
<!-- Left Panel -->
<div class="panel market-panel">
<div style="padding: 12px; border-bottom: 1px solid var(--border-color);">
<input type="text" id="market-search" placeholder="搜索币对" style="width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 8px 12px; border-radius: 6px; font-size: 13px; outline: none;">
</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: 10px;">
<img id="current-logo" src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/btc.png" width="28" height="28" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<span id="current-pair-display" style="font-size: 16px; font-weight: bold;">BTC/USDT</span>
</div>
<div style="display: flex; flex-direction: column;">
<span id="last-price" style="font-size: 16px; font-weight: bold; color: var(--up-color);">--</span>
<span id="price-change" style="font-size: 11px; color: var(--up-color);">--</span>
</div>
<div style="display: flex; gap: 15px; margin-left: auto; font-size: 11px;" class="desktop-only">
<div style="color: var(--text-secondary);">24h高 <span id="high-24h" style="color: white; margin-left: 3px;">--</span></div>
<div style="color: var(--text-secondary);">24h低 <span id="low-24h" style="color: white; margin-left: 3px;">--</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;">结算时间</div>
<div class="duration-list">
<div class="duration-item active" data-seconds="60" data-min="10" data-profit="8">60S <span class="profit">收益 8%</span></div>
<div class="duration-item" data-seconds="90" data-min="100" data-profit="15">90S <span class="profit">收益 15%</span></div>
<div class="duration-item" data-seconds="180" data-min="500" data-profit="30">180S <span class="profit">收益 30%</span></div>
<div class="duration-item" data-seconds="300" data-min="1000" data-profit="50">300S <span class="profit">收益 50%</span></div>
<div class="duration-item" data-seconds="600" data-min="5000" data-profit="80">600S <span class="profit">收益 80%</span></div>
</div>
<div style="margin-top: 20px;">
<div style="display: flex; justify-content: space-between; font-size: 12px; color: var(--text-secondary);">
<span>买入金额</span>
<span>余额: <span id="user-balance" style="color: white;"><?php echo number_format($balance, 2); ?></span> USDT</span>
</div>
<div class="option-input-wrapper">
<input type="number" id="order-amount" placeholder="最小下单 10">
<span style="color: var(--text-secondary); margin-left: 10px; font-size: 14px;">USDT</span>
</div>
</div>
<div class="action-buttons">
<button class="action-btn up" onclick="placeOptionOrder('up')">买涨 <span id="up-profit-text">收益 8%</span></button>
<button class="action-btn down" onclick="placeOptionOrder('down')">买跌 <span id="down-profit-text">收益 8%</span></button>
</div>
</div>
<div style="padding: 15px; overflow-x: auto; background: var(--panel-bg);">
<div style="display: flex; gap: 20px; border-bottom: 1px solid var(--border-color); margin-bottom: 15px;">
<button onclick="switchTab(this, 'pending')" style="background: none; border: none; color: var(--accent-color); padding: 10px 0; border-bottom: 2px solid var(--accent-color); font-size: 14px; cursor: pointer;">进行中</button>
<button onclick="switchTab(this, 'completed')" style="background: none; border: none; color: var(--text-secondary); padding: 10px 0; font-size: 14px; cursor: pointer;">已结算</button>
</div>
<table style="width: 100%; border-collapse: collapse; min-width: 600px; font-size: 11px;">
<thead style="color: var(--text-secondary); text-align: left;">
<tr>
<th style="padding: 8px 4px;">时间</th>
<th style="padding: 8px 4px;">币对</th>
<th style="padding: 8px 4px;">方向</th>
<th style="padding: 8px 4px;">金额</th>
<th style="padding: 8px 4px;">买入价</th>
<th style="padding: 8px 4px;">结算价</th>
<th style="padding: 8px 4px;">倒计时</th>
<th style="padding: 8px 4px; text-align: right;">盈亏</th>
</tr>
</thead>
<tbody id="orders-tbody">
<tr><td colspan="8" style="text-align: center; padding: 40px;">暂无记录</td></tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Order Book (Hidden on mobile) -->
<div class="panel order-book-panel">
<div style="padding: 10px 15px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between;">
<span>价格(USDT)</span>
<span>数量(BTC)</span>
</div>
<div id="asks-list" style="display: flex; flex-direction: column-reverse;"></div>
<div id="ob-mid-price" style="padding: 10px 0; text-align: center; font-weight: bold; font-size: 16px; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color);">--</div>
<div id="bids-list"></div>
</div>
</div>
<div id="order-countdown-modal">
<div class="countdown-card">
<div style="padding: 20px; text-align: center; border-bottom: 1px solid #2b3139; background: #161a1e; font-weight: bold;">交易执行中</div>
<div style="padding: 25px; text-align: center;">
<div class="timer-circle" id="modal-timer">60s</div>
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 15px; text-align: left; background: rgba(255,255,255,0.03); padding: 15px; border-radius: 12px; font-size: 13px;">
<div><div style="color: var(--text-secondary); margin-bottom: 4px;">币对</div><div id="modal-symbol" style="font-weight: bold;">--</div></div>
<div><div style="color: var(--text-secondary); margin-bottom: 4px;">方向</div><div id="modal-direction" style="font-weight: bold;">--</div></div>
<div><div style="color: var(--text-secondary); margin-bottom: 4px;">买入金额</div><div id="modal-amount" style="font-weight: bold;">--</div></div>
<div><div style="color: var(--text-secondary); margin-bottom: 4px;">买入价</div><div id="modal-price" style="font-weight: bold;">--</div></div>
</div>
<button onclick="closeCountdownModal()" style="width: 100%; margin-top: 25px; padding: 12px; background: #2b3139; border: none; color: white; border-radius: 12px; cursor: pointer;">等待结算</button>
</div>
</div>
</div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script>
let currentPair = 'BTCUSDT';
let currentPrice = 0;
let marketData = {};
let activeTab = 'pending';
let selectedDuration = 60;
let selectedProfit = 0.08;
let selectedMinAmount = 10;
let countdownInterval;
const pairs = ['BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT', 'ADAUSDT', 'DOGEUSDT', 'AVAXUSDT', 'DOTUSDT', 'LINKUSDT'];
function initChart(symbol) {
new TradingView.widget({
"width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "1", "theme": "dark", "style": "1", "locale": "zh_CN", "container_id": "tv_chart_container", "backgroundColor": "#0b0e11", "hide_side_toolbar": true, "allow_symbol_change": 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();
if (document.getElementById('high-24h')) document.getElementById('high-24h').innerText = parseFloat(data.h).toLocaleString();
if (document.getElementById('low-24h')) document.getElementById('low-24h').innerText = parseFloat(data.l).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};
html += `<div class="pair-item ${currentPair === p ? 'active' : ''}" onclick="switchPair('${p}')">
<span>${p.replace('USDT', '/USDT')}</span>
<span style="color: ${d.P >= 0 ? 'var(--up-color)' : 'var(--down-color)'}">${parseFloat(d.c).toLocaleString()}</span>
</div>`;
});
list.innerHTML = html;
}
function switchPair(p) {
currentPair = p;
document.getElementById('current-pair-display').innerText = p.replace('USDT', '/USDT');
document.getElementById('current-logo').src = `https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/${p.replace('USDT','').toLowerCase()}.png`;
initChart(p);
renderPairs();
}
function updateOrderBook() {
const asks = document.getElementById('asks-list');
const bids = document.getElementById('bids-list');
if (!asks || !bids) return;
let aH = ''; let bH = '';
for(let i=0; i<10; i++) {
aH += `<div class="ob-row"><span style="color: var(--down-color);">${(currentPrice*(1+(i+1)*0.001)).toFixed(2)}</span><span>${Math.random().toFixed(4)}</span></div>`;
bH += `<div class="ob-row"><span style="color: var(--up-color);">${(currentPrice*(1-(i+1)*0.001)).toFixed(2)}</span><span>${Math.random().toFixed(4)}</span></div>`;
}
asks.innerHTML = aH; bids.innerHTML = bH;
}
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;
selectedMinAmount = parseInt(this.dataset.min);
document.getElementById('order-amount').placeholder = `最小下单 ${selectedMinAmount}`;
document.getElementById('up-profit-text').innerText = `收益 ${this.dataset.profit}%`;
document.getElementById('down-profit-text').innerText = `收益 ${this.dataset.profit}%`;
});
});
async function placeOptionOrder(dir) {
const amount = parseFloat(document.getElementById('order-amount').value);
if (!amount || amount < selectedMinAmount) return alert(`最小金额为 ${selectedMinAmount}`);
const resp = await fetch('api/place_option_order.php', {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
symbol: currentPair, amount: amount, direction: dir,
duration: selectedDuration, profit_rate: selectedProfit, opening_price: currentPrice
})
});
const res = await resp.json();
if (res.success) {
document.getElementById('user-balance').innerText = res.new_balance.toFixed(2);
showModal(dir, amount, currentPrice, selectedDuration);
fetchOrders();
} else { alert(res.error); }
}
function showModal(dir, amt, pr, sec) {
document.getElementById('modal-symbol').innerText = currentPair;
document.getElementById('modal-direction').innerText = dir === 'up' ? '买涨 ↑' : '买跌 ↓';
document.getElementById('modal-direction').style.color = dir === 'up' ? 'var(--up-color)' : 'var(--down-color)';
document.getElementById('modal-amount').innerText = amt + ' USDT';
document.getElementById('modal-price').innerText = pr.toLocaleString();
document.getElementById('modal-timer').innerText = sec + 's';
document.getElementById('order-countdown-modal').style.display = 'flex';
let left = sec;
if (countdownInterval) clearInterval(countdownInterval);
countdownInterval = setInterval(() => {
left--;
document.getElementById('modal-timer').innerText = left + 's';
if (left <= 0) { clearInterval(countdownInterval); closeCountdownModal(); fetchOrders(); }
}, 1000);
}
function closeCountdownModal() { document.getElementById('order-countdown-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 => {
const isWin = o.result === 'win';
const isLoss = o.result === 'loss';
return `<tr style="border-bottom: 1px solid var(--border-color);">
<td style="padding: 8px 4px;">${o.created_at}</td>
<td style="padding: 8px 4px; font-weight: bold;">${o.symbol}</td>
<td style="padding: 8px 4px; color: ${o.direction === 'up' ? 'var(--up-color)' : 'var(--down-color)'}">${o.direction === 'up' ? '↑' : '↓'}</td>
<td style="padding: 8px 4px;">${parseFloat(o.amount).toFixed(2)}</td>
<td style="padding: 8px 4px;">${parseFloat(o.opening_price).toLocaleString()}</td>
<td style="padding: 8px 4px;">${o.closing_price ? parseFloat(o.closing_price).toLocaleString() : '--'}</td>
<td style="padding: 8px 4px;">${o.status === 'pending' ? '进行中' : '已结算'}</td>
<td style="padding: 8px 4px; text-align: right; color: ${isWin ? 'var(--up-color)' : (isLoss ? 'var(--down-color)' : 'white')}; font-weight: bold;">
${isWin ? '+' + parseFloat(o.profit).toFixed(2) : (isLoss ? '-' + parseFloat(o.amount).toFixed(2) : '--')}
</td>
</tr>`;
}).join('');
} else { tbody.innerHTML = '<tr><td colspan="8" style="text-align: center; padding: 40px;">暂无记录</td></tr>'; }
}
function switchTab(btn, tab) {
document.querySelectorAll('.tab-btn').forEach(b => {
b.style.color = 'var(--text-secondary)'; b.style.borderBottom = 'none';
});
btn.style.color = 'var(--accent-color)'; btn.style.borderBottom = '2px solid var(--accent-color)';
activeTab = tab; fetchOrders();
}
fetchOrders(); setInterval(fetchOrders, 3000);
</script>
<?php include 'footer.php'; ?>

52
privacy.php Normal file
View File

@ -0,0 +1,52 @@
<?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'; ?>

251
profile.php Normal file
View File

@ -0,0 +1,251 @@
<?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'; ?>

95
register.php Normal file
View File

@ -0,0 +1,95 @@
<?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'; ?>

49
request.php Normal file
View File

@ -0,0 +1,49 @@
<?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'; ?>

119
security.php Normal file
View File

@ -0,0 +1,119 @@
<?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'; ?>

412
spot.php Normal file
View File

@ -0,0 +1,412 @@
<?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: 'PingFang SC', 'Microsoft YaHei', 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: 280px; flex-shrink: 0; border-right: 1px solid var(--border-color); }
#pairs-list { height: 600px; overflow-y: auto; }
.pair-item { display: flex; justify-content: space-between; padding: 10px 12px; cursor: pointer; border-bottom: 1px solid rgba(255,255,255,0.02); }
.pair-item.active { background: rgba(240, 185, 11, 0.1); }
/* Center Panel */
.center-panel { flex: 1; background: var(--bg-color); display: flex; flex-direction: column; }
.info-bar { height: 60px; display: flex; align-items: center; padding: 0 15px; gap: 15px; border-bottom: 1px solid var(--border-color); background: var(--panel-bg); flex-wrap: wrap; }
.chart-container { height: 450px; background: var(--bg-color); border-bottom: 1px solid var(--border-color); }
.order-placement-panel { display: flex; gap: 20px; padding: 20px; 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: 4px; display: flex; align-items: center; margin-bottom: 10px; padding: 8px 12px; }
.input-row input { flex: 1; background: transparent; border: none; color: white; text-align: right; outline: none; font-size: 14px; }
.execute-btn { width: 100%; padding: 12px; border: none; border-radius: 6px; font-weight: bold; font-size: 15px; cursor: pointer; color: white; }
/* Order Book Panel */
.order-book-panel { width: 300px; flex-shrink: 0; border-left: 1px solid var(--border-color); }
.ob-row { display: flex; justify-content: space-between; padding: 4px 15px; font-size: 12px; position: relative; }
/* Responsive Design */
@media (max-width: 1200px) {
.market-panel { display: none; }
.order-book-panel { width: 250px; }
}
@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: 350px; }
.info-bar { height: auto; padding: 10px 15px; }
.order-placement-panel { flex-direction: column; }
}
@media (max-width: 576px) {
.chart-container { height: 300px; }
.info-bar-stats { display: none !important; }
.order-side-column:not(:first-child) { margin-top: 20px; border-top: 1px solid var(--border-color); padding-top: 20px; }
}
</style>
<div class="trading-layout">
<!-- Left Panel (Hidden on mobile) -->
<div class="panel market-panel">
<div style="padding: 12px; border-bottom: 1px solid var(--border-color);">
<div style="position: relative;">
<i class="fas fa-search" style="position: absolute; left: 10px; top: 10px; color: var(--text-secondary);"></i>
<input type="text" id="market-search" placeholder="搜索币对" style="width: 100%; background: var(--input-bg); border: 1px solid var(--border-color); color: white; padding: 8px 12px 8px 32px; border-radius: 6px; 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: 10px;">
<img id="current-logo" src="https://raw.githubusercontent.com/spothq/cryptocurrency-icons/master/128/color/btc.png" width="28" height="28" onerror="this.src='https://cdn-icons-png.flaticon.com/512/2585/2585274.png'">
<span id="current-pair-display" style="font-size: 18px; font-weight: bold;">BTC/USDT</span>
</div>
<div style="display: flex; flex-direction: column;">
<span id="last-price" style="font-size: 18px; font-weight: bold; color: var(--up-color);">--</span>
<span id="price-change" style="font-size: 12px; color: var(--up-color);">--</span>
</div>
<div class="info-bar-stats" style="display: flex; gap: 20px; margin-left: auto; font-size: 11px;">
<div style="color: var(--text-secondary);">24h高 <span id="high-24h" style="color: white; display: block;">--</span></div>
<div style="color: var(--text-secondary);">24h低 <span id="low-24h" style="color: white; display: block;">--</span></div>
<div style="color: var(--text-secondary);">24h量 <span id="vol-24h" style="color: white; display: block;">--</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: 15px; margin-bottom: 15px;">
<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: 14px; padding: 0;">限价</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: bold; cursor: pointer; font-size: 14px; padding: 0;">市价</button>
</div>
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px;">
<span style="color: var(--text-secondary);">可用 <span id="buy-available">--</span> USDT</span>
</div>
<div class="input-row" id="buy-price-row" style="display: none;">
<span style="color: var(--text-secondary); font-size: 13px;">价格</span>
<input type="number" id="buy-price" placeholder="0.00">
<span style="color: var(--text-secondary); font-size: 12px; margin-left: 5px;">USDT</span>
</div>
<div class="input-row" id="buy-market-price-row">
<span style="color: var(--text-secondary); font-size: 13px;">价格</span>
<input type="text" id="buy-market-price-display" value="以当前市价买入" disabled style="text-align: right; color: var(--text-secondary);">
</div>
<div class="input-row">
<span style="color: var(--text-secondary); font-size: 13px;">数量</span>
<input type="number" id="buy-amount" placeholder="0.00">
<span class="asset-name" style="color: var(--text-secondary); font-size: 12px; margin-left: 5px; width: 40px; text-align: right;">BTC</span>
</div>
<div style="margin: 15px 0 25px 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);" oninput="updateFromSlider('buy', this.value)">
<div style="display: flex; justify-content: space-between; margin-top: 5px; font-size: 10px; color: var(--text-secondary);">
<span onclick="setSlider('buy', 0)">0%</span>
<span onclick="setSlider('buy', 25)">25%</span>
<span onclick="setSlider('buy', 50)">50%</span>
<span onclick="setSlider('buy', 75)">75%</span>
<span onclick="setSlider('buy', 100)">100%</span>
</div>
</div>
<button class="execute-btn" style="background: var(--up-color);" onclick="placeOrder('buy')">买入 <span class="asset-name">BTC</span></button>
</div>
<!-- Sell Column -->
<div class="order-side-column" id="sell-column">
<div style="display: flex; gap: 15px; margin-bottom: 15px;">
<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: bold; cursor: pointer; font-size: 14px; padding: 0;">限价</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: 14px; padding: 0;">市价</button>
</div>
<div style="display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 8px;">
<span style="color: var(--text-secondary);">可用 <span id="sell-available">--</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;">价格</span>
<input type="number" id="sell-price" placeholder="0.00">
<span style="color: var(--text-secondary); font-size: 12px; margin-left: 5px;">USDT</span>
</div>
<div class="input-row" id="sell-market-price-row" style="display: none;">
<span style="color: var(--text-secondary); font-size: 13px;">价格</span>
<input type="text" id="sell-market-price-display" value="以当前市价卖出" disabled style="text-align: right; color: var(--text-secondary);">
</div>
<div class="input-row">
<span style="color: var(--text-secondary); font-size: 13px;">数量</span>
<input type="number" id="sell-amount" placeholder="0.00">
<span class="asset-name" style="color: var(--text-secondary); font-size: 12px; margin-left: 5px; width: 40px; text-align: right;">BTC</span>
</div>
<div style="margin: 15px 0 25px 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);" oninput="updateFromSlider('sell', this.value)">
<div style="display: flex; justify-content: space-between; margin-top: 5px; font-size: 10px; color: var(--text-secondary);">
<span onclick="setSlider('sell', 0)">0%</span>
<span onclick="setSlider('sell', 25)">25%</span>
<span onclick="setSlider('sell', 50)">50%</span>
<span onclick="setSlider('sell', 75)">75%</span>
<span onclick="setSlider('sell', 100)">100%</span>
</div>
</div>
<button class="execute-btn" style="background: var(--down-color);" onclick="placeOrder('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 15px;">
<button class="tab-btn active" onclick="switchTab(this, 'open')" style="background: none; border: none; color: var(--accent-color); padding: 12px 15px; font-size: 14px; border-bottom: 2px solid var(--accent-color); cursor: pointer;">当前委托</button>
<button class="tab-btn" onclick="switchTab(this, 'history')" style="background: none; border: none; color: var(--text-secondary); padding: 12px 15px; font-size: 14px; cursor: pointer;">历史委托</button>
</div>
<div style="padding: 15px; overflow-x: auto;">
<table id="orders-table" style="width: 100%; border-collapse: collapse; min-width: 600px; font-size: 12px;">
<thead style="color: var(--text-secondary); text-align: left;">
<tr>
<th style="padding: 10px 5px;">时间</th>
<th style="padding: 10px 5px;">币对</th>
<th style="padding: 10px 5px;">类型</th>
<th style="padding: 10px 5px;">方向</th>
<th style="padding: 10px 5px;">价格</th>
<th style="padding: 10px 5px;">数量</th>
<th style="padding: 10px 5px;">状态</th>
<th style="padding: 10px 5px; text-align: right;">操作</th>
</tr>
</thead>
<tbody id="orders-tbody">
<tr><td colspan="8" style="text-align: center; padding: 40px; color: var(--text-secondary);">暂无记录</td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Right Panel (Order Book) -->
<div class="panel order-book-panel">
<div style="padding: 10px 15px; font-size: 12px; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); display: flex; justify-content: space-between;">
<span>价格(USDT)</span>
<span>数量(BTC)</span>
</div>
<div id="asks-list" style="display: flex; flex-direction: column-reverse;"></div>
<div style="padding: 10px 15px; border-top: 1px solid var(--border-color); border-bottom: 1px solid var(--border-color); text-align: center;">
<div id="ob-mid-price" style="font-size: 16px; font-weight: bold;">--</div>
</div>
<div id="bids-list"></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 pairs = [
'BTCUSDT', 'ETHUSDT', 'SOLUSDT', 'BNBUSDT', 'XRPUSDT', 'ADAUSDT', 'DOGEUSDT', 'DOTUSDT', 'LINKUSDT', 'AVAXUSDT'
];
function initChart(symbol) {
new TradingView.widget({
"width": "100%", "height": "100%", "symbol": "BINANCE:" + symbol, "interval": "15", "theme": "dark", "style": "1", "locale": "zh_CN", "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('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', '');
html += `
<div class="pair-item ${currentPair === p ? 'active' : ''}" onclick="switchPair('${p}')">
<span style="font-weight: 500;">${name}/USDT</span>
<span style="color: ${d.P >= 0 ? 'var(--up-color)' : 'var(--down-color)'}">${parseFloat(d.c).toLocaleString()}</span>
</div>
`;
});
list.innerHTML = html;
}
function switchPair(p) {
currentPair = p;
const name = p.replace('USDT', '');
document.getElementById('current-pair-display').innerText = name + '/USDT';
document.querySelectorAll('.asset-name').forEach(el => el.innerText = name);
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 = '';
for(let i=0; i<10; i++) {
const ap = currentPrice * (1 + (i+1)*0.001);
const bp = currentPrice * (1 - (i+1)*0.001);
asksHtml += `<div class="ob-row"><span style="color: var(--down-color);">${ap.toFixed(2)}</span><span>${(Math.random()).toFixed(4)}</span></div>`;
bidsHtml += `<div class="ob-row"><span style="color: var(--up-color);">${bp.toFixed(2)}</span><span>${(Math.random()).toFixed(4)}</span></div>`;
}
asks.innerHTML = asksHtml; bids.innerHTML = bidsHtml;
}
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 amount = (usdtBalance * (val/100)) / (parseFloat(document.getElementById('buy-price').value) || currentPrice);
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) return alert('请输入数量');
const price = orderTypes[side] === 'limit' ? parseFloat(document.getElementById(side + '-price').value) : currentPrice;
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('成功'); 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: 10px 5px;">${o.created_at}</td>
<td style="padding: 10px 5px; font-weight: bold;">${o.symbol}</td>
<td style="padding: 10px 5px;">${o.order_type}</td>
<td style="padding: 10px 5px; color: ${o.side === 'buy' ? 'var(--up-color)' : 'var(--down-color)'}">${o.side}</td>
<td style="padding: 10px 5px;">${parseFloat(o.price).toLocaleString()}</td>
<td style="padding: 10px 5px;">${parseFloat(o.amount).toFixed(6)}</td>
<td style="padding: 10px 5px;">${o.status}</td>
<td style="padding: 10px 5px; text-align: right;">${o.status === 'open' ? `<button onclick="cancelOrder(${o.id})">取消</button>` : '--'}</td>
</tr>
`).join('');
} else {
tbody.innerHTML = '<tr><td colspan="8" style="text-align: center; padding: 40px;">暂无记录</td></tr>';
}
}
function switchTab(btn, tab) {
document.querySelectorAll('.tab-btn').forEach(b => {
b.classList.remove('active');
b.style.color = 'var(--text-secondary)';
b.style.borderBottom = 'none';
});
btn.classList.add('active');
btn.style.color = 'var(--accent-color)';
btn.style.borderBottom = '2px solid var(--accent-color)';
activeTab = tab;
fetchOrders();
}
updateAvailable();
fetchOrders();
</script>
<?php include 'footer.php'; ?>

44
status.php Normal file
View File

@ -0,0 +1,44 @@
<?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'; ?>

44
terms.php Normal file
View File

@ -0,0 +1,44 @@
<?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'; ?>

136
withdraw.php Normal file
View File

@ -0,0 +1,136 @@
<?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'; ?>