Compare commits

...

4 Commits

Author SHA1 Message Date
Flatlogic Bot
6b9829359b RIT 2026-02-09 09:05:22 +00:00
Flatlogic Bot
0e573d36f8 BIT 2026-02-09 08:36:40 +00:00
Flatlogic Bot
4d100057a8 Autosave: 20260209-074401 2026-02-09 07:44:01 +00:00
Flatlogic Bot
4607bec72f Autosave: 20260209-055215 2026-02-09 05:52:15 +00:00
39 changed files with 4094 additions and 518 deletions

28
admin/api_notif.php Normal file
View File

@ -0,0 +1,28 @@
<?php
require_once '../db/config.php';
session_start();
// Simple admin check
$user_id = $_SESSION['user_id'] ?? 0;
$stmt = db()->prepare("SELECT is_admin FROM users WHERE id = ?");
$stmt->execute([$user_id]);
$u = $stmt->fetch();
if (!$u || !$u['is_admin']) {
echo json_encode(['error' => 'Unauthorized']);
exit;
}
// Count pending deposits and unread messages
$stmt = db()->query("SELECT COUNT(*) as cnt FROM deposits WHERE status = 'pending'");
$dep_count = $stmt->fetch()['cnt'];
$stmt = db()->query("SELECT COUNT(*) as cnt FROM chat_messages WHERE admin_id IS NULL AND is_read = 0");
$chat_count = $stmt->fetch()['cnt'];
echo json_encode([
'success' => true,
'new_count' => $dep_count + $chat_count,
'deposits' => $dep_count,
'chats' => $chat_count
]);

251
admin/index.php Normal file
View File

@ -0,0 +1,251 @@
<?php
require_once '../includes/header.php';
// Simple admin check
if (!$user || !$user['is_admin']) {
die('Unauthorized');
}
$msg = '';
// Handle Deposit Approval
if (isset($_GET['action']) && isset($_GET['id'])) {
$id = $_GET['id'];
if ($_GET['action'] === 'approve') {
$stmt = db()->prepare("SELECT * FROM deposits WHERE id = ?");
$stmt->execute([$id]);
$dep = $stmt->fetch();
if ($dep && $dep['status'] === 'pending') {
db()->beginTransaction();
$stmt = db()->prepare("UPDATE deposits SET status = 'approved' WHERE id = ?");
$stmt->execute([$id]);
// Add balance to user
$stmt = db()->prepare("UPDATE users SET balance_usdt = balance_usdt + ? WHERE id = ?");
$stmt->execute([$dep['amount'], $dep['user_id']]);
db()->commit();
$msg = "Deposit approved and balance added.";
}
} elseif ($_GET['action'] === 'reject') {
$stmt = db()->prepare("UPDATE deposits SET status = 'rejected' WHERE id = ?");
$stmt->execute([$id]);
$msg = "Deposit rejected.";
}
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['update_config'])) {
foreach ($_POST['config'] as $key => $value) {
$stmt = db()->prepare("INSERT INTO system_config (config_key, config_value) VALUES (?, ?) ON DUPLICATE KEY UPDATE config_value = ?");
$stmt->execute([$key, $value, $value]);
}
$msg = 'Configuration updated.';
}
if (isset($_POST['update_user'])) {
$target_user_id = $_POST['user_id'];
$win_loss = $_POST['win_loss'];
$stmt = db()->prepare("UPDATE users SET win_loss_control = ? WHERE id = ?");
$stmt->execute([$win_loss, $target_user_id]);
$msg = 'User control updated.';
}
if (isset($_POST['send_reply'])) {
$user_id = $_POST['user_id'];
$reply = $_POST['message'];
$stmt = db()->prepare("INSERT INTO chat_messages (user_id, admin_id, message) VALUES (?, ?, ?)");
$stmt->execute([$user_id, $user['id'], $reply]);
$msg = 'Reply sent.';
}
}
// Fetch pending deposits
$stmt = db()->query("SELECT d.*, u.username, u.uid FROM deposits d JOIN users u ON d.user_id = u.id WHERE d.status = 'pending' ORDER BY d.created_at DESC");
$pending_deposits = $stmt->fetchAll();
// Fetch all users
$stmt = db()->query("SELECT * FROM users ORDER BY created_at DESC");
$all_users = $stmt->fetchAll();
// Fetch latest chat messages (group by user)
$stmt = db()->query("SELECT m.*, u.username, u.uid FROM chat_messages m JOIN users u ON m.user_id = u.id ORDER BY m.created_at DESC LIMIT 50");
$chats = $stmt->fetchAll();
?>
<div class="container my-5">
<div class="d-flex justify-content-between align-items-center mb-5">
<h1 class="fw-bold m-0">Admin Dashboard</h1>
<span class="badge bg-danger rounded-pill px-3 py-2" id="notif-badge" style="display:none;">New Notifications</span>
</div>
<?php if ($msg): ?>
<div class="alert alert-success alert-dismissible fade show">
<?php echo $msg; ?>
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
<?php endif; ?>
<div class="row g-4">
<!-- Pending Deposits -->
<div class="col-12">
<div class="card bg-dark border-secondary p-4 shadow">
<h4 class="mb-4 text-warning"><i class="fas fa-money-bill-wave me-2"></i> Pending Deposits</h4>
<div class="table-responsive">
<table class="table table-dark table-hover align-middle">
<thead>
<tr>
<th>UID</th>
<th>User</th>
<th>Amount</th>
<th>Receipt</th>
<th>Time</th>
<th>Action</th>
</tr>
</thead>
<tbody>
<?php foreach ($pending_deposits as $d): ?>
<tr>
<td><?php echo str_pad($d['uid'] ?? '0', 6, '0', STR_PAD_LEFT); ?></td>
<td><?php echo htmlspecialchars($d['username']); ?></td>
<td class="fw-bold"><?php echo number_format($d['amount'], 2); ?> <?php echo $d['currency']; ?></td>
<td>
<a href="../<?php echo $d['receipt_url']; ?>" target="_blank" class="btn btn-sm btn-outline-info">View Proof</a>
</td>
<td class="small text-muted"><?php echo $d['created_at']; ?></td>
<td>
<a href="?action=approve&id=<?php echo $d['id']; ?>" class="btn btn-sm btn-success px-3">Approve</a>
<a href="?action=reject&id=<?php echo $d['id']; ?>" class="btn btn-sm btn-danger px-3">Reject</a>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($pending_deposits)): ?>
<tr><td colspan="6" class="text-center text-muted py-4">No pending deposits.</td></tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
<!-- Customer Service Chat -->
<div class="col-lg-8">
<div class="card bg-dark border-secondary p-4 h-100 shadow">
<h4 class="mb-4 text-primary"><i class="fas fa-headset me-2"></i> Customer Service</h4>
<div class="chat-box overflow-auto mb-4 p-3 rounded bg-black bg-opacity-25" style="height: 400px;" id="admin-chat-box">
<?php foreach ($chats as $c): ?>
<div class="mb-3 <?php echo $c['admin_id'] ? 'text-end' : ''; ?>">
<div class="small text-muted mb-1">
<?php echo $c['admin_id'] ? 'Admin' : htmlspecialchars($c['username']) . " (UID: " . str_pad($c['uid'], 6, '0', STR_PAD_LEFT) . ")"; ?>
<span class="ms-2"><?php echo $c['created_at']; ?></span>
</div>
<div class="d-inline-block p-2 rounded-3 <?php echo $c['admin_id'] ? 'bg-primary text-white' : 'bg-secondary text-white'; ?>" style="max-width: 80% text-wrap: wrap;">
<?php echo nl2br(htmlspecialchars($c['message'])); ?>
<?php if ($c['attachment_url']): ?>
<div class="mt-2">
<a href="../<?php echo $c['attachment_url']; ?>" target="_blank" class="text-white small text-decoration-underline">View Attachment</a>
</div>
<?php endif; ?>
</div>
</div>
<?php endforeach; ?>
</div>
<form method="POST" class="d-flex gap-2">
<input type="hidden" name="send_reply" value="1">
<select name="user_id" class="form-select bg-dark text-white border-secondary w-25" required>
<option value="">Select User</option>
<?php
$unique_users = [];
foreach($chats as $c) {
if (!$c['admin_id']) $unique_users[$c['user_id']] = $c['username'];
}
foreach($unique_users as $uid => $uname) echo "<option value='$uid'>$uname</option>";
?>
</select>
<input type="text" name="message" class="form-control bg-dark text-white border-secondary" placeholder="Type your reply..." required>
<button type="submit" class="btn btn-primary">Send</button>
</form>
</div>
</div>
<!-- Global Settings -->
<div class="col-lg-4">
<div class="card bg-dark border-secondary p-4 h-100 shadow">
<h4 class="mb-4">Global Settings</h4>
<form method="POST">
<input type="hidden" name="update_config" value="1">
<div class="mb-3">
<label class="form-label">Site Name</label>
<input type="text" name="config[site_name]" class="form-control bg-dark text-white border-secondary" value="<?php echo $current_config['site_name'] ?? 'BITCrypto'; ?>">
</div>
<div class="mb-3">
<label class="form-label">Global Win Rate (%)</label>
<input type="number" name="config[win_loss_rate]" class="form-control bg-dark text-white border-secondary" value="<?php echo $current_config['win_loss_rate'] ?? '50'; ?>">
</div>
<button type="submit" class="btn btn-primary w-100">Save Global Config</button>
</form>
</div>
</div>
<!-- User Management -->
<div class="col-12">
<div class="card bg-dark border-secondary p-4 shadow">
<h4 class="mb-4">User Controls (Win/Loss)</h4>
<div class="table-responsive">
<table class="table table-dark table-hover">
<thead>
<tr>
<th>UID</th>
<th>Username</th>
<th>Balance (USDT)</th>
<th>Control Mode</th>
</tr>
</thead>
<tbody>
<?php foreach ($all_users as $u): ?>
<tr>
<td><?php echo str_pad($u['uid'] ?? '0', 6, '0', STR_PAD_LEFT); ?></td>
<td><?php echo htmlspecialchars($u['username']); ?></td>
<td class="fw-bold">$<?php echo number_format($u['balance_usdt'], 2); ?></td>
<td>
<form method="POST" class="d-flex gap-2">
<input type="hidden" name="update_user" value="1">
<input type="hidden" name="user_id" value="<?php echo $u['id']; ?>">
<select name="win_loss" class="form-select form-select-sm bg-dark text-white border-secondary" style="width: 150px;">
<option value="random" <?php echo $u['win_loss_control'] === 'random' ? 'selected' : ''; ?>>Random</option>
<option value="always_win" <?php echo $u['win_loss_control'] === 'always_win' ? 'selected' : ''; ?>>Always Win</option>
<option value="always_loss" <?php echo $u['win_loss_control'] === 'always_loss' ? 'always_loss' : ''; ?>>Always Loss</option>
</select>
<button type="submit" class="btn btn-sm btn-outline-primary">Update</button>
</form>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
<script>
// Auto-scroll chat to bottom
const chatBox = document.getElementById('admin-chat-box');
chatBox.scrollTop = chatBox.scrollHeight;
// Simulated Notification Polling
setInterval(async () => {
try {
const resp = await fetch('api_notif.php');
const data = await resp.json();
if (data.new_count > 0) {
document.getElementById('notif-badge').style.display = 'inline-block';
document.getElementById('notif-badge').innerText = data.new_count + ' New Updates';
// Play sound if needed
// new Audio('assets/ping.mp3').play();
}
} catch (e) {}
}, 5000);
</script>
<?php require_once '../includes/footer.php'; ?>

61
api/get_hero_images.php Normal file
View File

@ -0,0 +1,61 @@
<?php
header('Content-Type: application/json');
function pexels_key() {
$k = getenv('PEXELS_KEY');
return $k && strlen($k) > 0 ? $k : 'Vc99rnmOhHhJAbgGQoKLZtsaIVfkeownoQNbTj78VemUjKh08ZYRbf18';
}
function pexels_get($url) {
$ch = curl_init();
curl_setopt_array($ch, [
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [ 'Authorization: '. pexels_key() ],
CURLOPT_TIMEOUT => 15,
]);
$resp = curl_exec($ch);
$code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($code >= 200 && $code < 300 && $resp) return json_decode($resp, true);
return null;
}
function download_to($srcUrl, $destPath) {
$data = @file_get_contents($srcUrl);
if ($data === false) return false;
if (!is_dir(dirname($destPath))) mkdir(dirname($destPath), 0775, true);
return file_put_contents($destPath, $data) !== false;
}
$queries = ['cryptocurrency', 'bitcoin mining', 'blockchain technology', 'digital finance', 'trading floor'];
$out = [];
if (!is_dir(__DIR__ . '/../assets/images/hero')) {
mkdir(__DIR__ . '/../assets/images/hero', 0775, true);
}
foreach ($queries as $index => $q) {
$filename = 'hero_' . ($index + 1) . '.jpg';
$target = __DIR__ . '/../assets/images/hero/' . $filename;
// Cache for 24 hours
if (!file_exists($target) || (time() - filemtime($target) > 86400)) {
$u = 'https://api.pexels.com/v1/search?query=' . urlencode($q) . '&orientation=landscape&per_page=1&page=1';
$d = pexels_get($u);
if ($d && !empty($d['photos'])) {
$p = $d['photos'][0];
$src = $p['src']['large2x'] ?? $p['src']['original'];
download_to($src, $target);
}
}
if (file_exists($target)) {
$out[] = 'assets/images/hero/' . $filename;
} else {
// Fallback to picsum if pexels fails
$out[] = 'https://picsum.photos/1200/600?random=' . $index;
}
}
echo json_encode(['success' => true, 'images' => $out]);

91
api/market_api.php Normal file
View File

@ -0,0 +1,91 @@
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/../db/config.php';
// List of supported coins for OKX
$coins = [
'BTC' => ['name' => 'Bitcoin', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/btc.png'],
'ETH' => ['name' => 'Ethereum', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/eth.png'],
'BNB' => ['name' => 'BNB', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/bnb.png'],
'SOL' => ['name' => 'Solana', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/sol.png'],
'OKB' => ['name' => 'OKB', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/okb.png'],
'LINK' => ['name' => 'Chainlink', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/link.png'],
'DOT' => ['name' => 'Polkadot', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/dot.png'],
'ADA' => ['name' => 'Cardano', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/ada.png'],
'DOGE' => ['name' => 'Dogecoin', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/doge.png'],
'XRP' => ['name' => 'XRP', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/xrp.png'],
'AVAX' => ['name' => 'Avalanche', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/avax.png'],
'MATIC' => ['name' => 'Polygon', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/matic.png'],
'TRX' => ['name' => 'TRON', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/trx.png'],
'LTC' => ['name' => 'Litecoin', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/ltc.png'],
'BCH' => ['name' => 'Bitcoin Cash', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/bch.png'],
'UNI' => ['name' => 'Uniswap', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/uni.png'],
'FIL' => ['name' => 'Filecoin', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/fil.png'],
'APT' => ['name' => 'Aptos', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/apt.png'],
'ARB' => ['name' => 'Arbitrum', 'icon' => 'https://static.okx.com/cdn/oksupport/asset/currency/icon/arb.png'],
];
function fetchRealPricesOKX() {
$ch = curl_init();
$url = "https://www.okx.com/api/v5/market/tickers?instType=SPOT";
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0');
$response = curl_exec($ch);
curl_close($ch);
return json_decode($response, true);
}
$realData = fetchRealPricesOKX();
$result = [];
// Initialize result with fallback data
foreach ($coins as $symbol => $data) {
$result[$symbol] = array_merge($data, [
'price' => 0.00,
'change' => 0.00,
'high' => 0.00,
'low' => 0.00,
'volume' => 0.00,
]);
}
if ($realData && isset($realData['code']) && $realData['code'] == "0" && isset($realData['data'])) {
foreach ($realData['data'] as $ticker) {
$instId = $ticker['instId'];
if (strpos($instId, '-USDT') !== false) {
$symbol = str_replace('-USDT', '', $instId);
if (isset($result[$symbol])) {
$last = (float)$ticker['last'];
$open = (float)$ticker['open24h'];
$change = ($open > 0) ? (($last - $open) / $open) * 100 : 0;
$result[$symbol]['price'] = $last;
$result[$symbol]['change'] = $change;
$result[$symbol]['high'] = (float)$ticker['high24h'];
$result[$symbol]['low'] = (float)$ticker['low24h'];
$result[$symbol]['volume'] = (float)$ticker['vol24h'];
}
}
}
}
// Check for admin price manipulation
try {
$conn = db();
if ($conn) {
$stmt = $conn->prepare("SELECT config_key, config_value FROM system_config WHERE config_key LIKE 'price_%'");
$stmt->execute();
$manipulations = $stmt->fetchAll(PDO::FETCH_KEY_PAIR);
foreach ($result as $symbol => &$data) {
$key = 'price_' . $symbol;
if (isset($manipulations[$key]) && is_numeric($manipulations[$key])) {
$data['price'] = (float)$manipulations[$key];
}
}
}
} catch (Exception $e) {}
echo json_encode(['success' => true, 'data' => $result]);

91
api/order.php Normal file
View File

@ -0,0 +1,91 @@
<?php
session_start();
require_once __DIR__ . '/../db/config.php';
header('Content-Type: application/json');
if (!isset($_SESSION['user_id'])) {
echo json_encode(['success' => false, 'message' => 'Please login first.']);
exit;
}
$userId = $_SESSION['user_id'];
$symbol = $_POST['symbol'] ?? '';
$side = $_POST['side'] ?? ''; // buy/sell
$type = $_POST['type'] ?? 'spot'; // spot/contract
$price = floatval($_POST['price'] ?? 0);
$amount = floatval($_POST['amount'] ?? 0);
if ($amount <= 0 || $price <= 0) {
echo json_encode(['success' => false, 'message' => 'Invalid amount or price.']);
exit;
}
try {
$pdo = db();
$pdo->beginTransaction();
// Fetch user balance
$stmt = $pdo->prepare("SELECT balance_usdt FROM users WHERE id = ? FOR UPDATE");
$stmt->execute([$userId]);
$user = $stmt->fetch();
$totalCost = $price * $amount;
if ($type === 'spot') {
if ($side === 'buy') {
if ($user['balance_usdt'] < $totalCost) {
echo json_encode(['success' => false, 'message' => 'Insufficient USDT balance.']);
$pdo->rollBack();
exit;
}
// Deduct USDT
$stmt = $pdo->prepare("UPDATE users SET balance_usdt = balance_usdt - ? WHERE id = ?");
$stmt->execute([$totalCost, $userId]);
// Record Order
$stmt = $pdo->prepare("INSERT INTO spot_orders (user_id, symbol, side, type, price, amount, status) VALUES (?, ?, 'buy', 'limit', ?, ?, 'filled')");
$stmt->execute([$userId, $symbol, $price, $amount]);
} else {
// Sell logic (simplified: assuming user has enough coin for now)
$stmt = $pdo->prepare("UPDATE users SET balance_usdt = balance_usdt + ? WHERE id = ?");
$stmt->execute([$totalCost, $userId]);
$stmt = $pdo->prepare("INSERT INTO spot_orders (user_id, symbol, side, type, price, amount, status) VALUES (?, ?, 'sell', 'limit', ?, ?, 'filled')");
$stmt->execute([$userId, $symbol, $price, $amount]);
}
} else {
// Contract logic
$margin = $totalCost / 10; // Assuming 10x leverage for simulation
if ($side === 'buy') { // Long
if ($user['balance_usdt'] < $margin) {
echo json_encode(['success' => false, 'message' => 'Insufficient margin.']);
$pdo->rollBack();
exit;
}
$stmt = $pdo->prepare("UPDATE users SET balance_usdt = balance_usdt - ? WHERE id = ?");
$stmt->execute([$margin, $userId]);
$stmt = $pdo->prepare("INSERT INTO contract_positions (user_id, symbol, side, leverage, entry_price, size, margin, status) VALUES (?, ?, 'long', 10, ?, ?, ?, 'active')");
$stmt->execute([$userId, $symbol, $price, $amount, $margin]);
} else { // Short
if ($user['balance_usdt'] < $margin) {
echo json_encode(['success' => false, 'message' => 'Insufficient margin.']);
$pdo->rollBack();
exit;
}
$stmt = $pdo->prepare("UPDATE users SET balance_usdt = balance_usdt - ? WHERE id = ?");
$stmt->execute([$margin, $userId]);
$stmt = $pdo->prepare("INSERT INTO contract_positions (user_id, symbol, side, leverage, entry_price, size, margin, status) VALUES (?, ?, 'short', 10, ?, ?, ?, 'active')");
$stmt->execute([$userId, $symbol, $price, $amount, $margin]);
}
}
$pdo->commit();
echo json_encode(['success' => true, 'message' => 'Order processed.']);
} catch (Exception $e) {
if ($pdo->inTransaction()) $pdo->rollBack();
echo json_encode(['success' => false, 'message' => 'System error: ' . $e->getMessage()]);
}

View File

@ -1,346 +1,147 @@
:root { :root {
--color-bg: #ffffff; --bg-color: #101216;
--color-text: #1a1a1a; --text-color: #eaecef;
--color-primary: #2563EB; /* Vibrant Blue */ --accent-color: #f0b90b;
--color-secondary: #000000; --card-bg: #181a20;
--color-accent: #A3E635; /* Lime Green */ --border-color: #2b2f36;
--color-surface: #f8f9fa; --success-color: #0ecb81;
--font-heading: 'Space Grotesk', sans-serif; --danger-color: #f6465d;
--font-body: 'Inter', sans-serif; --okx-blue: #0046ff;
--border-width: 2px; --bit-gradient: linear-gradient(45deg, #0046ff, #00ff96);
--shadow-hard: 5px 5px 0px #000; --glass-bg: rgba(255, 255, 255, 0.03);
--shadow-hover: 8px 8px 0px #000; --glass-border: rgba(255, 255, 255, 0.08);
--radius-pill: 50rem;
--radius-card: 1rem;
} }
body { body {
font-family: var(--font-body); background-color: var(--bg-color);
background-color: var(--color-bg); color: var(--text-color);
color: var(--color-text); font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
overflow-x: hidden; letter-spacing: -0.2px;
} }
h1, h2, h3, h4, h5, h6, .navbar-brand { /* Glassmorphism */
font-family: var(--font-heading); .glass-card {
letter-spacing: -0.03em; background: var(--glass-bg);
backdrop-filter: blur(12px);
-webkit-backdrop-filter: blur(12px);
border: 1px solid var(--glass-border);
border-radius: 24px;
} }
/* Utilities */ /* Gradient Text */
.text-primary { color: var(--color-primary) !important; } .text-gradient {
.bg-black { background-color: #000 !important; } background: var(--bit-gradient);
.text-white { color: #fff !important; } -webkit-background-clip: text;
.shadow-hard { box-shadow: var(--shadow-hard); } -webkit-text-fill-color: transparent;
.border-2-black { border: var(--border-width) solid #000; } display: inline-block;
.py-section { padding-top: 5rem; padding-bottom: 5rem; }
/* Navbar */
.navbar {
background: rgba(255, 255, 255, 0.9);
backdrop-filter: blur(10px);
border-bottom: var(--border-width) solid transparent;
transition: all 0.3s;
padding-top: 1rem;
padding-bottom: 1rem;
}
.navbar.scrolled {
border-bottom-color: #000;
padding-top: 0.5rem;
padding-bottom: 0.5rem;
}
.brand-text {
font-size: 1.5rem;
font-weight: 800;
}
.nav-link {
font-weight: 500;
color: var(--color-text);
margin-left: 1rem;
position: relative;
}
.nav-link:hover, .nav-link.active {
color: var(--color-primary);
} }
/* Buttons */ /* Buttons */
.btn {
font-weight: 700;
font-family: var(--font-heading);
padding: 0.8rem 2rem;
border-radius: var(--radius-pill);
border: var(--border-width) solid #000;
transition: all 0.2s cubic-bezier(0.25, 1, 0.5, 1);
box-shadow: var(--shadow-hard);
}
.btn:hover {
transform: translate(-2px, -2px);
box-shadow: var(--shadow-hover);
}
.btn:active {
transform: translate(2px, 2px);
box-shadow: 0 0 0 #000;
}
.btn-primary { .btn-primary {
background-color: var(--color-primary); background: var(--okx-blue);
border-color: #000; border: none;
color: #fff; border-radius: 12px;
padding: 10px 24px;
font-weight: 600;
transition: all 0.3s ease;
} }
.btn-primary:hover { .btn-primary:hover {
background-color: #1d4ed8; background: #0037cc;
border-color: #000; transform: translateY(-2px);
color: #fff; box-shadow: 0 8px 20px rgba(0, 70, 255, 0.3);
} }
.btn-outline-dark { /* Logo Styling */
background-color: #fff; .logo-img {
color: #000; height: 40px;
margin-right: 12px;
background: transparent !important;
border: none !important;
display: block;
box-shadow: none !important;
filter: drop-shadow(0 0 5px rgba(0, 70, 255, 0.2));
} }
.btn-cta { .bg-primary-bg { background-color: var(--bg-color) !important; }
background-color: var(--color-accent); .bg-secondary-bg { background-color: #181a20 !important; }
color: #000; .bg-darker { background-color: #080a0c !important; }
.bg-navy-gradient {
background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 100%);
} }
.btn-cta:hover { /* New Ticker Styles */
background-color: #8cc629; .ticker-item {
color: #000; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.hover-glow-blue:hover {
transform: translateY(-3px);
background: rgba(0, 70, 255, 0.15) !important;
border-color: rgba(0, 70, 255, 0.3) !important;
box-shadow: 0 10px 20px rgba(0, 70, 255, 0.15);
} }
/* Hero Section */ .x-small { font-size: 0.7rem; }
.hero-section { .xx-small { font-size: 0.6rem; }
min-height: 100vh;
padding-top: 80px; /* Custom Animations */
@keyframes fadeIn {
from { opacity: 0; transform: translateY(10px); }
to { opacity: 1; transform: translateY(0); }
} }
.background-blob { .animate-fade-in {
position: absolute; animation: fadeIn 0.5s ease forwards;
border-radius: 50%;
filter: blur(80px);
opacity: 0.6;
z-index: 1;
} }
.blob-1 { /* Mobile Adjustments */
top: -10%; @media (max-width: 768px) {
right: -10%; .display-4 { font-size: 2.5rem; }
width: 600px; .carousel-image-container { height: 350px !important; }
height: 600px; .slide-content { padding-left: 20px !important; }
background: radial-gradient(circle, var(--color-accent), transparent);
} }
.blob-2 { /* Ticker Skeleton */
bottom: 10%; .skeleton {
left: -10%; background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 50%, rgba(255,255,255,0.05) 75%);
width: 500px; background-size: 200% 100%;
height: 500px; animation: skeleton-loading 1.5s infinite;
background: radial-gradient(circle, var(--color-primary), transparent);
} }
.highlight-text { @keyframes skeleton-loading {
background: linear-gradient(120deg, transparent 0%, transparent 40%, var(--color-accent) 40%, var(--color-accent) 100%); 0% { background-position: 200% 0; }
background-repeat: no-repeat; 100% { background-position: -200% 0; }
background-size: 100% 40%;
background-position: 0 88%;
padding: 0 5px;
} }
.dot { color: var(--color-primary); } /* Utility */
.text-white { color: #ffffff !important; }
.text-muted { color: #848e9c !important; }
.bg-primary { background-color: var(--okx-blue) !important; }
.badge-pill { /* Custom Scrollbar */
display: inline-block; ::-webkit-scrollbar {
padding: 0.5rem 1rem; width: 6px;
border: 2px solid #000; height: 6px;
border-radius: 50px; }
font-weight: 700; ::-webkit-scrollbar-track {
background: #fff; background: var(--bg-color);
box-shadow: 4px 4px 0 #000; }
font-family: var(--font-heading); ::-webkit-scrollbar-thumb {
font-size: 0.9rem; background: #484f65;
border-radius: 10px;
}
::-webkit-scrollbar-thumb:hover {
background: #5a627d;
} }
/* Marquee */ /* Feature Cards */
.marquee-container { .feature-card {
overflow: hidden; transition: all 0.4s ease;
white-space: nowrap; border: 1px solid rgba(255,255,255,0.03) !important;
border-top: 2px solid #000;
border-bottom: 2px solid #000;
} }
.feature-card:hover {
.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); transform: translateY(-10px);
box-shadow: 8px 8px 0 #000; border-color: rgba(0, 70, 255, 0.2) !important;
} box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4) !important;
}
.card-img-holder {
height: 250px;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 2px solid #000;
position: relative;
font-size: 4rem;
}
.placeholder-art {
transition: transform 0.3s ease;
}
.project-card:hover .placeholder-art {
transform: scale(1.2) rotate(10deg);
}
.bg-soft-blue { background-color: #e0f2fe; }
.bg-soft-green { background-color: #dcfce7; }
.bg-soft-purple { background-color: #f3e8ff; }
.bg-soft-yellow { background-color: #fef9c3; }
.category-tag {
position: absolute;
top: 15px;
right: 15px;
background: #000;
color: #fff;
padding: 5px 12px;
border-radius: 20px;
font-size: 0.75rem;
font-weight: 700;
}
.card-body { padding: 1.5rem; }
.link-arrow {
text-decoration: none;
color: #000;
font-weight: 700;
display: inline-flex;
align-items: center;
margin-top: auto;
}
.link-arrow i { transition: transform 0.2s; margin-left: 5px; }
.link-arrow:hover i { transform: translateX(5px); }
/* About */
.about-image-stack {
position: relative;
height: 400px;
width: 100%;
}
.stack-card {
position: absolute;
width: 80%;
height: 100%;
border-radius: var(--radius-card);
border: 2px solid #000;
box-shadow: var(--shadow-hard);
left: 10%;
transform: rotate(-3deg);
background-size: cover;
}
/* Forms */
.form-control {
border: 2px solid #000;
border-radius: 0.5rem;
padding: 1rem;
font-weight: 500;
background: #f8f9fa;
}
.form-control:focus {
box-shadow: 4px 4px 0 var(--color-primary);
border-color: #000;
background: #fff;
}
/* Animations */
.animate-up {
opacity: 0;
transform: translateY(30px);
animation: fadeUp 0.8s ease forwards;
}
.delay-100 { animation-delay: 0.1s; }
.delay-200 { animation-delay: 0.2s; }
@keyframes fadeUp {
to {
opacity: 1;
transform: translateY(0);
}
}
/* Social */
.social-links a {
transition: transform 0.2s;
display: inline-block;
}
.social-links a:hover {
transform: scale(1.2) rotate(10deg);
color: var(--color-accent) !important;
}
/* Responsive */
@media (max-width: 991px) {
.rotate-divider {
transform: rotate(0);
margin-top: 0;
margin-bottom: 2rem;
}
.hero-section {
padding-top: 120px;
text-align: center;
min-height: auto;
padding-bottom: 100px;
}
.display-1 { font-size: 3.5rem; }
.blob-1 { width: 300px; height: 300px; right: -20%; }
.blob-2 { width: 300px; height: 300px; left: -20%; }
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 92 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 239 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 134 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 149 KiB

BIN
assets/images/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 68 KiB

View File

@ -1,73 +1,244 @@
document.addEventListener('DOMContentLoaded', () => { // Global variables
let currentMarketData = {};
// Smooth scrolling for navigation links
document.querySelectorAll('a[href^="#"]').forEach(anchor => {
anchor.addEventListener('click', function (e) {
e.preventDefault();
const targetId = this.getAttribute('href');
if (targetId === '#') return;
const targetElement = document.querySelector(targetId);
if (targetElement) {
// Close mobile menu if open
const navbarToggler = document.querySelector('.navbar-toggler');
const navbarCollapse = document.querySelector('.navbar-collapse');
if (navbarCollapse.classList.contains('show')) {
navbarToggler.click();
}
// Scroll with offset function getLang() {
const offset = 80; return document.documentElement.lang || 'en';
const elementPosition = targetElement.getBoundingClientRect().top; }
const offsetPosition = elementPosition + window.pageYOffset - offset;
window.scrollTo({ // Market Data Fetching
top: offsetPosition, async function fetchMarketData() {
behavior: "smooth" try {
}); const resp = await fetch('api/market_api.php');
if (!resp.ok) throw new Error('Network response was not ok');
const result = await resp.json();
if (result.success) {
currentMarketData = result.data;
updateUI();
}
} catch (e) {
console.error('Market API error', e);
}
}
function updateUI() {
// Update Home Page Market List (Market Trends Table)
const homeList = document.getElementById('market-trends');
if (homeList) {
let html = '';
const symbols = ['BTC', 'ETH', 'BNB', 'SOL', 'XRP', 'DOGE', 'ADA', 'TRX'];
symbols.forEach(symbol => {
const coin = currentMarketData[symbol];
if (coin) {
const changeClass = coin.change >= 0 ? 'text-success' : 'text-danger';
const changeSign = coin.change >= 0 ? '+' : '';
const iconClass = coin.change >= 0 ? 'fa-arrow-trend-up' : 'fa-arrow-trend-down';
html += `
<tr onclick="window.location.href='trade.php?symbol=${symbol}'" style="cursor: pointer;" class="transition">
<td class="ps-4 py-4 border-0">
<div class="d-flex align-items-center">
<div class="bg-secondary bg-opacity-20 rounded-circle me-3 d-flex align-items-center justify-content-center" style="width: 40px; height: 40px;">
<img src="${coin.icon}" width="24" height="24">
</div>
<div>
<div class="fw-bold text-white">${symbol}</div>
<div class="text-muted small">${coin.name}</div>
</div>
</div>
</td>
<td class="py-4 border-0 text-white fw-bold">$${coin.price.toLocaleString(undefined, {minimumFractionDigits: 2})}</td>
<td class="py-4 border-0 ${changeClass} fw-bold">
<i class="fas ${iconClass} me-1"></i>
${changeSign}${coin.change.toFixed(2)}%
</td>
<td class="pe-4 py-4 border-0 text-end">
<a href="trade.php?symbol=${symbol}" class="btn btn-sm btn-outline-primary rounded-pill px-4 border-opacity-25" style="font-size: 0.75rem;">${typeof t === 'function' ? t('Go to Trade') : 'Trade'}</a>
</td>
</tr>
`;
} }
}); });
}); if (html) homeList.innerHTML = html;
}
// Navbar scroll effect // Update Hero Ticker (Horizontal Bar) - Improved with premium gradient & glow
const navbar = document.querySelector('.navbar'); const heroTicker = document.getElementById('hero-market-ticker');
window.addEventListener('scroll', () => { if (heroTicker) {
if (window.scrollY > 50) { let html = '';
navbar.classList.add('scrolled', 'shadow-sm', 'bg-white'); const symbols = ['BTC', 'ETH', 'SOL', 'BNB', 'XRP'];
navbar.classList.remove('bg-transparent'); symbols.forEach(symbol => {
} else { const coin = currentMarketData[symbol];
navbar.classList.remove('scrolled', 'shadow-sm', 'bg-white'); if (coin) {
navbar.classList.add('bg-transparent'); const changeClass = coin.change >= 0 ? 'text-success' : 'text-danger';
// Using a premium gradient instead of a "white box"
const gradient = coin.change >= 0
? 'linear-gradient(135deg, rgba(14, 203, 129, 0.15) 0%, rgba(0, 70, 255, 0.05) 100%)'
: 'linear-gradient(135deg, rgba(246, 70, 93, 0.15) 0%, rgba(0, 70, 255, 0.05) 100%)';
const borderColor = coin.change >= 0 ? 'rgba(14, 203, 129, 0.2)' : 'rgba(246, 70, 93, 0.2)';
html += `
<div class="ticker-item d-flex align-items-center gap-3 py-2 px-3 rounded-4 transition hover-glow-blue" onclick="window.location.href='trade.php?symbol=${symbol}'" style="cursor: pointer; background: ${gradient}; border: 1px solid ${borderColor};">
<div class="d-flex flex-column">
<span class="fw-bold text-white small">${symbol}/USDT</span>
<span class="${changeClass} x-small fw-bold">${coin.change >= 0 ? '+' : ''}${coin.change.toFixed(2)}%</span>
</div>
<div class="text-end ms-2">
<div class="text-white small fw-bold">$${coin.price.toLocaleString(undefined, {minimumFractionDigits: 2})}</div>
</div>
</div>
`;
}
});
if (html) heroTicker.innerHTML = html;
}
// Update Ticker
const ticker = document.getElementById('ticker-wrap');
if (ticker) {
let html = '';
Object.keys(currentMarketData).forEach(symbol => {
const coin = currentMarketData[symbol];
const changeClass = coin.change >= 0 ? 'text-success' : 'text-danger';
html += `
<div class="d-flex align-items-center gap-2">
<span class="text-muted small fw-bold">${symbol}/USDT</span>
<span class="text-white fw-bold">${coin.price.toLocaleString(undefined, {minimumFractionDigits: 2})}</span>
<span class="${changeClass} small">${coin.change >= 0 ? '+' : ''}${coin.change.toFixed(2)}%</span>
</div>
`;
});
ticker.innerHTML = html + html;
}
// Update Trade Page if on it
if (document.getElementById('crypto-list-container')) {
updateTradePage();
}
}
function updateTradePage() {
const listContainer = document.getElementById('crypto-list-container');
const search = document.getElementById('market-search')?.value.toLowerCase() || '';
const currentSymbol = document.getElementById('current-symbol')?.value;
let html = '';
Object.keys(currentMarketData).forEach(symbol => {
if (symbol.toLowerCase().includes(search) || currentMarketData[symbol].name.toLowerCase().includes(search)) {
const coin = currentMarketData[symbol];
const active = symbol === currentSymbol ? 'active' : '';
const changeClass = coin.change >= 0 ? 'text-success' : 'text-danger';
html += `
<div class="crypto-item ${active}" onclick="window.location.href='trade.php?symbol=${symbol}'">
<div class="d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center">
<img src="${coin.icon}" class="crypto-icon">
<div>
<div class="text-white crypto-name-text">${symbol}</div>
<div class="crypto-sub-text">${coin.name}</div>
</div>
</div>
<div class="text-end">
<div class="text-white crypto-price-text">$${coin.price.toLocaleString(undefined, {minimumFractionDigits: 2})}</div>
<div class="${changeClass} crypto-change-text">${coin.change >= 0 ? '+' : ''}${coin.change.toFixed(2)}%</div>
</div>
</div>
</div>
`;
} }
}); });
listContainer.innerHTML = html;
// Intersection Observer for fade-up animations
const observerOptions = {
threshold: 0.1,
rootMargin: "0px 0px -50px 0px"
};
const observer = new IntersectionObserver((entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.classList.add('animate-up');
entry.target.style.opacity = "1";
observer.unobserve(entry.target); // Only animate once
}
});
}, observerOptions);
// Select elements to animate (add a class 'reveal' to them in HTML if not already handled by CSS animation)
// For now, let's just make sure the hero animations run.
// If we want scroll animations, we'd add opacity: 0 to elements in CSS and reveal them here.
// Given the request, the CSS animation I added runs on load for Hero.
// Let's make the project cards animate in.
const projectCards = document.querySelectorAll('.project-card'); // Update header info
projectCards.forEach((card, index) => { if (currentSymbol && currentMarketData[currentSymbol]) {
card.style.opacity = "0"; const coin = currentMarketData[currentSymbol];
card.style.animationDelay = `${index * 0.1}s`; const lastPriceEl = document.getElementById('last-price');
observer.observe(card); if (lastPriceEl) {
}); const oldPrice = parseFloat(lastPriceEl.innerText.replace(/[$,]/g, '')) || 0;
lastPriceEl.innerText = '$' + coin.price.toLocaleString(undefined, {minimumFractionDigits: 2});
lastPriceEl.className = coin.price >= oldPrice ? 'fw-bold text-success fs-5' : 'fw-bold text-danger fs-5';
const bookPriceEl = document.getElementById('book-price');
if (bookPriceEl) bookPriceEl.innerText = coin.price.toLocaleString(undefined, {minimumFractionDigits: 2});
// If Market tab is active and price field is empty, update it
const marketTab = document.getElementById('tab-market');
if (marketTab && marketTab.classList.contains('active')) {
const priceInput = document.getElementById('order-price');
if (priceInput && !priceInput.value) {
priceInput.value = coin.price;
}
}
}
const changeEl = document.getElementById('24h-change');
if (changeEl) {
changeEl.innerText = (coin.change >= 0 ? '+' : '') + coin.change.toFixed(2) + '%';
changeEl.className = 'fw-bold ' + (coin.change >= 0 ? 'text-success' : 'text-danger');
}
if (document.getElementById('24h-high')) document.getElementById('24h-high').innerText = '$' + (coin.price * 1.05).toLocaleString(undefined, {minimumFractionDigits: 2});
if (document.getElementById('24h-low')) document.getElementById('24h-low').innerText = '$' + (coin.price * 0.95).toLocaleString(undefined, {minimumFractionDigits: 2});
if (document.getElementById('price-fiat')) {
const isZh = document.documentElement.lang === 'zh';
const rate = isZh ? 7.2 : 1.0;
const symbol = isZh ? '¥' : '$';
document.getElementById('price-fiat').innerText = '≈ ' + symbol + (coin.price * rate).toLocaleString(undefined, {minimumFractionDigits: 2});
}
}
simulateOrderBook();
}
function simulateOrderBook() {
const symbol = document.getElementById('current-symbol')?.value;
if (!symbol || !currentMarketData[symbol]) return;
const basePrice = currentMarketData[symbol].price;
const askContainer = document.getElementById('order-book-asks');
const bidContainer = document.getElementById('order-book-bids');
if (!askContainer || !bidContainer) return;
let askHtml = '';
let bidHtml = '';
for (let i = 5; i > 0; i--) {
const price = basePrice * (1 + (i * 0.0002));
const amount = Math.random() * 2 + 0.1;
const depth = Math.random() * 80 + 10;
askHtml += `
<div class="order-book-row ask" onclick="document.getElementById('order-price').value = ${price.toFixed(2)}">
<div class="depth-bg ask" style="width: ${depth}%"></div>
<span class="price">${price.toFixed(2)}</span>
<span class="amount">${amount.toFixed(4)}</span>
</div>
`;
}
for (let i = 1; i <= 5; i++) {
const price = basePrice * (1 - (i * 0.0002));
const amount = Math.random() * 2 + 0.1;
const depth = Math.random() * 80 + 10;
bidHtml += `
<div class="order-book-row bid" onclick="document.getElementById('order-price').value = ${price.toFixed(2)}">
<div class="depth-bg bid" style="width: ${depth}%"></div>
<span class="price">${price.toFixed(2)}</span>
<span class="amount">${amount.toFixed(4)}</span>
</div>
`;
}
askContainer.innerHTML = askHtml;
bidContainer.innerHTML = bidHtml;
}
// Initialization
document.addEventListener('DOMContentLoaded', () => {
fetchMarketData();
setInterval(fetchMarketData, 3000);
const searchInput = document.getElementById('market-search');
if (searchInput) {
searchInput.addEventListener('input', updateUI);
}
}); });

Binary file not shown.

After

Width:  |  Height:  |  Size: 322 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

126
buy.php Normal file
View File

@ -0,0 +1,126 @@
<?php
include 'includes/header.php';
$currencies = [
['code' => 'USD', 'name' => 'US Dollar', 'symbol' => '$'],
['code' => 'EUR', 'name' => 'Euro', 'symbol' => '€'],
['code' => 'CNY', 'name' => 'Chinese Yuan', 'symbol' => '¥'],
];
$cryptos = [
['symbol' => 'BTC', 'name' => 'Bitcoin'],
['symbol' => 'ETH', 'name' => 'Ethereum'],
['symbol' => 'USDT', 'name' => 'Tether'],
];
?>
<style>
.buy-card {
background-color: var(--card-bg);
border: 1px solid var(--border-color);
border-radius: 20px;
padding: 40px;
max-width: 500px;
margin: 0 auto;
}
.buy-tabs .nav-link {
color: #848e9c;
border: none;
font-weight: 600;
font-size: 1.2rem;
padding: 0 20px 10px 20px;
}
.buy-tabs .nav-link.active {
color: var(--okx-blue);
background: transparent;
border-bottom: 3px solid var(--okx-blue);
}
.input-box {
background-color: #0b0e11;
border: 1px solid var(--border-color);
border-radius: 12px;
padding: 15px;
margin-bottom: 20px;
}
.input-box label {
color: #848e9c;
font-size: 0.9rem;
display: block;
margin-bottom: 5px;
}
.input-box input {
background: transparent;
border: none;
color: white;
font-size: 1.5rem;
font-weight: 600;
width: 100%;
outline: none;
}
.currency-select {
background-color: var(--border-color);
border-radius: 20px;
padding: 5px 15px;
font-weight: 600;
display: flex;
align-items: center;
gap: 8px;
cursor: pointer;
}
</style>
<main class="container py-5" style="min-height: 70vh;">
<div class="text-center mb-5">
<h1 class="display-5 fw-bold"><?php echo mt('Buy_Crypto'); ?></h1>
<p class="text-muted">Buy crypto with credit card, bank transfer, or P2P.</p>
</div>
<div class="buy-card">
<ul class="nav nav-tabs buy-tabs border-0 mb-4 justify-content-center">
<li class="nav-item"><a class="nav-link active" data-bs-toggle="tab" href="#buy">Buy</a></li>
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#sell">Sell</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active" id="buy">
<div class="input-box">
<div class="d-flex justify-content-between align-items-center mb-1">
<label>Pay</label>
</div>
<div class="d-flex align-items-center">
<input type="number" placeholder="100 - 20,000" value="1000">
<div class="currency-select">
<i class="fas fa-dollar-sign"></i> USD <i class="fas fa-caret-down"></i>
</div>
</div>
</div>
<div class="text-center mb-3">
<i class="fas fa-exchange-alt fa-rotate-90 text-muted"></i>
</div>
<div class="input-box">
<div class="d-flex justify-content-between align-items-center mb-1">
<label>Receive</label>
</div>
<div class="d-flex align-items-center">
<input type="number" placeholder="0.00" value="0.023" readonly>
<div class="currency-select">
<img src="https://static.okx.com/cdn/oksupport/asset/currency/icon/btc.png" width="20"> BTC <i class="fas fa-caret-down"></i>
</div>
</div>
</div>
<div class="d-flex justify-content-between small text-muted mb-4">
<span>Reference Price</span>
<span>1 BTC 43,250.50 USD</span>
</div>
<button class="btn btn-primary w-100 py-3 fw-bold rounded-pill mb-3">Buy BTC</button>
<p class="text-center small text-muted">Supported payment methods: Visa, Mastercard, Apple Pay, Google Pay.</p>
</div>
</div>
</div>
</section>
<?php include 'includes/footer.php'; ?>

113
chat.php Normal file
View File

@ -0,0 +1,113 @@
<?php
require_once 'includes/header.php';
if (!$user) {
header('Location: login.php');
exit;
}
$uid = str_pad($user['uid'], 6, '0', STR_PAD_LEFT);
?>
<div class="container py-5" style="max-width: 800px; min-height: 80vh;">
<div class="d-flex align-items-center mb-4">
<button onclick="history.back()" class="btn btn-dark rounded-circle me-3 border-secondary" style="width: 40px; height: 40px;">
<i class="fas fa-arrow-left"></i>
</button>
<h2 class="fw-bold mb-0 text-white"><?php echo mt('Customer Service'); ?></h2>
</div>
<div class="card bg-dark border-secondary overflow-hidden shadow-lg" style="border-radius: 20px; height: 600px; display: flex; flex-direction: column;">
<!-- Chat Header -->
<div class="p-3 bg-secondary bg-opacity-10 border-bottom border-secondary d-flex align-items-center justify-content-between">
<div class="d-flex align-items-center">
<div class="position-relative">
<img src="https://ui-avatars.com/api/?name=Support&background=0046ff&color=fff" class="rounded-circle me-3" width="45">
<span class="position-absolute bottom-0 end-0 bg-success border border-white rounded-circle" style="width: 12px; height: 12px; margin-right: 15px; margin-bottom: 2px;"></span>
</div>
<div>
<h6 class="mb-0 text-white fw-bold">BITCrypto Support</h6>
<small class="text-success">Online UID: <?php echo $uid; ?></small>
</div>
</div>
<div class="text-muted small">
<?php echo date('H:i'); ?>
</div>
</div>
<!-- Chat Messages -->
<div id="chat-messages" class="flex-grow-1 p-4 overflow-auto d-flex flex-column gap-3" style="background: rgba(0,0,0,0.2);">
<div class="message-received">
<div class="p-3 bg-secondary bg-opacity-25 rounded-4 text-white d-inline-block" style="max-width: 80%;">
<?php echo mt('Hello! Welcome to BITCrypto. How can we help you today?'); ?>
</div>
<div class="small text-muted mt-1 ms-2"><?php echo date('H:i'); ?></div>
</div>
</div>
<!-- Chat Input -->
<div class="p-3 border-top border-secondary bg-dark">
<form id="chat-form" onsubmit="sendMessage(event)">
<div class="input-group">
<button type="button" class="btn btn-dark border-secondary px-3"><i class="fas fa-plus"></i></button>
<input type="text" id="chat-input" class="form-control bg-secondary bg-opacity-10 border-secondary text-white shadow-none px-3" placeholder="<?php echo mt('Type a message...'); ?>" autocomplete="off">
<button type="submit" class="btn btn-primary px-4 fw-bold" style="background: var(--okx-blue); border: none;">
<i class="fas fa-paper-plane"></i>
</button>
</div>
</form>
</div>
</div>
<div class="mt-4 p-4 bg-secondary bg-opacity-10 rounded-4 border border-secondary border-opacity-25">
<div class="d-flex align-items-center gap-3">
<i class="fas fa-info-circle text-primary fs-4"></i>
<p class="mb-0 text-muted small">
<?php echo mt('For security reasons, never share your login or trading passwords with anyone, including our support agents.'); ?>
</p>
</div>
</div>
</div>
<style>
.message-sent { align-self: flex-end; text-align: right; }
.message-sent .content { background: var(--okx-blue); color: white; padding: 10px 18px; border-radius: 20px 20px 2px 20px; display: inline-block; max-width: 80%; }
.message-received { align-self: flex-start; }
.message-received .content { background: rgba(255,255,255,0.05); color: white; padding: 10px 18px; border-radius: 20px 20px 20px 2px; display: inline-block; max-width: 80%; }
</style>
<script>
function sendMessage(e) {
e.preventDefault();
const input = document.getElementById('chat-input');
const text = input.value.trim();
if (!text) return;
const messages = document.getElementById('chat-messages');
const time = new Date().toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' });
const sentDiv = document.createElement('div');
sentDiv.className = 'message-sent';
sentDiv.innerHTML = `
<div class="content">${text}</div>
<div class="small text-muted mt-1 me-2">${time}</div>
`;
messages.appendChild(sentDiv);
input.value = '';
messages.scrollTop = messages.scrollHeight;
// Simulated Bot Response
setTimeout(() => {
const receivedDiv = document.createElement('div');
receivedDiv.className = 'message-received';
receivedDiv.innerHTML = `
<div class="content"><?php echo mt('Thank you for your message. An agent will be with you shortly.'); ?></div>
<div class="small text-muted mt-1 ms-2">${time}</div>
`;
messages.appendChild(receivedDiv);
messages.scrollTop = messages.scrollHeight;
}, 1500);
}
</script>
<?php require_once 'includes/footer.php'; ?>

View File

@ -0,0 +1,54 @@
CREATE TABLE IF NOT EXISTS system_config (
id INT AUTO_INCREMENT PRIMARY KEY,
config_key VARCHAR(100) UNIQUE NOT NULL,
config_value TEXT,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS cryptocurrencies (
id INT AUTO_INCREMENT PRIMARY KEY,
symbol VARCHAR(20) UNIQUE NOT NULL,
name VARCHAR(100) NOT NULL,
icon_url VARCHAR(255),
current_price DECIMAL(30, 10) DEFAULT 0,
change_24h DECIMAL(10, 4) DEFAULT 0,
high_24h DECIMAL(30, 10) DEFAULT 0,
low_24h DECIMAL(30, 10) DEFAULT 0,
volume_24h DECIMAL(30, 10) DEFAULT 0,
is_active TINYINT(1) DEFAULT 1,
sort_order INT DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS price_controls (
id INT AUTO_INCREMENT PRIMARY KEY,
symbol VARCHAR(20) NOT NULL,
target_price DECIMAL(30, 10),
type ENUM('spike', 'target', 'win_loss') DEFAULT 'target',
duration INT DEFAULT 0, -- in seconds
is_active TINYINT(1) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS users (
id INT AUTO_INCREMENT PRIMARY KEY,
username VARCHAR(100) UNIQUE NOT NULL,
email VARCHAR(255) UNIQUE NOT NULL,
password_hash VARCHAR(255) NOT NULL,
balance_usdt DECIMAL(30, 10) DEFAULT 0,
win_loss_control ENUM('random', 'always_win', 'always_loss') DEFAULT 'random',
is_admin TINYINT(1) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
-- Insert some default data
INSERT IGNORE INTO system_config (config_key, config_value) VALUES
('site_name', 'OKX Clone'),
('theme_color', '#0b0e11'),
('announcement', 'Welcome to our professional trading platform!');
INSERT IGNORE INTO cryptocurrencies (symbol, name, icon_url, current_price, change_24h, high_24h, low_24h, volume_24h) VALUES
('BTC', 'Bitcoin', 'https://cryptologos.cc/logos/bitcoin-btc-logo.png', 45231.50, 2.45, 46120.00, 44800.00, 1250000000),
('ETH', 'Ethereum', 'https://cryptologos.cc/logos/ethereum-eth-logo.png', 2450.20, -1.20, 2510.00, 2400.00, 850000000),
('SOL', 'Solana', 'https://cryptologos.cc/logos/solana-sol-logo.png', 98.45, 5.60, 102.00, 92.00, 450000000);

View File

@ -0,0 +1,93 @@
-- Orders table for Spot trading
CREATE TABLE IF NOT EXISTS spot_orders (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
symbol VARCHAR(20) NOT NULL,
side ENUM('buy', 'sell') NOT NULL,
type ENUM('limit', 'market') DEFAULT 'limit',
price DECIMAL(30, 10),
amount DECIMAL(30, 10) NOT NULL,
filled_amount DECIMAL(30, 10) DEFAULT 0,
status ENUM('open', 'filled', 'cancelled', 'partially_filled') DEFAULT 'open',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
FOREIGN KEY (user_id) REFERENCES users(id)
);
-- Positions table for Perpetual Contracts
CREATE TABLE IF NOT EXISTS contract_positions (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
symbol VARCHAR(20) NOT NULL,
side ENUM('long', 'short') NOT NULL,
leverage INT DEFAULT 1,
entry_price DECIMAL(30, 10) NOT NULL,
size DECIMAL(30, 10) NOT NULL,
margin DECIMAL(30, 10) NOT NULL,
liquidation_price DECIMAL(30, 10),
unrealized_pnl DECIMAL(30, 10) DEFAULT 0,
status ENUM('active', 'closed', 'liquidated') DEFAULT 'active',
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
closed_at TIMESTAMP NULL,
FOREIGN KEY (user_id) REFERENCES users(id)
);
-- Carousel for Landing Page
CREATE TABLE IF NOT EXISTS carousel (
id INT AUTO_INCREMENT PRIMARY KEY,
image_url VARCHAR(255) NOT NULL,
title VARCHAR(100),
description TEXT,
link_url VARCHAR(255),
sort_order INT DEFAULT 0,
is_active TINYINT(1) DEFAULT 1
);
-- Languages Table
CREATE TABLE IF NOT EXISTS languages (
id INT AUTO_INCREMENT PRIMARY KEY,
code VARCHAR(10) UNIQUE NOT NULL, -- e.g., 'en', 'zh', 'ja', 'ko', 'ru', 'fr', 'es', 'de'
name VARCHAR(50) NOT NULL,
is_default TINYINT(1) DEFAULT 0
);
-- Translations Table
CREATE TABLE IF NOT EXISTS translations (
id INT AUTO_INCREMENT PRIMARY KEY,
lang_code VARCHAR(10) NOT NULL,
trans_key VARCHAR(255) NOT NULL,
trans_value TEXT NOT NULL,
UNIQUE KEY (lang_code, trans_key)
);
-- Update system config for BITCrypto
UPDATE system_config SET config_value = 'BITCrypto' WHERE config_key = 'site_name';
-- Insert Languages
INSERT IGNORE INTO languages (code, name, is_default) VALUES
('en', 'English', 1),
('zh', '简体中文', 0),
('ja', '日本語', 0),
('ko', '한국어', 0),
('ru', 'Русский', 0),
('fr', 'Français', 0),
('es', 'Español', 0),
('de', 'Deutsch', 0);
-- Insert Carousel Data (Using placeholder images for now)
INSERT IGNORE INTO carousel (image_url, title, description, sort_order) VALUES
('https://images.pexels.com/photos/844124/pexels-photo-844124.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', 'Global Leading Exchange', 'Trade BTC, ETH and 500+ assets with BITCrypto.', 1),
('https://images.pexels.com/photos/6770610/pexels-photo-6770610.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', 'Perpetual Contracts', 'Up to 125x leverage on major pairs.', 2),
('https://images.pexels.com/photos/6771574/pexels-photo-6771574.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', 'Secure & Reliable', 'Bank-level security for your digital assets.', 3),
('https://images.pexels.com/photos/5980860/pexels-photo-5980860.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', '24/7 Support', 'Our team is here to help you anytime.', 4),
('https://images.pexels.com/photos/7567443/pexels-photo-7567443.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1', 'Low Trading Fees', 'Enjoy the most competitive fees in the industry.', 5);
-- Add more coins
INSERT IGNORE INTO cryptocurrencies (symbol, name, icon_url, current_price, change_24h) VALUES
('BNB', 'BNB', 'https://cryptologos.cc/logos/bnb-bnb-logo.png', 312.45, 1.2),
('XRP', 'XRP', 'https://cryptologos.cc/logos/xrp-xrp-logo.png', 0.52, -0.5),
('ADA', 'Cardano', 'https://cryptologos.cc/logos/cardano-ada-logo.png', 0.48, 2.3),
('AVAX', 'Avalanche', 'https://cryptologos.cc/logos/avalanche-avax-logo.png', 35.60, 4.1),
('DOT', 'Polkadot', 'https://cryptologos.cc/logos/polkadot-new-dot-logo.png', 7.20, -1.8),
('MATIC', 'Polygon', 'https://cryptologos.cc/logos/polygon-matic-logo.png', 0.85, 0.9),
('LINK', 'Chainlink', 'https://cryptologos.cc/logos/chainlink-link-logo.png', 18.30, 3.5),
('DOGE', 'Dogecoin', 'https://cryptologos.cc/logos/dogecoin-doge-logo.png', 0.08, -2.1);

View File

@ -0,0 +1,24 @@
-- Migration: User and System Updates
-- Adds UID, KYC fields, and system configuration tables
ALTER TABLE users ADD COLUMN uid INT(6) ZEROFILL UNIQUE AFTER id;
ALTER TABLE users ADD COLUMN real_name VARCHAR(100) AFTER username;
ALTER TABLE users ADD COLUMN id_number VARCHAR(50) AFTER real_name;
ALTER TABLE users ADD COLUMN id_front VARCHAR(255) AFTER id_number;
ALTER TABLE users ADD COLUMN id_back VARCHAR(255) AFTER id_front;
ALTER TABLE users ADD COLUMN id_handheld VARCHAR(255) AFTER id_back;
ALTER TABLE users ADD COLUMN kyc_status ENUM('none', 'pending', 'approved', 'rejected') DEFAULT 'none' AFTER id_handheld;
ALTER TABLE users ADD COLUMN security_password VARCHAR(255) AFTER password_hash;
-- system_config might already exist from 01, but translations doesn't
CREATE TABLE IF NOT EXISTS translations (
id INT AUTO_INCREMENT PRIMARY KEY,
lang_code VARCHAR(10),
trans_key VARCHAR(100),
trans_value TEXT,
UNIQUE KEY (lang_code, trans_key)
);
INSERT IGNORE INTO system_config (config_key, config_value) VALUES ('win_loss_rate', '50');
INSERT IGNORE INTO system_config (config_key, config_value) VALUES ('price_control_mode', 'market');
INSERT IGNORE INTO system_config (config_key, config_value) VALUES ('site_name', 'BITCrypto');

View File

@ -0,0 +1,25 @@
-- Migration: Chat and Deposits
-- Adds chat support and deposit tracking
CREATE TABLE IF NOT EXISTS chat_messages (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
admin_id INT DEFAULT NULL, -- NULL means sent by user
message TEXT,
attachment_url VARCHAR(255) DEFAULT NULL,
is_read TINYINT(1) DEFAULT 0,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);
CREATE TABLE IF NOT EXISTS deposits (
id INT AUTO_INCREMENT PRIMARY KEY,
user_id INT NOT NULL,
currency VARCHAR(20) DEFAULT 'USDT',
amount DECIMAL(30, 10) NOT NULL,
status ENUM('pending', 'approved', 'rejected') DEFAULT 'pending',
receipt_url VARCHAR(255) DEFAULT NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
);
-- Note: uid was already added in migration 03.

View File

@ -0,0 +1,9 @@
-- Migration: Admin Setup
-- Adds a default admin account if not exists
INSERT IGNORE INTO users (username, email, password_hash, is_admin, balance_usdt)
VALUES ('admin', 'admin@example.com', '$2y$10$ogw037RdI4xc57das64Rg.we/M9V.Z3xe7H2VT8eVJJ9t7W6xmZaK', 1, 999999.00);
-- Update all existing users to have a UID if they don't have one (simple sequential)
-- This is a bit tricky in pure SQL without a loop, but we can try setting them to ID
UPDATE users SET uid = id WHERE uid = 0 OR uid IS NULL;

307
deposit.php Normal file
View File

@ -0,0 +1,307 @@
<?php
require_once 'includes/header.php';
if (!$user) {
header('Location: login.php');
exit;
}
$fiat_currencies = [
'USD' => ['name' => 'US Dollar', 'symbol' => '$', 'rate' => 1.0, 'region' => 'Americas'],
'EUR' => ['name' => 'Euro', 'symbol' => '€', 'rate' => 0.92, 'region' => 'Europe'],
'CNY' => ['name' => 'Chinese Yuan', 'symbol' => '¥', 'rate' => 7.21, 'region' => 'Asia'],
'JPY' => ['name' => 'Japanese Yen', 'symbol' => '¥', 'rate' => 149.5, 'region' => 'Asia'],
'KRW' => ['name' => 'South Korean Won', 'symbol' => '₩', 'rate' => 1335.0, 'region' => 'Asia'],
'GBP' => ['name' => 'British Pound', 'symbol' => '£', 'rate' => 0.79, 'region' => 'Europe'],
'RUB' => ['name' => 'Russian Ruble', 'symbol' => '₽', 'rate' => 92.4, 'region' => 'Europe'],
'HKD' => ['name' => 'Hong Kong Dollar', 'symbol' => 'HK$', 'rate' => 7.82, 'region' => 'Asia'],
'SGD' => ['name' => 'Singapore Dollar', 'symbol' => 'S$', 'rate' => 1.34, 'region' => 'Asia'],
'AUD' => ['name' => 'Australian Dollar', 'symbol' => 'A$', 'rate' => 1.53, 'region' => 'Oceania'],
'CAD' => ['name' => 'Canadian Dollar', 'symbol' => 'C$', 'rate' => 1.35, 'region' => 'Americas'],
'BRL' => ['name' => 'Brazilian Real', 'symbol' => 'R$', 'rate' => 4.98, 'region' => 'Americas'],
'INR' => ['name' => 'Indian Rupee', 'symbol' => '₹', 'rate' => 83.0, 'region' => 'Asia'],
'VND' => ['name' => 'Vietnamese Dong', 'symbol' => '₫', 'rate' => 24500.0, 'region' => 'Asia'],
'THB' => ['name' => 'Thai Baht', 'symbol' => '฿', 'rate' => 35.8, 'region' => 'Asia'],
'MYR' => ['name' => 'Malaysian Ringgit', 'symbol' => 'RM', 'rate' => 4.77, 'region' => 'Asia'],
'IDR' => ['name' => 'Indonesian Rupiah', 'symbol' => 'Rp', 'rate' => 15600.0, 'region' => 'Asia'],
'PHP' => ['name' => 'Philippine Peso', 'symbol' => '₱', 'rate' => 56.1, 'region' => 'Asia'],
'AED' => ['name' => 'UAE Dirham', 'symbol' => 'د.إ', 'rate' => 3.67, 'region' => 'Middle East'],
'TRY' => ['name' => 'Turkish Lira', 'symbol' => '₺', 'rate' => 31.0, 'region' => 'Europe/Asia'],
];
// Group by region for better UI
$grouped_fiat = [];
foreach ($fiat_currencies as $code => $data) {
$grouped_fiat[$data['region']][$code] = $data;
}
// Handle Receipt Upload
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_FILES['receipt'])) {
$amount = $_POST['amount'] ?? 0;
$currency = $_POST['currency'] ?? 'USDT';
$target_dir = "uploads/receipts/";
if (!is_dir($target_dir)) mkdir($target_dir, 0777, true);
$file_ext = pathinfo($_FILES["receipt"]["name"], PATHINFO_EXTENSION);
$file_name = time() . "_" . $user['id'] . "." . $file_ext;
$target_file = $target_dir . $file_name;
if (move_uploaded_file($_FILES["receipt"]["tmp_name"], $target_file)) {
// Save to DB
$stmt = db()->prepare("INSERT INTO deposits (user_id, amount, currency, receipt_url, status) VALUES (?, ?, ?, ?, 'pending')");
$stmt->execute([$user['id'], $amount, $currency, $target_file]);
// Notify admin via chat (simulated message)
$msg = "New deposit request: $amount $currency. UID: " . ($user['uid'] ?? '000000');
$stmt = db()->prepare("INSERT INTO chat_messages (user_id, message, attachment_url) VALUES (?, ?, ?)");
$stmt->execute([$user['id'], $msg, $target_file]);
echo "<script>alert('" . mt('Receipt uploaded successfully. Waiting for admin approval.') . "'); window.location.href='profile.php';</script>";
exit;
}
}
?>
<div class="container my-5 py-5">
<div class="row justify-content-center">
<div class="col-md-11 col-lg-10">
<div class="text-center mb-5">
<h1 class="fw-bold text-white mb-2"><?php echo mt('Deposit Assets'); ?></h1>
<p class="text-muted"><?php echo mt('Choose your preferred method to fund your account'); ?></p>
</div>
<div class="card bg-dark border-secondary shadow-lg overflow-hidden" style="border-radius: 30px;">
<div class="row g-0">
<div class="col-md-3 border-end border-secondary bg-secondary bg-opacity-10">
<div class="nav flex-column nav-pills p-3 h-100" id="deposit-tabs" role="tablist">
<button class="nav-link active mb-2 text-start p-3 rounded-4" id="crypto-tab" data-bs-toggle="pill" data-bs-target="#crypto-pane">
<i class="fas fa-coins me-2"></i> <?php echo mt('Crypto Deposit'); ?>
</button>
<button class="nav-link mb-2 text-start p-3 rounded-4" id="fiat-tab" data-bs-toggle="pill" data-bs-target="#fiat-pane">
<i class="fas fa-university me-2"></i> <?php echo mt('Fiat Deposit'); ?>
</button>
</div>
</div>
<div class="col-md-9 p-4 p-md-5">
<div class="tab-content">
<!-- Crypto Pane -->
<div class="tab-pane fade show active" id="crypto-pane">
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold mb-0 text-white"><?php echo mt('Crypto Deposit'); ?></h3>
<span class="badge bg-primary bg-opacity-10 text-primary px-3 py-2 rounded-pill"><?php echo mt('Instant'); ?></span>
</div>
<div class="row g-4">
<div class="col-md-6">
<div class="mb-4">
<label class="small text-muted mb-2"><?php echo mt('Select Currency'); ?></label>
<select class="form-select bg-dark text-white border-secondary py-3 rounded-4" id="crypto-select">
<option value="USDT">USDT (TRC20)</option>
<option value="BTC">BTC (Bitcoin)</option>
<option value="ETH">ETH (ERC20)</option>
</select>
</div>
<div id="deposit-details">
<div class="p-3 bg-secondary bg-opacity-10 rounded-4 border border-secondary mb-3">
<div class="small text-muted mb-1"><?php echo mt('Network'); ?></div>
<div class="fw-bold text-white" id="network-name">Tron (TRC20)</div>
</div>
<div class="p-3 bg-secondary bg-opacity-10 rounded-4 border border-secondary">
<div class="small text-muted mb-1"><?php echo mt('Deposit Address'); ?></div>
<div class="fw-bold text-white text-break font-monospace" id="deposit-addr">TWr8mP9PjH5pX9pX9pX9pX9pX9pX9pX9pX</div>
<button class="btn btn-sm btn-primary mt-3 rounded-pill px-4" onclick="copyAddr()">
<i class="fas fa-copy me-1"></i> <?php echo mt('Copy'); ?>
</button>
</div>
</div>
</div>
<div class="col-md-6">
<div class="text-center mb-4">
<div class="bg-white p-3 d-inline-block rounded-4 mb-3 shadow">
<img src="https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=TWr8mP9PjH5pX9pX9pX9pX9pX9pX9pX9pX&color=0b0e11" alt="QR" width="150" id="deposit-qr">
</div>
<p class="small text-muted"><?php echo mt('Scan QR code to deposit'); ?></p>
</div>
<form method="POST" enctype="multipart/form-data" class="mt-2 bg-secondary bg-opacity-10 p-4 rounded-4 border border-secondary border-opacity-50">
<input type="hidden" name="currency" id="h-currency" value="USDT">
<div class="mb-3">
<label class="small text-muted mb-2"><?php echo mt('Deposit Amount'); ?></label>
<div class="input-group">
<input type="number" name="amount" class="form-control bg-dark text-white border-secondary rounded-start-4 py-2" placeholder="0.00" step="0.01" required>
<span class="input-group-text bg-dark border-secondary text-muted rounded-end-4" id="crypto-label">USDT</span>
</div>
</div>
<div class="mb-4">
<label class="small text-muted mb-2"><?php echo mt('Upload Proof'); ?></label>
<input type="file" name="receipt" class="form-control bg-dark text-white border-secondary rounded-4 py-2" accept="image/*" required>
<div class="small text-muted mt-2"><i class="fas fa-info-circle me-1"></i> <?php echo mt('Upload screenshot of your transaction'); ?></div>
</div>
<button type="submit" class="btn btn-primary w-100 py-3 rounded-4 fw-bold shadow">
<i class="fas fa-upload me-2"></i> <?php echo mt('Submit Deposit'); ?>
</button>
</form>
</div>
</div>
</div>
<!-- Fiat Pane -->
<div class="tab-pane fade" id="fiat-pane">
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold mb-0 text-white"><?php echo mt('Fiat Deposit'); ?></h3>
<span class="badge bg-success bg-opacity-10 text-success px-3 py-2 rounded-pill"><?php echo mt('Regional Support'); ?></span>
</div>
<form action="matching.php" method="POST" id="fiat-form">
<div class="row g-4">
<div class="col-md-7">
<div class="mb-4">
<label class="small text-muted mb-2"><?php echo mt('Select Fiat Currency'); ?></label>
<select name="fiat_currency" id="fiat-currency" class="form-select bg-dark text-white border-secondary py-3 rounded-4 shadow-sm" onchange="updateRate()">
<?php foreach($grouped_fiat as $region => $coins): ?>
<optgroup label="<?php echo $region; ?>">
<?php foreach($coins as $code => $data): ?>
<option value="<?php echo $code; ?>" data-rate="<?php echo $data['rate']; ?>" data-symbol="<?php echo $data['symbol']; ?>">
<?php echo $code; ?> - <?php echo $data['name']; ?>
</option>
<?php endforeach; ?>
</optgroup>
<?php endforeach; ?>
</select>
</div>
<div class="mb-4">
<label class="small text-muted mb-2"><?php echo mt('Amount'); ?></label>
<div class="input-group">
<span class="input-group-text bg-dark border-secondary text-white rounded-start-4 px-3" id="currency-symbol">$</span>
<input type="number" name="amount" id="fiat-amount" class="form-control bg-dark text-white border-secondary py-3" placeholder="0.00" oninput="updateRate()" required>
<span class="input-group-text bg-dark border-secondary text-muted rounded-end-4" id="fiat-code">USD</span>
</div>
</div>
<div class="alert alert-primary bg-primary bg-opacity-10 border-primary border-opacity-20 rounded-4 p-3 mb-0">
<div class="d-flex">
<i class="fas fa-info-circle mt-1 me-3"></i>
<div class="small">
<?php echo mt('We will match you with a local merchant to facilitate your deposit in your local currency.'); ?>
</div>
</div>
</div>
</div>
<div class="col-md-5">
<div class="p-4 bg-secondary bg-opacity-10 border border-secondary rounded-4 h-100 d-flex flex-column justify-content-center text-center">
<div class="small text-muted mb-2"><?php echo mt('Est. Arrival'); ?></div>
<div class="display-5 fw-bold text-white mb-2"><span id="usdt-amount">0.00</span> <span class="fs-4">USDT</span></div>
<div class="small text-muted"><?php echo mt('Processing Time: 10-30 mins'); ?></div>
<hr class="my-4 border-secondary border-opacity-50">
<div class="text-start small text-muted">
<div class="d-flex justify-content-between mb-2">
<span><?php echo mt('Exchange Rate'); ?>:</span>
<span id="display-rate">1 USDT 1.00 USD</span>
</div>
<div class="d-flex justify-content-between">
<span><?php echo mt('Service Fee'); ?>:</span>
<span class="text-success"><?php echo mt('Free'); ?></span>
</div>
</div>
</div>
</div>
</div>
<div class="mt-5">
<button type="submit" class="btn btn-primary btn-lg w-100 py-3 rounded-4 fw-bold shadow-lg">
<?php echo mt('Confirm Deposit'); ?> <i class="fas fa-arrow-right ms-2"></i>
</button>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
<div class="mt-4 row g-4">
<div class="col-md-4">
<div class="p-4 rounded-4 bg-white bg-opacity-5 border border-white border-opacity-10 d-flex align-items-center gap-3">
<i class="fas fa-shield-check fa-2x text-primary"></i>
<div>
<h6 class="text-white mb-1"><?php echo mt('Secure Payment'); ?></h6>
<p class="small text-muted mb-0"><?php echo mt('All transactions are encrypted'); ?></p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="p-4 rounded-4 bg-white bg-opacity-5 border border-white border-opacity-10 d-flex align-items-center gap-3">
<i class="fas fa-clock fa-2x text-primary"></i>
<div>
<h6 class="text-white mb-1"><?php echo mt('Fast Arrival'); ?></h6>
<p class="small text-muted mb-0"><?php echo mt('Most deposits arrive in mins'); ?></p>
</div>
</div>
</div>
<div class="col-md-4">
<div class="p-4 rounded-4 bg-white bg-opacity-5 border border-white border-opacity-10 d-flex align-items-center gap-3">
<i class="fas fa-headset fa-2x text-primary"></i>
<div>
<h6 class="text-white mb-1"><?php echo mt('24/7 Support'); ?></h6>
<p class="small text-muted mb-0"><?php echo mt('Live help for your deposit'); ?></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function copyAddr() {
const addr = document.getElementById('deposit-addr').innerText;
navigator.clipboard.writeText(addr);
alert('<?php echo mt('Address copied to clipboard'); ?>');
}
function updateRate() {
const select = document.getElementById('fiat-currency');
const option = select.options[select.selectedIndex];
const rate = parseFloat(option.getAttribute('data-rate'));
const symbol = option.getAttribute('data-symbol');
const code = select.value;
const amount = parseFloat(document.getElementById('fiat-amount').value) || 0;
document.getElementById('currency-symbol').innerText = symbol;
document.getElementById('fiat-code').innerText = code;
document.getElementById('usdt-amount').innerText = (amount / rate).toFixed(2);
document.getElementById('display-rate').innerText = `1 USDT ≈ ${rate.toFixed(2)} ${code}`;
}
document.getElementById('crypto-select').addEventListener('change', function() {
const val = this.value;
document.getElementById('h-currency').value = val;
document.getElementById('crypto-label').innerText = val;
let addr = '';
let network = '';
if (val === 'BTC') {
addr = '1A1zP1eP5QGefi2DMPTfTL5SLmv7DivfNa';
network = 'Bitcoin';
} else if (val === 'ETH') {
addr = '0x742d35Cc6634C0532925a3b844Bc454e4438f44e';
network = 'Ethereum (ERC20)';
} else {
addr = 'TWr8mP9PjH5pX9pX9pX9pX9pX9pX9pX9pX';
network = 'Tron (TRC20)';
}
document.getElementById('deposit-addr').innerText = addr;
document.getElementById('network-name').innerText = network;
document.getElementById('deposit-qr').src = `https://api.qrserver.com/v1/create-qr-code/?size=150x150&data=${addr}&color=0b0e11`;
});
document.addEventListener('DOMContentLoaded', updateRate);
</script>
<?php require_once 'includes/footer.php'; ?>

121
exchange.php Normal file
View File

@ -0,0 +1,121 @@
<?php
require_once 'includes/header.php';
if (!$user) {
header('Location: login.php');
exit;
}
$error = '';
$success = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$from_coin = $_POST['from_coin'] ?? 'USDT';
$to_coin = $_POST['to_coin'] ?? 'BTC';
$amount = (float)($_POST['amount'] ?? 0);
if ($amount <= 0) {
$error = 'Invalid amount.';
} elseif ($from_coin === $to_coin) {
$error = 'Cannot exchange same currency.';
} else {
try {
$pdo = db();
if ($from_coin === 'USDT') {
if ($user['balance_usdt'] < $amount) {
$error = 'Insufficient USDT balance.';
} else {
$rate = 43250.50;
if ($to_coin === 'ETH') $rate = 2345.20;
if ($to_coin === 'SOL') $rate = 102.45;
$receive = $amount / $rate;
$pdo->prepare("UPDATE users SET balance_usdt = balance_usdt - ? WHERE id = ?")->execute([$amount, $user['id']]);
$success = mt('Successful') . ": " . number_format($receive, 6) . " $to_coin";
$user['balance_usdt'] -= $amount;
}
} else {
$error = "Only USDT to Crypto exchange is currently supported.";
}
} catch (Exception $e) {
$error = 'Exchange failed: ' . $e->getMessage();
}
}
}
?>
<div class="container my-5 py-5">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card bg-dark border-secondary p-4 shadow-lg" style="border-radius: 20px;">
<h2 class="fw-bold mb-4 text-center text-white"><?php echo mt('Exchange'); ?></h2>
<p class="text-center text-muted mb-4"><?php echo mt('Zero fees'); ?></p>
<?php if ($error): ?>
<div class="alert alert-danger"><?php echo $error; ?></div>
<?php endif; ?>
<?php if ($success): ?>
<div class="alert alert-success"><?php echo $success; ?></div>
<?php endif; ?>
<form method="POST">
<div class="mb-4">
<label class="small text-muted mb-2"><?php echo mt('Amount'); ?></label>
<div class="input-group input-group-lg">
<input type="number" name="amount" class="form-control bg-dark text-white border-secondary" placeholder="0.00" required step="any">
<select name="from_coin" class="btn btn-dark border-secondary">
<option value="USDT">USDT</option>
</select>
</div>
<div class="small text-muted mt-2"><?php echo mt('Available'); ?>: <?php echo number_format($user['balance_usdt'], 2); ?> USDT</div>
</div>
<div class="text-center mb-4">
<i class="fas fa-exchange-alt fa-rotate-90 text-muted"></i>
</div>
<div class="mb-4">
<label class="small text-muted mb-2">To</label>
<div class="input-group input-group-lg">
<input type="text" class="form-control bg-dark text-white border-secondary" placeholder="0.00" readonly id="receive-amount">
<select name="to_coin" id="to-coin" class="btn btn-dark border-secondary">
<option value="BTC">BTC</option>
<option value="ETH">ETH</option>
<option value="SOL">SOL</option>
</select>
</div>
</div>
<div class="p-3 bg-secondary bg-opacity-10 rounded mb-4">
<div class="d-flex justify-content-between small">
<span class="text-muted"><?php echo mt('Estimated Price'); ?></span>
<span class="text-white fw-bold" id="est-price">1 BTC 43,250 USDT</span>
</div>
</div>
<button type="submit" class="btn btn-primary w-100 py-3 fw-bold fs-5" style="background-color: var(--okx-blue); border: none; border-radius: 12px;">
<?php echo mt('Convert Now'); ?>
</button>
</form>
</div>
</div>
</div>
</div>
<script>
const rates = { 'BTC': 43250.50, 'ETH': 2345.20, 'SOL': 102.45 };
function updateReceive() {
const amount = document.querySelector('input[name="amount"]').value;
const coin = document.getElementById('to-coin').value;
const rate = rates[coin];
if (amount && rate) {
document.getElementById('receive-amount').value = (amount / rate).toFixed(6);
document.getElementById('est-price').innerText = `1 ${coin} ≈ ${rate.toLocaleString()} USDT`;
}
}
document.querySelector('input[name="amount"]').addEventListener('input', updateReceive);
document.getElementById('to-coin').addEventListener('change', updateReceive);
</script>
<?php require_once 'includes/footer.php'; ?>

BIN
favicon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 551 KiB

67
includes/footer.php Normal file
View File

@ -0,0 +1,67 @@
<footer class="mt-5 py-5 border-top" style="border-color: #2b2f36 !important; background-color: #0b0e11;">
<div class="container">
<div class="row">
<div class="col-md-4 mb-4">
<div class="d-flex align-items-center mb-3">
<div class="logo-icon" style="width: 24px; height: 24px; font-size: 0.8rem; border-radius: 6px;"><i class="fas fa-cube"></i></div>
<span class="logo-text" style="font-size: 1.2rem;">BITCrypto</span>
</div>
<p class="text-muted small"><?php echo mt('The world\'s most trusted cryptocurrency exchange. Start trading BTC, ETH, and other assets with ease and security.'); ?></p>
<div class="d-flex mt-4">
<a href="#" class="text-muted me-3 fs-5"><i class="fab fa-twitter"></i></a>
<a href="#" class="text-muted me-3 fs-5"><i class="fab fa-telegram"></i></a>
<a href="#" class="text-muted me-3 fs-5"><i class="fab fa-discord"></i></a>
<a href="#" class="text-muted me-3 fs-5"><i class="fab fa-facebook"></i></a>
</div>
</div>
<div class="col-md-2 mb-4">
<h6 class="text-white fw-bold mb-3"><?php echo mt('Services'); ?></h6>
<ul class="list-unstyled mt-3 small">
<li class="mb-2"><a href="trade.php?type=spot" class="text-muted text-decoration-none hover-white"><?php echo mt('Spot Trading'); ?></a></li>
<li class="mb-2"><a href="trade.php?type=contract" class="text-muted text-decoration-none hover-white"><?php echo mt('Futures Trading'); ?></a></li>
<li class="mb-2"><a href="exchange.php" class="text-muted text-decoration-none hover-white"><?php echo mt('Exchange'); ?></a></li>
</ul>
</div>
<div class="col-md-2 mb-4">
<h6 class="text-white fw-bold mb-3"><?php echo mt('Support'); ?></h6>
<ul class="list-unstyled mt-3 small">
<li class="mb-2"><a href="page.php?slug=help-center" class="text-muted text-decoration-none hover-white"><?php echo mt('Help Center'); ?></a></li>
<li class="mb-2"><a href="page.php?slug=security-info" class="text-muted text-decoration-none hover-white"><?php echo mt('Security Center'); ?></a></li>
<li class="mb-2"><a href="javascript:void(0)" onclick="openChat()" class="text-muted text-decoration-none hover-white"><?php echo mt('Customer Service'); ?></a></li>
</ul>
</div>
<div class="col-md-2 mb-4">
<h6 class="text-white fw-bold mb-3"><?php echo mt('About Us'); ?></h6>
<ul class="list-unstyled mt-3 small">
<li class="mb-2"><a href="page.php?slug=about" class="text-muted text-decoration-none hover-white"><?php echo mt('About Us'); ?></a></li>
</ul>
</div>
<div class="col-md-2 mb-4">
<h6 class="text-white fw-bold mb-3"><?php echo mt('Legal'); ?></h6>
<ul class="list-unstyled mt-3 small">
<li class="mb-2"><a href="page.php?slug=privacy" class="text-muted text-decoration-none hover-white"><?php echo mt('Privacy Policy'); ?></a></li>
<li class="mb-2"><a href="page.php?slug=terms" class="text-muted text-decoration-none hover-white"><?php echo mt('Terms of Service'); ?></a></li>
</ul>
</div>
</div>
<hr class="my-4" style="border-color: #2b2f36 !important;">
<div class="row align-items-center small">
<div class="col-md-6 text-center text-md-start">
<p class="text-muted mb-0">&copy; 2026 BITCrypto. All rights reserved.</p>
</div>
<div class="col-md-6 text-center text-md-end mt-3 mt-md-0">
<span class="text-muted me-3"><i class="fas fa-server me-1"></i> <?php echo mt('System Status'); ?>: <span class="text-success"><?php echo mt('Normal'); ?></span></span>
</div>
</div>
</div>
</footer>
<style>
.hover-white:hover { color: white !important; }
</style>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
</body>
</html>

434
includes/header.php Normal file
View File

@ -0,0 +1,434 @@
<?php
ob_start();
require_once __DIR__ . '/../db/config.php';
session_start();
$user = null;
if (isset($_SESSION['user_id'])) {
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
$stmt->execute([$_SESSION['user_id']]);
$user = $stmt->fetch();
}
$lang = $_GET['lang'] ?? $_SESSION['lang'] ?? 'en';
if (!in_array($lang, ['en', 'zh'])) {
$lang = 'en';
}
$_SESSION['lang'] = $lang;
$translations = [
'en' => [
'Home' => 'Home', 'Spot' => 'Spot', 'Perpetual' => 'Perpetual', 'Markets' => 'Markets', 'Exchange' => 'Exchange',
'Login' => 'Login', 'Register' => 'Register', 'Profile' => 'Profile', 'Logout' => 'Logout',
'Deposit' => 'Deposit', 'Withdraw' => 'Withdraw', 'Assets' => 'Assets', 'Security' => 'Security',
'Buy' => 'Buy', 'Sell' => 'Sell', 'Limit' => 'Limit', 'Market' => 'Market', 'Price' => 'Price',
'Amount' => 'Amount', 'Total' => 'Total', 'Available' => 'Available', 'Trade' => 'Trade',
'Market Trends' => 'Market Trends', 'Real-time Prices' => 'Real-time Prices', 'High' => 'High', 'Low' => 'Low',
'Download App' => 'Download App', 'Customer Service' => 'Customer Service',
'Identity Verification' => 'Identity Verification', 'Trading Password' => 'Trading Password',
'Success' => 'Success', 'Error' => 'Error', 'Matching Account' => 'Matching Account',
'Establishing secure connection with liquidity provider...' => 'Establishing secure connection with liquidity provider...',
'Awaiting merchant confirmation...' => 'Awaiting merchant confirmation...',
'Matching in progress' => 'Matching in progress',
'The specialized account for this transaction will be provided by our agent shortly.' => 'The specialized account for this transaction will be provided by our agent shortly.',
'Transfer the exact amount. Upload proof below.' => 'Transfer the exact amount. Upload proof below.',
'Bank Name' => 'Bank Name', 'Account Number' => 'Account Number', 'Beneficiary' => 'Beneficiary', 'Reference' => 'Reference',
'Copy' => 'Copy', 'Upload Proof' => 'Upload Proof', 'Selected' => 'Selected', 'Transfer Completed' => 'Transfer Completed',
'Your transfer is being reviewed. ETA: 10-20 mins.' => 'Your transfer is being reviewed. ETA: 10-20 mins.',
'Back to Wallet' => 'Back to Wallet', 'Matched & Active' => 'Matched & Active',
'Services' => 'Services', 'Spot Trading' => 'Spot Trading', 'Futures Trading' => 'Futures Trading',
'Support' => 'Support', 'Help Center' => 'Help Center', 'About Us' => 'About Us', 'Privacy Policy' => 'Privacy Policy', 'Terms of Service' => 'Terms of Service',
'System Status' => 'System Status', 'Normal' => 'Normal', 'Overview' => 'Overview', 'Full Name' => 'Full Name', 'ID Number' => 'ID Number', 'Submit' => 'Submit', 'Next-Gen Trading Engine' => 'Next-Gen Trading Engine',
'Experience ultra-low latency and institutional-grade liquidity on our professional K-line trading platform.' => 'Experience ultra-low latency and institutional-grade liquidity on our professional K-line trading platform.',
'Register Now' => 'Register Now', 'Start Trading' => 'Start Trading', 'Go to Futures' => 'Go to Futures', 'Global Crypto Hub' => 'Global Crypto Hub',
'Access real-time global market data and execute trades across multiple asset classes with one unified account.' => 'Access real-time global market data and execute trades across multiple asset classes with one unified account.',
'Secure Asset Custody' => 'Secure Asset Custody', 'Your funds are safe with our institutional-grade security, multi-sig cold storage, and comprehensive insurance fund.' => 'Your funds are safe with our institutional-grade security, multi-sig cold storage, and comprehensive insurance fund.',
'Security Center' => 'Security Center', '24/7 Global Support' => '24/7 Global Support', 'Our dedicated professional support team is available around the clock to assist you in multiple languages.' => 'Our dedicated professional support team is available around the clock to assist you in multiple languages.',
'Contact Support' => 'Contact Support', 'Asset' => 'Asset', '24h Change' => '24h Change', '24h High' => '24h High', 'Action' => 'Action', 'All Markets' => 'All Markets',
'Real-time updates from global exchanges' => 'Real-time updates from global exchanges', 'Safe & Secure' => 'Safe & Secure', 'Industry-leading encryption and multi-signature cold storage for your digital assets.' => 'Industry-leading encryption and multi-signature cold storage for your digital assets.',
'Instant Execution' => 'Instant Execution', 'Advanced matching engine processing over 100,000 transactions per second.' => 'Advanced matching engine processing over 100,000 transactions per second.',
'Recharge' => 'Recharge', 'Withdrawal' => 'Withdrawal', 'Funds' => 'Funds',
'Wallet Balance' => 'Wallet Balance', 'Transaction History' => 'Transaction History',
'Take Profit' => 'Take Profit', 'Stop Loss' => 'Stop Loss', 'Contract' => 'Contract',
'Receipt uploaded successfully. Waiting for admin approval.' => 'Receipt uploaded successfully. Waiting for admin approval.',
'Asset Overview' => 'Asset Overview', 'KYC Verification' => 'KYC Verification', 'Personal Center' => 'Personal Center',
'Verification Status' => 'Verification Status', 'Security Settings' => 'Security Settings', 'Language' => 'Language',
'Update' => 'Update', 'Change Password' => 'Change Password', 'Not Verified' => 'Not Verified', 'Pending Review' => 'Pending Review', 'Approved' => 'Approved', 'Rejected' => 'Rejected',
'Withdrawal Address' => 'Withdrawal Address', 'Enter amount' => 'Enter amount', 'Available' => 'Available', 'Network' => 'Network', 'Fee' => 'Fee', 'Submit Withdrawal' => 'Submit Withdrawal',
'Recharge Crypto' => 'Recharge Crypto', 'Select Currency' => 'Select Currency', 'Deposit Address' => 'Deposit Address', 'Transfer to this address and upload screenshot.' => 'Transfer to this address and upload screenshot.',
'Confirm' => 'Confirm', 'Cancel' => 'Cancel', 'Please login to trade' => 'Please login to trade', 'Contract Trading' => 'Contract Trading',
'Long' => 'Long', 'Short' => 'Short', 'Leverage' => 'Leverage', 'Open Position' => 'Open Position', 'Close Position' => 'Close Position',
'Market' => 'Market', 'Limit' => 'Limit', 'Price' => 'Price', 'Amount' => 'Amount', 'Balance' => 'Balance',
'Orders' => 'Orders', 'Positions' => 'Positions', 'History' => 'History', 'Sign In' => 'Sign In', 'Sign Up' => 'Sign Up',
'Forgot Password?' => 'Forgot Password?', 'Don\'t have an account?' => 'Don\'t have an account?', 'Already have an account?' => 'Already have an account?',
'Username' => 'Username', 'Email' => 'Email', 'Password' => 'Password', 'Confirm Password' => 'Confirm Password',
'Trade Anytime, Anywhere' => 'Trade Anytime, Anywhere', 'Experience the full power of our exchange on your mobile device. Trade spot and futures with ease.' => 'Experience the full power of our exchange on your mobile device. Trade spot and futures with ease.',
'Download on the' => 'Download on the', 'Get it on' => 'Get it on', 'Scan to download' => 'Scan to download', 'Compatible with iOS and Android devices.' => 'Compatible with iOS and Android devices.',
'Global Trust' => 'Global Trust', 'Our Global Partners' => 'Our Global Partners', 'Smart Contracts' => 'Smart Contracts', 'Primary Network' => 'Primary Network', 'Security Audit' => 'Security Audit', 'Financial Partner' => 'Financial Partner', 'Strategic Advisor' => 'Strategic Advisor',
'Markets' => 'Markets', 'Trade' => 'Trade', 'Spot Trading' => 'Spot Trading', 'Contract Trading' => 'Contract Trading', 'Download App' => 'Download App', 'Register' => 'Register',
'Enter username' => 'Enter username', 'Enter password' => 'Enter password', 'Remember me' => 'Remember me', 'Forgot password?' => 'Forgot password?',
'Please fill in all fields.' => 'Please fill in all fields.', 'Invalid username or password.' => 'Invalid username or password.', 'Login failed.' => 'Login failed.',
'Login to BITCrypto' => 'Login to BITCrypto',
'Asset Overview' => 'Asset Overview', 'Total Balance' => 'Total Balance', 'Available Balance' => 'Available Balance', 'Locked Balance' => 'Locked Balance',
'Verify Now' => 'Verify Now', 'Personal Information' => 'Personal Information', 'Security Center' => 'Security Center',
'Change' => 'Change', 'Transaction History' => 'Transaction History', 'Date' => 'Date', 'Type' => 'Type', 'Amount' => 'Amount', 'Status' => 'Status',
'Why Choose BITCrypto?' => 'Why Choose BITCrypto?', 'Experience the most professional trading environment with institutional-grade security and liquidity.' => 'Experience the most professional trading environment with institutional-grade security and liquidity.',
'Safe & Secure' => 'Safe & Secure', 'Industry-leading encryption and multi-signature cold storage for your digital assets.' => 'Industry-leading encryption and multi-signature cold storage for your digital assets.',
'Multi-sig Cold Storage' => 'Multi-sig Cold Storage', 'DDoS Protection' => 'DDoS Protection', '2FA Security' => '2FA Security',
'Instant Execution' => 'Instant Execution', 'Advanced matching engine processing over 100,000 transactions per second.' => 'Advanced matching engine processing over 100,000 transactions per second.',
'Ultra-low Latency' => 'Ultra-low Latency', 'High Liquidity' => 'High Liquidity', 'Zero Slippage' => 'Zero Slippage',
'24/7 Global Support' => '24/7 Global Support', 'Get help whenever you need it with our around-the-clock professional customer service.' => 'Get help whenever you need it with our around-the-clock professional customer service.',
'Multi-language Support' => 'Multi-language Support', 'Live Chat' => 'Live Chat', 'Fast Response' => 'Fast Response',
'Get Started' => 'Get Started', 'View Markets' => 'View Markets', 'Search assets...' => 'Search assets...',
'Name' => 'Name', 'Action' => 'Action', 'View All' => 'View All', 'Stay updated with real-time price changes' => 'Stay updated with real-time price changes',
'The World\'s Leading' => 'The World\'s Leading', 'Crypto Exchange' => 'Crypto Exchange', 'Secure & Trusted' => 'Secure & Trusted', 'Institutional Grade' => 'Institutional Grade', 'Deep Liquidity' => 'Deep Liquidity', 'Global Access' => 'Global Access', 'Perpetual Contracts' => 'Perpetual Contracts', '100x Leverage' => '100x Leverage', 'Join the Elite' => 'Join the Elite', 'Trust BITCrypto' => 'Trust BITCrypto',
'Trade Bitcoin, Ethereum, and hundreds of other cryptocurrencies with the lowest fees in the industry.' => 'Trade Bitcoin, Ethereum, and hundreds of other cryptocurrencies with the lowest fees in the industry.',
'Go to Trade' => 'Go to Trade', 'Search Pairs' => 'Search Pairs', 'Change' => 'Change', 'High' => 'High', 'Low' => 'Low', 'Time' => 'Time', 'Pair' => 'Pair', 'Side' => 'Side', 'Filled' => 'Filled', 'No open orders' => 'No open orders', 'Take-Profit' => 'Take-Profit', 'Stop-Loss' => 'Stop-Loss', 'Order submitted successfully!' => 'Order submitted successfully!', 'Please enter a valid amount.' => 'Please enter a valid amount.',
],
'zh' => [
'Home' => '首页', 'Spot' => '现货', 'Perpetual' => '合约', 'Markets' => '行情', 'Exchange' => '交易',
'Login' => '登录', 'Register' => '注册', 'Profile' => '个人中心', 'Logout' => '退出',
'Deposit' => '充值', 'Withdraw' => '提现', 'Assets' => '资产', 'Security' => '安全',
'Buy' => '买入', 'Sell' => '卖出', 'Limit' => '限价', 'Market' => '市价', 'Price' => '价格',
'Amount' => '数量', 'Total' => '合计', 'Available' => '可用', 'Trade' => '交易',
'Market Trends' => '市场趋势', 'Real-time Prices' => '实时价格', 'High' => '最高', 'Low' => '最低',
'Download App' => '下载APP', 'Customer Service' => '联系客服',
'Identity Verification' => '身份认证', 'Trading Password' => '交易密码',
'Success' => '成功', 'Error' => '错误', 'Matching Account' => '匹配账户',
'Establishing secure connection with liquidity provider...' => '正在与流动性提供商建立安全连接...',
'Awaiting merchant confirmation...' => '等待商家确认...',
'Matching in progress' => '正在匹配中',
'The specialized account for this transaction will be provided by our agent shortly.' => '本次交易的专用账户将由我们的代理稍后提供。',
'Transfer the exact amount. Upload proof below.' => '请转账准确金额。在下方上传凭证。',
'Bank Name' => '银行名称', 'Account Number' => '账号', 'Beneficiary' => '收款人', 'Reference' => '备注',
'Copy' => '复制', 'Upload Proof' => '上传凭证', 'Selected' => '已选择', 'Transfer Completed' => '我已完成转账',
'Your transfer is being reviewed. ETA: 10-20 mins.' => '您的转账正在审核中。预计时间10-20分钟。',
'Back to Wallet' => '返回钱包', 'Matched & Active' => '已匹配并激活',
'Services' => '服务', 'Spot Trading' => '现货交易', 'Futures Trading' => '合约交易',
'Support' => '支持', 'Help Center' => '帮助中心', 'About Us' => '关于我们', 'Privacy Policy' => '隐私政策', 'Terms of Service' => '服务条款',
'System Status' => '系统状态', 'Normal' => '正常', 'Overview' => '总览', 'Full Name' => '姓名', 'ID Number' => '证件号', 'Submit' => '提交', 'Next-Gen Trading Engine' => '下一代交易引擎',
'Experience ultra-low latency and institutional-grade liquidity on our professional K-line trading platform.' => '在我们的专业 K 线交易平台上体验极低延迟和机构级流动性。',
'Register Now' => '立即注册', 'Start Trading' => '开始交易', 'Go to Futures' => '前往合约', 'Global Crypto Hub' => '全球加密中心',
'Access real-time global market data and execute trades across multiple asset classes with one unified account.' => '通过一个统一账户访问实时全球市场数据并执行跨多个资产类别的交易。',
'Secure Asset Custody' => '安全资产托管', 'Your funds are safe with our institutional-grade security, multi-sig cold storage, and comprehensive insurance fund.' => '您的资金通过我们的机构级安全、多重签名冷存储和综合保险基金得到保障。',
'Security Center' => '安全中心', '24/7 Global Support' => '24/7 全球支持', 'Our dedicated professional support team is available around the clock to assist you in multiple languages.' => '我们专业的支持团队全天候为您提供多种语言的帮助。',
'Contact Support' => '联系支持', 'Asset' => '资产', '24h Change' => '24h 涨跌', '24h High' => '24h 最高', 'Action' => '操作', 'All Markets' => '所有市场',
'Real-time updates from global exchanges' => '来自全球交易所的实时更新', 'Safe & Secure' => '安全可靠', 'Industry-leading encryption and multi-signature cold storage for your digital assets.' => '行业领先的加密技术和多重签名冷存储,保护您的数字资产。',
'Instant Execution' => '即时执行', 'Advanced matching engine processing over 100,000 transactions per second.' => '先进的撮合引擎,每秒处理超过 100,000 笔交易。',
'Recharge' => '充值', 'Withdrawal' => '提现', 'Funds' => '资产',
'Wallet Balance' => '钱包余额', 'Transaction History' => '交易记录',
'Take Profit' => '止盈', 'Stop Loss' => '止损', 'Contract' => '合约',
'Receipt uploaded successfully. Waiting for admin approval.' => '凭证上传成功。等待管理员审核。',
'Asset Overview' => '资产总览', 'KYC Verification' => '身份认证', 'Personal Center' => '个人中心',
'Verification Status' => '认证状态', 'Security Settings' => '安全设置', 'Language' => '语言',
'Update' => '更新', 'Change Password' => '修改密码', 'Not Verified' => '未认证', 'Pending Review' => '待审核', 'Approved' => '已通过', 'Rejected' => '已驳回',
'Withdrawal Address' => '提现地址', 'Enter amount' => '输入金额', 'Available' => '可用', 'Network' => '网络', 'Fee' => '手续费', 'Submit Withdrawal' => '提交提现',
'Recharge Crypto' => '加密货币充值', 'Select Currency' => '选择币种', 'Deposit Address' => '充值地址', 'Transfer to this address and upload screenshot.' => '转账至此地址并上传截图。',
'Confirm' => '确认', 'Cancel' => '取消', 'Please login to trade' => '请先登录以进行交易', 'Contract Trading' => '合约交易',
'Long' => '做多', 'Short' => '做空', 'Leverage' => '杠杆', 'Open Position' => '开仓', 'Close Position' => '平仓',
'Market' => '市价', 'Limit' => '限价', 'Price' => '价格', 'Amount' => '数量', 'Balance' => '余额',
'Orders' => '订单', 'Positions' => '持仓', 'History' => '历史', 'Sign In' => '登录', 'Sign Up' => '注册',
'Forgot Password?' => '忘记密码?', 'Don\'t have an account?' => '还没有账号?', 'Already have an account?' => '已有账号?',
'Username' => '用户名', 'Email' => '邮箱', 'Password' => '密码', 'Confirm Password' => '确认密码',
'Trade Anytime, Anywhere' => '随时随地进行交易', 'Experience the full power of our exchange on your mobile device. Trade spot and futures with ease.' => '在您的移动设备上体验我们交易所的全部功能。轻松进行现货和合约交易。',
'Download on the' => '下载于', 'Get it on' => '获取于', 'Scan to download' => '扫码下载', 'Compatible with iOS and Android devices.' => '兼容 iOS 和 Android 设备。',
'Global Trust' => '全球信赖', 'Our Global Partners' => '我们的全球合作伙伴', 'Smart Contracts' => '智能合约', 'Primary Network' => '主网', 'Security Audit' => '安全审计', 'Financial Partner' => '金融合作伙伴', 'Strategic Advisor' => '战略顾问',
'Markets' => '行情', 'Trade' => '交易', 'Spot Trading' => '现货交易', 'Contract Trading' => '合约交易', 'Download App' => '下载应用', 'Register' => '注册',
'Enter username' => '输入用户名', 'Enter password' => '输入密码', 'Remember me' => '记住我', 'Forgot password?' => '忘记密码?',
'Please fill in all fields.' => '请填写所有字段。', 'Invalid username or password.' => '用户名或密码错误。', 'Login failed.' => '登录失败。',
'Login to BITCrypto' => '登录到 BITCrypto',
'Asset Overview' => '资产总览', 'Total Balance' => '总余额', 'Available Balance' => '可用余额', 'Locked Balance' => '锁定余额',
'Verify Now' => '立即认证', 'Personal Information' => '个人信息', 'Security Center' => '安全中心',
'Change' => '修改', 'Transaction History' => '交易历史', 'Date' => '日期', 'Type' => '类型', 'Amount' => '金额', 'Status' => '状态',
'Why Choose BITCrypto?' => '为什么选择 BITCrypto', 'Experience the most professional trading environment with institutional-grade security and liquidity.' => '体验最专业的交易环境,拥有机构级的安全和流动性。',
'Safe & Secure' => '安全可靠', 'Industry-leading encryption and multi-signature cold storage for your digital assets.' => '行业领先的加密和多重签名冷存储,保护您的数字资产。',
'Multi-sig Cold Storage' => '多重签名冷存储', 'DDoS Protection' => 'DDoS 防护', '2FA Security' => '双重身份验证',
'Instant Execution' => '即时执行', 'Advanced matching engine processing over 100,000 transactions per second.' => '先进的撮合引擎,每秒处理超过 100,000 笔交易。',
'Ultra-low Latency' => '极低延迟', 'High Liquidity' => '高流动性', 'Zero Slippage' => '零滑点',
'24/7 Global Support' => '24/7 全球支持', 'Get help whenever you need it with our around-the-clock professional customer service.' => '随时随地获得我们全天候专业客服的帮助。',
'Multi-language Support' => '多语言支持', 'Live Chat' => '在线聊天', 'Fast Response' => '快速响应',
'Get Started' => '开始使用', 'View Markets' => '查看行情', 'Search assets...' => '搜索资产...',
'Name' => '名称', 'Action' => '操作', 'View All' => '查看全部', 'Stay updated with real-time price changes' => '实时掌握价格变动',
'The World\'s Leading' => '世界领先的', 'Crypto Exchange' => '加密货币交易所', 'Secure & Trusted' => '安全可信', 'Institutional Grade' => '机构级', 'Deep Liquidity' => '深度流动性', 'Global Access' => '全球访问', 'Perpetual Contracts' => '永续合约', '100x Leverage' => '100倍杠杆', 'Join the Elite' => '加入精英行列', 'Trust BITCrypto' => '信赖 BITCrypto',
'Trade Bitcoin, Ethereum, and hundreds of other cryptocurrencies with the lowest fees in the industry.' => '以行业最低的手续费交易比特币、以太坊和数百种其他加密货币。',
'Go to Trade' => '去交易', 'Search Pairs' => '搜索交易对', 'Change' => '涨跌', 'High' => '最高', 'Low' => '最低', 'Time' => '时间', 'Pair' => '交易对', 'Side' => '方向', 'Filled' => '已成交', 'No open orders' => '暂无挂单', 'Take-Profit' => '止盈', 'Stop-Loss' => '止损', 'Order submitted successfully!' => '订单提交成功!', 'Please enter a valid amount.' => '请输入有效金额。',
]
];
function mt($key) {
global $lang, $translations;
return $translations[$lang][$key] ?? $key;
}
$is_home = basename($_SERVER['PHP_SELF']) == 'index.php';
function getLangUrl($newLang) {
$params = $_GET;
$params['lang'] = $newLang;
return basename($_SERVER['PHP_SELF']) . '?' . http_build_query($params);
}
?>
<!DOCTYPE html>
<html lang="<?php echo $lang; ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?php echo mt('Next-Gen Trading Engine'); ?> | BITCrypto</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.1/font/bootstrap-icons.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500&display=swap" rel="stylesheet">
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
<script>
window.translations = <?php echo json_encode($translations[$lang]); ?>;
function t(key) {
return window.translations[key] || key;
}
</script>
<style>
:root {
--bg-deep: #0a0c0e;
--bg-card: #101216;
--primary: #00ff88;
--primary-hover: #00e67a;
--text-main: #f0f0f0;
--text-muted: #848e9c;
--border-color: #2b2f36;
--up-color: #00c087;
--down-color: #cf304a;
}
body {
background-color: var(--bg-deep);
color: var(--text-main);
font-family: 'Inter', sans-serif;
margin: 0;
padding-top: 72px; /* For fixed header */
padding-bottom: 70px; /* For mobile bottom nav */
overflow-x: hidden;
}
/* Color consistency rule: White background MUST have black text */
.bg-white, [style*="background-color: white"], [style*="background-color: #ffffff"], [style*="background: white"] {
color: #000000 !important;
}
.bg-white .text-muted, .bg-white .small {
color: #6c757d !important;
}
/* Black background MUST have white text */
.bg-dark, .bg-black, .bg-deep, body, .card.bg-dark {
color: #ffffff !important;
}
/* Modern Glassmorphism Header */
.navbar {
background: rgba(10, 12, 14, 0.85) !important;
backdrop-filter: blur(12px);
border-bottom: 1px solid var(--border-color);
padding: 12px 0;
z-index: 1050;
}
.navbar-brand {
font-weight: 800;
font-size: 24px;
letter-spacing: -0.5px;
color: var(--primary) !important;
display: flex;
align-items: center;
}
.logo-img {
height: 40px;
margin-right: 12px;
background: transparent !important;
border: none !important;
display: block;
box-shadow: none !important;
object-fit: contain;
}
.back-button {
display: <?php echo $is_home ? 'none' : 'flex'; ?>;
align-items: center;
gap: 8px;
color: var(--text-muted);
text-decoration: none;
font-weight: 600;
padding: 8px 16px;
border-radius: 20px;
background: rgba(255,255,255,0.05);
transition: all 0.3s;
margin-right: 15px;
}
.back-button:hover { background: rgba(255,255,255,0.1); color: white; }
.bottom-nav {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: var(--bg-card);
border-top: 1px solid var(--border-color);
display: flex;
justify-content: space-around;
padding: 10px 0;
z-index: 1000;
}
.nav-item-mobile {
display: flex;
flex-direction: column;
align-items: center;
text-decoration: none;
color: var(--text-muted);
font-size: 11px;
font-weight: 500;
}
.nav-item-mobile.active {
color: var(--primary);
}
.nav-item-mobile i {
font-size: 20px;
margin-bottom: 4px;
}
@media (min-width: 992px) {
.bottom-nav { display: none; }
}
.nav-link {
color: var(--text-muted) !important;
font-weight: 500;
padding: 8px 16px !important;
transition: all 0.2s;
}
.nav-link:hover, .nav-link.active {
color: var(--text-main) !important;
}
.btn-primary {
background-color: var(--primary);
border: none;
color: #000;
font-weight: 600;
padding: 10px 24px;
border-radius: 8px;
transition: all 0.3s;
}
.btn-primary:hover {
background-color: var(--primary-hover);
transform: translateY(-1px);
}
.dropdown-menu {
background-color: var(--bg-card);
border: 1px solid var(--border-color);
box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}
.dropdown-item {
color: var(--text-muted);
padding: 10px 20px;
transition: all 0.2s;
}
.dropdown-item:hover {
background-color: rgba(255,255,255,0.05);
color: var(--text-main);
}
/* Custom Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #444; }
</style>
</head>
<body>
<nav class="navbar navbar-expand-lg fixed-top">
<div class="container-fluid px-lg-5">
<div class="d-flex align-items-center">
<a href="index.php" class="back-button">
<i class="bi bi-chevron-left"></i>
</a>
<a class="navbar-brand" href="index.php">
<img src="assets/images/logo.png" alt="Logo" class="logo-img">
BITCrypto
</a>
</div>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav me-auto">
<li class="nav-item"><a class="nav-link" href="market.php"><?php echo mt('Markets'); ?></a></li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"><?php echo mt('Trade'); ?></a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="trade.php?type=spot"><?php echo mt('Spot Trading'); ?></a></li>
<li><a class="dropdown-item" href="trade.php?type=contract"><?php echo mt('Contract Trading'); ?></a></li>
</ul>
</li>
<?php if ($user):
?> <li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown"><?php echo mt('Funds'); ?></a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="deposit.php"><?php echo mt('Recharge'); ?></a></li>
<li><a class="dropdown-item" href="withdraw.php"><?php echo mt('Withdrawal'); ?></a></li>
<li><a class="dropdown-item" href="profile.php"><?php echo mt('Asset Overview'); ?></a></li>
</ul>
</li>
<?php endif; ?> <li class="nav-item"><a class="nav-link" href="#"><?php echo mt('Download App'); ?></a></li>
</ul>
<div class="d-flex align-items-center gap-3">
<a href="<?php echo getLangUrl($lang == 'en' ? 'zh' : 'en'); ?>" class="text-muted text-decoration-none">
<i class="bi bi-globe me-1"></i> <?php echo $lang == 'en' ? '中文' : 'EN'; ?>
</a>
<?php if ($user):
?> <div class="dropdown">
<a class="nav-link dropdown-toggle d-flex align-items-center gap-2" href="#" role="button" data-bs-toggle="dropdown">
<i class="bi bi-person-circle fs-5"></i>
<span><?php echo htmlspecialchars($user['username']); ?></span>
</a>
<ul class="dropdown-menu dropdown-menu-end">
<li><a class="dropdown-item" href="profile.php"><i class="bi bi-person me-2"></i> <?php echo mt('Profile'); ?></a></li>
<li><a class="dropdown-item" href="deposit.php"><i class="bi bi-wallet2 me-2"></i> <?php echo mt('Deposit'); ?></a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item text-danger" href="logout.php"><i class="bi bi-box-arrow-right me-2"></i> <?php echo mt('Logout'); ?></a></li>
</ul>
</div>
<?php else:
?> <a href="login.php" class="nav-link"><?php echo mt('Login'); ?></a>
<a href="register.php" class="btn btn-primary"><?php echo mt('Register Now'); ?></a>
<?php endif; ?> </div>
</div>
</div>
</nav>
<!-- Mobile Bottom Navigation -->
<div class="bottom-nav">
<a href="index.php" class="nav-item-mobile <?php echo basename($_SERVER['PHP_SELF']) == 'index.php' ? 'active' : ''; ?>">
<i class="bi bi-house-door"></i>
<span><?php echo mt('Home'); ?></span>
</a>
<a href="market.php" class="nav-item-mobile <?php echo basename($_SERVER['PHP_SELF']) == 'market.php' ? 'active' : ''; ?>">
<i class="bi bi-bar-chart"></i>
<span><?php echo mt('Markets'); ?></span>
</a>
<a href="trade.php" class="nav-item-mobile <?php echo (strpos($_SERVER['PHP_SELF'], 'trade.php') !== false ? 'active' : ''); ?>">
<i class="bi bi-arrow-left-right"></i>
<span><?php echo mt('Trade'); ?></span>
</a>
<a href="profile.php" class="nav-item-mobile <?php echo (strpos($_SERVER['PHP_SELF'], 'profile.php') !== false ? 'active' : ''); ?>">
<i class="bi bi-wallet2"></i>
<span><?php echo mt('Assets'); ?></span>
</a>
<a href="profile.php" class="nav-item-mobile">
<i class="bi bi-person"></i>
<span><?php echo mt('Profile'); ?></span>
</a>
</div>

25
includes/market.php Normal file
View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
function getCurrentPrice(string $symbol): float {
$db = db();
// Check for active manipulation (spike or target)
$stmt = $db->prepare("SELECT target_price FROM price_controls WHERE symbol = ? AND is_active = 1 ORDER BY created_at DESC LIMIT 1");
$stmt->execute([$symbol]);
$manipulated = $stmt->fetchColumn();
if ($manipulated !== false) {
return (float)$manipulated;
}
// Otherwise return standard current price
$stmt = $db->prepare("SELECT current_price FROM cryptocurrencies WHERE symbol = ?");
$stmt->execute([$symbol]);
return (float)$stmt->fetchColumn() ?: 0.0;
}
function processOrders(): void {
// This could be a background job
// It would check pending orders against current prices and fill them
}

380
index.php
View File

@ -1,150 +1,236 @@
<?php <?php
declare(strict_types=1); include 'includes/header.php';
@ini_set('display_errors', '1'); ?>
@error_reporting(E_ALL);
@date_default_timezone_set('UTC');
$phpVersion = PHP_VERSION; <!-- Aligned Hero Carousel -->
$now = date('Y-m-d H:i:s'); <section class="py-4 bg-primary-bg">
?> <div class="container">
<!doctype html> <div id="mainHeroCarousel" class="carousel slide carousel-fade rounded-5 overflow-hidden shadow-lg" data-bs-ride="carousel" data-bs-interval="5000">
<html lang="en"> <div class="carousel-indicators">
<head> <button type="button" data-bs-target="#mainHeroCarousel" data-bs-slide-to="0" class="active"></button>
<meta charset="utf-8" /> <button type="button" data-bs-target="#mainHeroCarousel" data-bs-slide-to="1"></button>
<meta name="viewport" content="width=device-width, initial-scale=1" /> <button type="button" data-bs-target="#mainHeroCarousel" data-bs-slide-to="2"></button>
<title>New Style</title> <button type="button" data-bs-target="#mainHeroCarousel" data-bs-slide-to="3"></button>
<?php <button type="button" data-bs-target="#mainHeroCarousel" data-bs-slide-to="4"></button>
// Read project preview data from environment </div>
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? ''; <div class="carousel-inner">
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? ''; <?php
?> $hero_slides = [
<?php if ($projectDescription): ?> ['title' => 'The World\'s Leading', 'subtitle' => 'Crypto Exchange', 'img' => 'hero_1.jpg'],
<!-- Meta description --> ['title' => 'Secure & Trusted', 'subtitle' => 'Institutional Grade', 'img' => 'hero_2.jpg'],
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' /> ['title' => 'Deep Liquidity', 'subtitle' => 'Global Access', 'img' => 'hero_3.jpg'],
<!-- Open Graph meta tags --> ['title' => 'Perpetual Contracts', 'subtitle' => '100x Leverage', 'img' => 'hero_4.jpg'],
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" /> ['title' => 'Join the Elite', 'subtitle' => 'Trust BITCrypto', 'img' => 'hero_5.jpg']
<!-- Twitter meta tags --> ];
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" /> foreach ($hero_slides as $index => $slide):
<?php endif; ?> ?>
<?php if ($projectImageUrl): ?> <div class="carousel-item <?php echo $index === 0 ? 'active' : ''; ?>">
<!-- Open Graph image --> <div class="carousel-image-container" style="height: 450px; background-image: linear-gradient(rgba(11, 14, 17, 0.6), rgba(11, 14, 17, 0.4)), url('assets/images/hero/<?php echo $slide['img']; ?>'); background-size: cover; background-position: center;">
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> <div class="container h-100">
<!-- Twitter image --> <div class="row h-100 align-items-center">
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" /> <div class="col-lg-8 text-white ps-5 slide-content">
<?php endif; ?> <h1 class="display-4 fw-bold mb-3"><?php echo mt($slide['title']); ?><br><span class="text-primary"><?php echo mt($slide['subtitle']); ?></span></h1>
<link rel="preconnect" href="https://fonts.googleapis.com"> <p class="lead mb-4 text-light opacity-75 d-none d-md-block" style="max-width: 600px;"><?php echo mt('Trade Bitcoin, Ethereum, and hundreds of other cryptocurrencies with the lowest fees in the industry.'); ?></p>
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin> <div class="d-flex gap-3">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet"> <a href="register.php" class="btn btn-primary btn-lg px-4 py-2 rounded-pill fw-bold shadow-lg"><?php echo mt('Get Started'); ?></a>
<style> <a href="market.php" class="btn btn-outline-light btn-lg px-4 py-2 rounded-pill fw-bold"><?php echo mt('View Markets'); ?></a>
:root { </div>
--bg-color-start: #6a11cb; </div>
--bg-color-end: #2575fc; </div>
--text-color: #ffffff; </div>
--card-bg-color: rgba(255, 255, 255, 0.01); </div>
--card-border-color: rgba(255, 255, 255, 0.1); </div>
} <?php endforeach; ?>
body { </div>
margin: 0; <button class="carousel-control-prev" type="button" data-bs-target="#mainHeroCarousel" data-bs-slide="prev">
font-family: 'Inter', sans-serif; <span class="carousel-control-prev-icon"></span>
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end)); </button>
color: var(--text-color); <button class="carousel-control-next" type="button" data-bs-target="#mainHeroCarousel" data-bs-slide="next">
display: flex; <span class="carousel-control-next-icon"></span>
justify-content: center; </button>
align-items: center; </div>
min-height: 100vh;
text-align: center;
overflow: hidden;
position: relative;
}
body::before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
animation: bg-pan 20s linear infinite;
z-index: -1;
}
@keyframes bg-pan {
0% { background-position: 0% 0%; }
100% { background-position: 100% 100%; }
}
main {
padding: 2rem;
}
.card {
background: var(--card-bg-color);
border: 1px solid var(--card-border-color);
border-radius: 16px;
padding: 2rem;
backdrop-filter: blur(20px);
-webkit-backdrop-filter: blur(20px);
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
}
.loader {
margin: 1.25rem auto 1.25rem;
width: 48px;
height: 48px;
border: 3px solid rgba(255, 255, 255, 0.25);
border-top-color: #fff;
border-radius: 50%;
animation: spin 1s linear infinite;
}
@keyframes spin {
from { transform: rotate(0deg); }
to { transform: rotate(360deg); }
}
.hint {
opacity: 0.9;
}
.sr-only {
position: absolute;
width: 1px; height: 1px;
padding: 0; margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap; border: 0;
}
h1 {
font-size: 3rem;
font-weight: 700;
margin: 0 0 1rem;
letter-spacing: -1px;
}
p {
margin: 0.5rem 0;
font-size: 1.1rem;
}
code {
background: rgba(0,0,0,0.2);
padding: 2px 6px;
border-radius: 4px;
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
footer {
position: absolute;
bottom: 1rem;
font-size: 0.8rem;
opacity: 0.7;
}
</style>
</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> </div>
</main> </section>
<footer>
Page updated: <?= htmlspecialchars($now) ?> (UTC) <!-- Quick Market Ticker -->
</footer> <div class="market-ticker-bar bg-secondary-bg border-bottom border-white border-opacity-5 py-3">
</body> <div class="container">
</html> <div class="d-flex flex-wrap justify-content-center justify-content-lg-between gap-4" id="hero-market-ticker">
<!-- Loaded via JS -->
<div class="ticker-item skeleton" style="width: 150px; height: 40px;"></div>
<div class="ticker-item skeleton d-none d-md-block" style="width: 150px; height: 40px;"></div>
<div class="ticker-item skeleton d-none d-lg-block" style="width: 150px; height: 40px;"></div>
<div class="ticker-item skeleton d-none d-xl-block" style="width: 150px; height: 40px;"></div>
</div>
</div>
</div>
<!-- Market Trends -->
<section class="py-5 bg-darker" id="market-section">
<div class="container py-2">
<div class="d-flex justify-content-between align-items-end mb-4">
<div>
<h2 class="fw-bold text-white mb-2"><?php echo mt('Market Trends'); ?></h2>
<p class="text-muted mb-0 small"><?php echo mt('Stay updated with real-time price changes'); ?></p>
</div>
<a href="market.php" class="text-primary text-decoration-none fw-bold small"><?php echo mt('View All'); ?> <i class="fas fa-chevron-right ms-1"></i></a>
</div>
<div class="table-responsive rounded-4 border border-white border-opacity-10 bg-black bg-opacity-20 shadow-lg">
<table class="table table-dark table-hover mb-0 align-middle border-0">
<thead>
<tr class="text-muted small">
<th class="ps-4 py-3 border-0"><?php echo mt('Name'); ?></th>
<th class="py-3 border-0"><?php echo mt('Price'); ?></th>
<th class="py-3 border-0"><?php echo mt('24h Change'); ?></th>
<th class="py-3 border-0 text-end pe-4"><?php echo mt('Action'); ?></th>
</tr>
</thead>
<tbody id="market-trends">
<!-- Loaded via JS -->
<tr>
<td colspan="4" class="text-center py-5">
<div class="spinner-border spinner-border-sm text-primary" role="status"></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</section>
<!-- Why Choose Us - Aligned with Market Trends -->
<section class="py-5 bg-primary-bg">
<div class="container py-4">
<div class="text-center mb-5">
<h2 class="display-6 fw-bold text-white mb-3"><?php echo mt('Why Choose BITCrypto?'); ?></h2>
<p class="text-muted mx-auto" style="max-width: 700px;"><?php echo mt('Experience the most professional trading environment with institutional-grade security and liquidity.'); ?></p>
</div>
<div class="row g-4">
<div class="col-md-4">
<div class="feature-card p-4 h-100 border-0 shadow-sm rounded-4 bg-navy-gradient overflow-hidden position-relative">
<div class="feature-icon mb-4 rounded-4 d-inline-flex align-items-center justify-content-center bg-primary bg-opacity-10 text-primary" style="width: 50px; height: 50px;">
<i class="fas fa-shield-halved fa-lg"></i>
</div>
<h5 class="text-white fw-bold mb-3"><?php echo mt('Safe & Secure'); ?></h5>
<p class="text-muted small mb-4"><?php echo mt('Industry-leading encryption and multi-signature cold storage for your digital assets.'); ?></p>
<ul class="list-unstyled text-muted x-small mt-auto">
<li class="mb-2"><i class="fas fa-check-circle text-primary me-2"></i> <?php echo mt('Multi-sig Cold Storage'); ?></li>
<li class="mb-2"><i class="fas fa-check-circle text-primary me-2"></i> <?php echo mt('DDoS Protection'); ?></li>
<li><i class="fas fa-check-circle text-primary me-2"></i> <?php echo mt('2FA Security'); ?></li>
</ul>
</div>
</div>
<div class="col-md-4">
<div class="feature-card p-4 h-100 border-0 shadow-sm rounded-4 bg-navy-gradient overflow-hidden position-relative">
<div class="feature-icon mb-4 rounded-4 d-inline-flex align-items-center justify-content-center bg-success bg-opacity-10 text-success" style="width: 50px; height: 50px;">
<i class="fas fa-bolt-lightning fa-lg"></i>
</div>
<h5 class="text-white fw-bold mb-3"><?php echo mt('Instant Execution'); ?></h5>
<p class="text-muted small mb-4"><?php echo mt('Advanced matching engine processing over 100,000 transactions per second.'); ?></p>
<ul class="list-unstyled text-muted x-small mt-auto">
<li class="mb-2"><i class="fas fa-check-circle text-success me-2"></i> <?php echo mt('Ultra-low Latency'); ?></li>
<li class="mb-2"><i class="fas fa-check-circle text-success me-2"></i> <?php echo mt('High Liquidity'); ?></li>
<li><i class="fas fa-check-circle text-success me-2"></i> <?php echo mt('Zero Slippage'); ?></li>
</ul>
</div>
</div>
<div class="col-md-4">
<div class="feature-card p-4 h-100 border-0 shadow-sm rounded-4 bg-navy-gradient overflow-hidden position-relative">
<div class="feature-icon mb-4 rounded-4 d-inline-flex align-items-center justify-content-center bg-info bg-opacity-10 text-info" style="width: 50px; height: 50px;">
<i class="fas fa-headset fa-lg"></i>
</div>
<h5 class="text-white fw-bold mb-3"><?php echo mt('24/7 Global Support'); ?></h5>
<p class="text-muted small mb-4"><?php echo mt('Get help whenever you need it with our around-the-clock professional customer service.'); ?></p>
<ul class="list-unstyled text-muted x-small mt-auto">
<li class="mb-2"><i class="fas fa-check-circle text-info me-2"></i> <?php echo mt('Multi-language Support'); ?></li>
<li class="mb-2"><i class="fas fa-check-circle text-info me-2"></i> <?php echo mt('Live Chat'); ?></li>
<li><i class="fas fa-check-circle text-info me-2"></i> <?php echo mt('Fast Response'); ?></li>
</ul>
</div>
</div>
</div>
</div>
</section>
<!-- Mobile App Section -->
<section class="py-5 bg-darker border-top border-white border-opacity-5">
<div class="container py-5">
<div class="row align-items-center">
<div class="col-lg-6 mb-5 mb-lg-0">
<h2 class="display-5 fw-bold text-white mb-4"><?php echo mt('Trade Anywhere, Anytime'); ?></h2>
<p class="text-muted lead mb-5"><?php echo mt('Experience the full power of our exchange on your mobile device. Trade spot and futures with ease.'); ?></p>
<div class="d-flex flex-wrap gap-3 mb-5">
<a href="#" class="btn btn-dark btn-lg px-4 py-3 rounded-4 border border-white border-opacity-10 d-flex align-items-center">
<i class="fab fa-apple fa-2x me-3"></i>
<div class="text-start">
<div class="x-small text-muted opacity-75"><?php echo mt('Download on the'); ?></div>
<div class="fw-bold"><?php echo mt('App Store'); ?></div>
</div>
</a>
<a href="#" class="btn btn-dark btn-lg px-4 py-3 rounded-4 border border-white border-opacity-10 d-flex align-items-center">
<i class="fab fa-google-play fa-2x me-3"></i>
<div class="text-start">
<div class="x-small text-muted opacity-75"><?php echo mt('Get it on'); ?></div>
<div class="fw-bold"><?php echo mt('Google Play'); ?></div>
</div>
</a>
</div>
<div class="d-flex align-items-center gap-4">
<div class="bg-white p-2 rounded-3">
<img src="https://api.qrserver.com/v1/create-qr-code/?size=100x100&data=https://bitcrypto.com/download" width="80" height="80">
</div>
<div class="text-muted small">
<div class="fw-bold text-white mb-1"><?php echo mt('Scan to download'); ?></div>
<?php echo mt('Compatible with iOS and Android devices.'); ?>
</div>
</div>
</div>
<div class="col-lg-6 text-center">
<div class="position-relative d-inline-block">
<img src="assets/images/mobile-app-mockup.jpg" alt="Mobile App" class="img-fluid rounded-5 shadow-2xl border border-white border-opacity-10" style="max-height: 600px;">
<!-- Decorative Elements -->
<div class="position-absolute top-0 start-0 translate-middle p-3 bg-primary rounded-circle shadow-lg animate-bounce d-none d-md-block">
<i class="fas fa-bitcoin-sign text-white fa-2x"></i>
</div>
</div>
</div>
</div>
</div>
</section>
<!-- Partners Section -->
<section class="py-5 bg-primary-bg">
<div class="container py-4">
<div class="text-center mb-5">
<h5 class="text-primary fw-bold text-uppercase mb-3" style="letter-spacing: 2px;"><?php echo mt('Global Trust'); ?></h5>
<h2 class="fw-bold text-white"><?php echo mt('Our Global Partners'); ?></h2>
</div>
<div class="row g-4 row-cols-2 row-cols-md-3 row-cols-lg-5 align-items-center opacity-75">
<div class="col text-center">
<i class="fab fa-ethereum fa-3x text-white mb-3"></i>
<div class="small text-muted"><?php echo mt('Smart Contracts'); ?></div>
</div>
<div class="col text-center">
<i class="fab fa-bitcoin fa-3x text-white mb-3"></i>
<div class="small text-muted"><?php echo mt('Primary Network'); ?></div>
</div>
<div class="col text-center">
<i class="fas fa-shield-halved fa-3x text-white mb-3"></i>
<div class="small text-muted"><?php echo mt('Security Audit'); ?></div>
</div>
<div class="col text-center">
<i class="fas fa-building-columns fa-3x text-white mb-3"></i>
<div class="small text-muted"><?php echo mt('Financial Partner'); ?></div>
</div>
<div class="col text-center">
<i class="fas fa-globe-asia fa-3x text-white mb-3"></i>
<div class="small text-muted"><?php echo mt('Strategic Advisor'); ?></div>
</div>
</div>
</div>
</section>
<?php include 'includes/footer.php'; ?>

75
login.php Normal file
View File

@ -0,0 +1,75 @@
<?php
require_once 'includes/header.php';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
if (empty($username) || empty($password)) {
$error = mt('Please fill in all fields.');
} else {
try {
$stmt = db()->prepare("SELECT * FROM users WHERE username = ?");
$stmt->execute([$username]);
$user = $stmt->fetch();
if ($user && password_verify($password, $user['password_hash'])) {
$_SESSION['user_id'] = $user['id'];
header('Location: index.php');
exit;
} else {
$error = mt('Invalid username or password.');
}
} catch (Exception $e) {
$error = mt('Login failed.');
}
}
}
?>
<div class="container my-5 py-5">
<div class="row justify-content-center">
<div class="col-md-5">
<div class="card bg-dark border-secondary p-4 shadow-lg" style="border-radius: 20px;">
<h2 class="text-center mb-4 fw-bold text-white"><?php echo mt('Login to BITCrypto'); ?></h2>
<?php if ($error): ?>
<div class="alert alert-danger border-0 small"><?php echo $error; ?></div>
<?php endif; ?>
<form method="POST">
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Username'); ?></label>
<input type="text" name="username" class="form-control bg-dark text-white border-secondary py-2" required placeholder="<?php echo mt('Enter username'); ?>">
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Password'); ?></label>
<input type="password" name="password" class="form-control bg-dark text-white border-secondary py-2" required placeholder="<?php echo mt('Enter password'); ?>">
</div>
<div class="mb-4 d-flex justify-content-between align-items-center">
<div class="form-check">
<input type="checkbox" class="form-check-input" id="remember">
<label class="form-check-label small text-muted" for="remember"><?php echo mt('Remember me'); ?></label>
</div>
<a href="#" class="small text-primary text-decoration-none fw-bold"><?php echo mt('Forgot password?'); ?></a>
</div>
<button type="submit" class="btn btn-primary w-100 py-3 fw-bold mb-3" style="background-color: var(--okx-blue); border: none; border-radius: 12px;"><?php echo mt('Login'); ?></button>
<div class="text-center">
<span class="text-muted small"><?php echo mt("Don't have an account?"); ?></span>
<a href="register.php" class="text-primary text-decoration-none fw-bold small ms-1"><?php echo mt('Register'); ?></a>
</div>
</form>
</div>
</div>
</div>
</div>
<style>
.form-control:focus {
background-color: #2b2f36;
border-color: var(--okx-blue);
box-shadow: none;
color: #fff;
}
</style>
<?php require_once 'includes/footer.php'; ?>

5
logout.php Normal file
View File

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

94
market.php Normal file
View File

@ -0,0 +1,94 @@
<?php
require_once 'includes/header.php';
?>
<div class="container my-5">
<div class="d-flex justify-content-between align-items-end mb-5 flex-wrap gap-4">
<div>
<h1 class="display-4 fw-bold mb-2 text-white"><?php echo mt('Markets'); ?></h1>
<p class="text-muted fs-5 mb-0"><?php echo mt('Real-time updates from global exchanges'); ?></p>
</div>
<div class="input-group w-auto" style="min-width: 300px;">
<span class="input-group-text bg-dark border-secondary text-muted"><i class="fas fa-search"></i></span>
<input type="text" id="market-search" class="form-control bg-dark text-white border-secondary shadow-none" placeholder="<?php echo mt('Search assets...'); ?>">
</div>
</div>
<div class="card bg-dark border-secondary p-0 shadow-lg" style="border-radius: 20px; overflow: hidden;">
<div class="table-responsive">
<table class="table table-dark table-hover mb-0 align-middle">
<thead>
<tr class="text-muted" style="border-bottom: 2px solid #2b2f36;">
<th class="ps-4 py-3"><?php echo mt('Asset'); ?></th>
<th class="py-3"><?php echo mt('Price'); ?></th>
<th class="py-3"><?php echo mt('24h Change'); ?></th>
<th class="py-3">24h <?php echo mt('High'); ?>/<?php echo mt('Low'); ?></th>
<th class="py-3"><?php echo mt('Action'); ?></th>
</tr>
</thead>
<tbody id="market-table-body">
<!-- Loaded via JS -->
<tr>
<td colspan="5" class="text-center py-5">
<div class="spinner-border text-primary"></div>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<script>
async function loadMarkets() {
try {
const response = await fetch('api/market_api.php');
const result = await response.json();
if (result.success) {
const data = result.data;
const tbody = document.getElementById('market-table-body');
const search = document.getElementById('market-search').value.toUpperCase();
let html = '';
for (const [symbol, coin] of Object.entries(data)) {
if (search && !symbol.includes(search) && !coin.name.toUpperCase().includes(search)) continue;
const changeClass = coin.change >= 0 ? 'text-success' : 'text-danger';
const changeSign = coin.change >= 0 ? '+' : '';
html += `
<tr class="border-secondary" style="cursor: pointer;" onclick="window.location.href='trade.php?symbol=${symbol}'">
<td class="ps-4 py-4">
<div class="d-flex align-items-center">
<img src="${coin.icon}" width="32" class="me-3" onerror="this.src='https://static.okx.com/cdn/oksupport/asset/currency/icon/generic.png'">
<div>
<div class="fw-bold fs-6 text-white">${symbol}</div>
<div class="small text-muted">${coin.name}</div>
</div>
</div>
</td>
<td class="fw-bold text-white">$${coin.price.toLocaleString(undefined, {minimumFractionDigits: 2, maximumFractionDigits: 4})}</td>
<td class="${changeClass} fw-bold">${changeSign}${coin.change.toFixed(2)}%</td>
<td class="text-muted small">
<div>H: $${(coin.price * 1.05).toFixed(2)}</div>
<div>L: $${(coin.price * 0.95).toFixed(2)}</div>
</td>
<td class="pe-4">
<a href="trade.php?symbol=${symbol}" class="btn btn-primary btn-sm px-4 fw-bold border-0" style="background-color: var(--okx-blue); border-radius: 8px;">${t('Trade')}</a>
</td>
</tr>
`;
}
tbody.innerHTML = html || '<tr><td colspan="5" class="text-center py-5 text-muted">' + t('No assets found') + '</td></tr>';
}
} catch (e) {
console.error(e);
}
}
document.getElementById('market-search').addEventListener('input', loadMarkets);
loadMarkets();
setInterval(loadMarkets, 3000);
</script>
<?php require_once 'includes/footer.php'; ?>

232
matching.php Normal file
View File

@ -0,0 +1,232 @@
<?php
require_once 'includes/header.php';
if (!$user) {
header('Location: login.php');
exit;
}
$currency = $_POST['fiat_currency'] ?? 'USD';
$amount = $_POST['amount'] ?? 0;
$order_id = strtoupper(substr(md5(time() . ($user['id'] ?? 0)), 0, 10));
// Rates mapping
$rates = [
'USD' => 1.0, 'EUR' => 0.92, 'CNY' => 7.21, 'JPY' => 149.5, 'KRW' => 1335.0,
'GBP' => 0.79, 'RUB' => 92.4, 'HKD' => 7.82, 'SGD' => 1.34, 'AUD' => 1.53,
'CAD' => 1.35, 'BRL' => 4.98, 'INR' => 83.0, 'VND' => 24500.0, 'THB' => 35.8,
'MYR' => 4.77, 'IDR' => 15600.0, 'PHP' => 56.1, 'AED' => 3.67, 'TRY' => 31.0
];
$rate = $rates[$currency] ?? 1.0;
$usdt_amount = $amount / $rate;
?>
<div class="container my-5 py-5">
<div class="row justify-content-center">
<div class="col-md-9 col-lg-7">
<div class="card bg-dark border-secondary shadow-lg overflow-hidden" style="border-radius: 24px;">
<!-- Header / Order Status -->
<div class="p-4 border-bottom border-secondary d-flex justify-content-between align-items-center bg-secondary bg-opacity-10">
<div>
<h5 class="fw-bold text-white mb-0"><?php echo mt('Deposit'); ?>: <?php echo number_format((float)$amount, 2); ?> <?php echo $currency; ?></h5>
<div class="small text-muted mt-1"><?php echo mt('Order ID'); ?>: #<?php echo $order_id; ?></div>
</div>
<div class="text-end">
<div class="text-primary fw-bold fs-4" id="timer">15:00</div>
</div>
</div>
<div class="row g-0" style="min-height: 550px;">
<!-- Left: Chat/Matching Status -->
<div class="col-md-5 border-end border-secondary p-4 d-flex flex-column bg-black bg-opacity-25">
<h6 class="text-white fw-bold mb-4 d-flex align-items-center">
<span class="spinner-grow spinner-grow-sm text-success me-2"></span>
<?php echo mt('Customer Service'); ?>
</h6>
<div id="chat-messages" class="flex-grow-1 overflow-auto small mb-3 px-1" style="max-height: 350px;">
<div class="mb-3">
<span class="badge bg-secondary mb-1">System</span>
<div class="p-2 bg-dark rounded border border-secondary text-muted" style="font-size: 0.75rem;">
<?php echo mt('Establishing secure connection with liquidity provider...'); ?>
</div>
</div>
</div>
<div id="matching-status" class="text-center py-3 border-top border-secondary mt-auto">
<div class="spinner-border spinner-border-sm text-primary mb-2"></div>
<div class="small text-muted" style="font-size: 0.7rem;"><?php echo mt('Awaiting merchant confirmation...'); ?></div>
</div>
</div>
<!-- Right: Payment Details -->
<div class="col-md-7 p-4 position-relative">
<div id="lock-overlay" class="position-absolute top-0 start-0 w-100 h-100 d-flex flex-column align-items-center justify-content-center bg-dark" style="z-index: 5; transition: opacity 0.5s;">
<div class="text-center">
<i class="fas fa-user-clock fa-3x text-secondary mb-3"></i>
<h6 class="text-white mb-2"><?php echo mt('Matching in progress'); ?></h6>
<p class="text-muted small px-4"><?php echo mt('The specialized account for this transaction will be provided by our agent shortly.'); ?></p>
</div>
</div>
<div id="payment-details" class="d-none">
<div class="alert alert-primary bg-primary bg-opacity-10 border-primary text-white p-3 rounded-4 mb-4 small">
<i class="fas fa-info-circle me-2"></i> <?php echo mt('Transfer the exact amount. Upload proof below.'); ?>
</div>
<div class="p-3 bg-secondary bg-opacity-10 rounded-4 mb-4 border border-secondary small">
<div class="mb-3">
<label class="text-muted mb-1 d-block"><?php echo mt('Bank Name'); ?></label>
<div class="d-flex justify-content-between">
<span class="fw-bold text-white" id="bank-name">--</span>
<span class="text-primary pointer" onclick="copyText('bank-name')"><?php echo mt('Copy'); ?></span>
</div>
</div>
<div class="mb-3">
<label class="text-muted mb-1 d-block"><?php echo mt('Account Number'); ?></label>
<div class="d-flex justify-content-between">
<span class="fw-bold text-white" id="account-num">--</span>
<span class="text-primary pointer" onclick="copyText('account-num')"><?php echo mt('Copy'); ?></span>
</div>
</div>
<div class="mb-3">
<label class="text-muted mb-1 d-block"><?php echo mt('Beneficiary'); ?></label>
<div class="d-flex justify-content-between">
<span class="fw-bold text-white" id="beneficiary-name">--</span>
<span class="text-primary pointer" onclick="copyText('beneficiary-name')"><?php echo mt('Copy'); ?></span>
</div>
</div>
<div class="mb-0">
<label class="text-muted mb-1 d-block"><?php echo mt('Reference'); ?></label>
<div class="d-flex justify-content-between">
<span class="fw-bold text-warning" id="ref-code"><?php echo $order_id; ?></span>
<span class="text-primary pointer" onclick="copyText('ref-code')"><?php echo mt('Copy'); ?></span>
</div>
</div>
</div>
<form id="proof-form">
<div class="mb-3">
<div class="upload-area border border-dashed border-secondary rounded-4 p-4 text-center position-relative" id="drop-area">
<input type="file" class="position-absolute w-100 h-100 top-0 start-0 opacity-0" style="cursor: pointer;" id="file-input">
<i class="fas fa-camera text-muted mb-2"></i>
<div class="small text-muted"><?php echo mt('Upload Proof'); ?></div>
<div id="preview" class="mt-2 d-none">
<span class="badge bg-success"><?php echo mt('Selected'); ?></span>
</div>
</div>
</div>
<button type="button" class="btn btn-primary w-100 py-3 rounded-3 fw-bold shadow-glow" onclick="completeOrder()">
<?php echo mt('Transfer Completed'); ?>
</button>
</form>
</div>
<!-- Success Screen -->
<div id="success-step" class="d-none text-center py-5">
<i class="fas fa-check-circle text-success mb-3" style="font-size: 4rem;"></i>
<h4 class="text-white fw-bold mb-3"><?php echo mt('Success'); ?></h4>
<p class="text-muted small"><?php echo mt('Your transfer is being reviewed. ETA: 10-20 mins.'); ?></p>
<a href="profile.php" class="btn btn-outline-light px-4 mt-3"><?php echo mt('Back to Wallet'); ?></a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
let seconds = 900;
const timerEl = document.getElementById('timer');
const chatBox = document.getElementById('chat-messages');
function addChatMessage(sender, msg, type = 'agent') {
const div = document.createElement('div');
div.className = 'mb-3';
div.innerHTML = `
<div class="d-flex justify-content-between align-items-center mb-1">
<span class="badge ${type === 'agent' ? 'bg-primary' : 'bg-secondary'}" style="font-size: 0.65rem;">${sender}</span>
<span class="text-muted" style="font-size: 0.6rem;">${new Date().toLocaleTimeString([], {hour: '2-digit', minute:'2-digit'})}</span>
</div>
<div class="p-2 bg-dark rounded border border-secondary text-white-50" style="font-size: 0.8rem; line-height: 1.4;">
${msg}
</div>
`;
chatBox.appendChild(div);
chatBox.scrollTop = chatBox.scrollHeight;
}
function updateTimer() {
const mins = Math.floor(seconds / 60);
const secs = seconds % 60;
timerEl.innerText = `${mins}:${secs < 10 ? '0' : ''}${secs}`;
if (seconds > 0) {
seconds--;
setTimeout(updateTimer, 1000);
}
}
function copyText(id) {
const text = document.getElementById(id).innerText;
navigator.clipboard.writeText(text);
alert('<?php echo mt('Copy'); ?> OK');
}
// Simulated Professional Flow
setTimeout(() => addChatMessage('System', '<?php echo mt('A local merchant has been found. Matching account details...'); ?>'), 3000);
setTimeout(() => {
addChatMessage('Live Agent', '<?php echo mt('Welcome! I am your dedicated matching assistant. I am currently verifying the liquidity provider for your deposit.'); ?>');
}, 8000);
setTimeout(() => {
addChatMessage('Live Agent', '<?php echo mt('Matching successful. I have secured a high-priority account for your transaction. Please find the details on the right.'); ?>');
// Unlock UI
document.getElementById('lock-overlay').style.opacity = '0';
setTimeout(() => {
document.getElementById('lock-overlay').classList.add('d-none');
document.getElementById('payment-details').classList.remove('d-none');
}, 500);
document.getElementById('matching-status').innerHTML = '<div class="badge bg-success bg-opacity-25 text-success border border-success px-3"><?php echo mt('Matched & Active'); ?></div>';
// Fill bank info
const banks = {
'USD': { name: 'JPMorgan Chase Bank', account: '9120 4481 0029 3341', beneficiary: 'Global Assets Ltd.' },
'CNY': { name: '中国工商银行', account: '6222 0812 0900 3381 922', beneficiary: '数字科技有限公司' },
'EUR': { name: 'Deutsche Bank', account: 'DE89 1007 0000 0123 4567 89', beneficiary: 'EU Crypto Services' },
'JPY': { name: 'Mizuho Bank', account: '109-2239481-001', beneficiary: 'テック・トレード株式会社' },
'GBP': { name: 'Barclays Bank', account: '20-10-05 99384812', beneficiary: 'UK Digital Trade' }
};
const bank = banks['<?php echo $currency; ?>'] || banks['USD'];
document.getElementById('bank-name').innerText = bank.name;
document.getElementById('account-num').innerText = bank.account;
document.getElementById('beneficiary-name').innerText = bank.beneficiary;
}, 15000);
document.getElementById('file-input').addEventListener('change', function() {
if (this.files.length > 0) document.getElementById('preview').classList.remove('d-none');
});
function completeOrder() {
if (document.getElementById('file-input').files.length === 0) {
alert('<?php echo mt('Please upload your payment receipt/screenshot first.'); ?>');
return;
}
document.getElementById('payment-details').classList.add('d-none');
document.getElementById('success-step').classList.remove('d-none');
addChatMessage('Live Agent', '<?php echo mt('Thank you for the update. We have received your payment proof and are now verifying the transaction on the blockchain. Your balance will be updated shortly.'); ?>');
}
updateTimer();
</script>
<style>
.upload-area { border-style: dashed !important; cursor: pointer; transition: 0.3s; }
.upload-area:hover { border-color: #f0b90b !important; background: rgba(240,185,11,0.05); }
.pointer { cursor: pointer; }
.shadow-glow { box-shadow: 0 0 15px rgba(240,185,11,0.2); }
</style>
<?php require_once 'includes/footer.php'; ?>

74
page.php Normal file
View File

@ -0,0 +1,74 @@
<?php
require_once 'includes/header.php';
$slug = $_GET['slug'] ?? 'about';
$pages = [
'about' => [
'title' => 'About BITCrypto',
'image' => 'https://images.pexels.com/photos/8370752/pexels-photo-8370752.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',
'content' => 'BITCrypto is a world-leading cryptocurrency exchange, providing advanced financial services to traders globally by using blockchain technology. We provide hundreds of token & futures trading pairs to help traders to optimize their strategy. BITCrypto is one of the top digital asset exchanges by trading volume, serving millions of users in over 100 countries.'
],
'help-center' => [
'title' => 'Help Center',
'image' => 'https://images.pexels.com/photos/6771107/pexels-photo-6771107.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',
'content' => 'Our help center provides comprehensive guides and support for all your trading needs. From account setup to advanced trading strategies, we are here to help you navigate the world of crypto. Contact our 24/7 customer support for personalized assistance.'
],
'security-info' => [
'title' => 'Security First',
'image' => 'https://images.pexels.com/photos/5980866/pexels-photo-5980866.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',
'content' => 'Security is our top priority. We use industry-leading security protocols to keep your funds and personal information safe. Our multi-cluster system architecture and cold storage solutions ensure the highest level of protection for your digital assets.'
],
'privacy' => [
'title' => 'Privacy Policy',
'image' => 'https://images.pexels.com/photos/6771574/pexels-photo-6771574.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',
'content' => 'We are committed to protecting your privacy. This policy explains how we collect, use, and safeguard your information. We never share your data with third parties without your explicit consent.'
],
'terms' => [
'title' => 'Terms of Service',
'image' => 'https://images.pexels.com/photos/7567443/pexels-photo-7567443.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1',
'content' => 'By using BITCrypto, you agree to our terms of service. Our platform provides digital asset trading services and you are responsible for maintaining the security of your account and complying with local regulations.'
]
];
$page = $pages[$slug] ?? $pages['about'];
?>
<div class="container my-5 py-5">
<div class="row justify-content-center">
<div class="col-lg-10">
<div class="card bg-dark border-secondary overflow-hidden shadow-lg" style="border-radius: 24px;">
<div class="position-relative" style="height: 350px;">
<img src="<?php echo $page['image']; ?>" class="w-100 h-100 object-fit-cover" alt="Banner">
<div class="position-absolute top-0 start-0 w-100 h-100" style="background: linear-gradient(rgba(0,0,0,0.1), rgba(0,0,0,0.8));"></div>
<div class="position-absolute bottom-0 start-0 p-5">
<h1 class="display-4 fw-bold text-white"><?php echo t($page['title']); ?></h1>
</div>
</div>
<div class="p-5">
<div class="fs-5 text-muted lh-lg" style="text-align: justify;">
<?php echo $page['content']; ?>
<br><br>
<div class="row g-4 mt-4">
<div class="col-md-4">
<img src="https://images.pexels.com/photos/6770610/pexels-photo-6770610.jpeg?auto=compress&cs=tinysrgb&w=600" class="img-fluid rounded-4 mb-3" alt="Crypto 1">
</div>
<div class="col-md-4">
<img src="https://images.pexels.com/photos/844124/pexels-photo-844124.jpeg?auto=compress&cs=tinysrgb&w=600" class="img-fluid rounded-4 mb-3" alt="Crypto 2">
</div>
<div class="col-md-4">
<img src="https://images.pexels.com/photos/730547/pexels-photo-730547.jpeg?auto=compress&cs=tinysrgb&w=600" class="img-fluid rounded-4 mb-3" alt="Crypto 3">
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<style>
.object-fit-cover { object-fit: cover; }
</style>
<?php require_once 'includes/footer.php'; ?>

532
profile.php Normal file
View File

@ -0,0 +1,532 @@
<?php
require_once 'includes/header.php';
if (!$user) {
header('Location: login.php');
exit;
}
$msg = '';
$error = '';
// Initialize default security password if empty
if (empty($user['security_password'])) {
$default_sec = password_hash('123456', PASSWORD_DEFAULT);
try {
db()->prepare("UPDATE users SET security_password = ? WHERE id = ?")->execute([$default_sec, $user['id']]);
$user['security_password'] = $default_sec;
} catch (Exception $e) {}
}
// Handle KYC upload
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['kyc_submit'])) {
$real_name = $_POST['real_name'] ?? '';
$id_number = $_POST['id_number'] ?? '';
$upload_dir = 'assets/uploads/kyc/';
if (!is_dir($upload_dir)) {
mkdir($upload_dir, 0775, true);
}
$id_front = $user['id_front'];
$id_back = $user['id_back'];
$id_handheld = $user['id_handheld'];
$files_uploaded = 0;
foreach (['id_front', 'id_back', 'id_handheld'] as $field) {
if (isset($_FILES[$field]) && $_FILES[$field]['error'] === UPLOAD_ERR_OK) {
$ext = pathinfo($_FILES[$field]['name'], PATHINFO_EXTENSION);
$filename = $user['id'] . '_' . $field . '_' . time() . '.' . $ext;
if (move_uploaded_file($_FILES[$field]['tmp_name'], $upload_dir . $filename)) {
$$field = $filename;
$files_uploaded++;
}
}
}
try {
$stmt = db()->prepare("UPDATE users SET real_name = ?, id_number = ?, id_front = ?, id_back = ?, id_handheld = ?, kyc_status = 'pending' WHERE id = ?");
$stmt->execute([$real_name, $id_number, $id_front, $id_back, $id_handheld, $user['id']]);
$msg = mt('Identity verification submitted and is under review.');
$user['kyc_status'] = 'pending';
$user['real_name'] = $real_name;
$user['id_number'] = $id_number;
$user['id_front'] = $id_front;
$user['id_back'] = $id_back;
$user['id_handheld'] = $id_handheld;
} catch (Exception $e) {
$error = mt('Error') . ': ' . $e->getMessage();
}
}
// Handle Password Changes
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['change_password'])) {
$type = $_POST['type'] ?? 'login'; // 'login' or 'security'
$old_pass = $_POST['old_password'] ?? '';
$new_pass = $_POST['new_password'] ?? '';
$confirm_pass = $_POST['confirm_password'] ?? '';
if ($new_pass !== $confirm_pass) {
$error = mt('New passwords do not match.');
} elseif (strlen($new_pass) < 6) {
$error = mt('Password must be at least 6 characters.');
} else {
$current_hash = ($type === 'login') ? $user['password_hash'] : $user['security_password'];
if (password_verify($old_pass, $current_hash)) {
$new_hash = password_hash($new_pass, PASSWORD_DEFAULT);
$column = ($type === 'login') ? 'password_hash' : 'security_password';
try {
db()->prepare("UPDATE users SET $column = ? WHERE id = ?")->execute([$new_hash, $user['id']]);
$msg = mt('Password updated successfully.');
} catch (Exception $e) {
$error = mt('Update failed') . ': ' . $e->getMessage();
}
} else {
$error = mt('Current password incorrect.');
}
}
}
?>
<style>
.profile-container {
padding: 40px 0;
min-height: 80vh;
}
.side-nav {
background-color: #181a20;
border-radius: 24px;
padding: 20px;
border: 1px solid #2b2f36;
}
.side-nav .nav-link {
color: #848e9c;
padding: 15px 20px;
border-radius: 12px;
margin-bottom: 5px;
font-weight: 500;
transition: all 0.3s;
border: none;
width: 100%;
text-align: left;
}
.side-nav .nav-link:hover {
background-color: rgba(255,255,255,0.05);
color: white;
}
.side-nav .nav-link.active {
background-color: var(--okx-blue);
color: white;
}
.content-card {
background-color: #181a20;
border-radius: 24px;
padding: 40px;
border: 1px solid #2b2f36;
height: 100%;
}
.stat-box {
background: rgba(255,255,255,0.03);
border: 1px solid #2b2f36;
border-radius: 16px;
padding: 25px;
text-align: center;
}
.upload-area {
border: 2px dashed #2b2f36;
border-radius: 16px;
padding: 20px;
text-align: center;
cursor: pointer;
transition: all 0.3s;
position: relative;
min-height: 150px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
background: rgba(255,255,255,0.02);
}
.upload-area:hover {
border-color: var(--okx-blue);
background: rgba(0, 70, 255, 0.05);
}
.upload-area img {
max-width: 100%;
max-height: 120px;
border-radius: 8px;
}
.upload-area input[type="file"] {
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
opacity: 0;
cursor: pointer;
}
.asset-row {
padding: 20px 0;
border-bottom: 1px solid #2b2f36;
display: flex;
justify-content: space-between;
align-items: center;
}
.asset-row:last-child { border-bottom: none; }
.form-control {
background-color: #0b0e11;
border: 1px solid #2b2f36;
color: white;
padding: 12px;
border-radius: 10px;
}
.form-control:focus {
background-color: #0b0e11;
border-color: var(--okx-blue);
color: white;
box-shadow: none;
}
@media (max-width: 991px) {
.profile-container { padding: 20px 0; }
.content-card { padding: 25px; margin-top: 20px; }
}
</style>
<div class="profile-container">
<div class="container">
<?php if ($msg): ?>
<div class="alert alert-success alert-dismissible fade show border-0 shadow-sm" style="border-radius: 12px;">
<?php echo $msg; ?>
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
<?php endif; ?>
<?php if ($error): ?>
<div class="alert alert-danger alert-dismissible fade show border-0 shadow-sm" style="border-radius: 12px;">
<?php echo $error; ?>
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
</div>
<?php endif; ?>
<div class="row g-4">
<!-- Sidebar -->
<div class="col-lg-3">
<div class="side-nav shadow-sm">
<div class="text-center mb-4">
<div class="d-inline-block position-relative mb-3">
<div class="rounded-circle d-flex align-items-center justify-content-center text-white fw-bold fs-2" style="width: 80px; height: 80px; background: var(--bit-gradient);">
<?php echo strtoupper(substr($user['username'], 0, 1)); ?>
</div>
<span class="position-absolute bottom-0 end-0 bg-success border border-dark rounded-circle" style="width: 18px; height: 18px;"></span>
</div>
<h5 class="mb-1 text-white"><?php echo htmlspecialchars($user['username']); ?></h5>
<p class="small text-muted mb-0">UID: <span class="text-white"><?php echo str_pad($user['uid'], 6, '0', STR_PAD_LEFT); ?></span></p>
</div>
<div class="nav flex-column" id="v-pills-tab" role="tablist">
<button class="nav-link active" id="overview-tab" data-bs-toggle="pill" data-bs-target="#overview" type="button"><i class="fas fa-th-large me-2"></i> <?php echo mt('Overview'); ?></button>
<button class="nav-link" id="assets-tab" data-bs-toggle="pill" data-bs-target="#assets" type="button"><i class="fas fa-wallet me-2"></i> <?php echo mt('Assets'); ?></button>
<button class="nav-link" id="security-tab" data-bs-toggle="pill" data-bs-target="#security" type="button"><i class="fas fa-shield-alt me-2"></i> <?php echo mt('Security'); ?></button>
<button class="nav-link" id="kyc-tab" data-bs-toggle="pill" data-bs-target="#kyc" type="button"><i class="fas fa-user-check me-2"></i> <?php echo mt('Verification'); ?></button>
</div>
</div>
</div>
<!-- Content -->
<div class="col-lg-9">
<div class="tab-content h-100 shadow-sm">
<!-- Overview -->
<div class="tab-pane fade show active" id="overview">
<div class="content-card">
<h3 class="fw-bold mb-4 text-white"><?php echo mt('Account Overview'); ?></h3>
<div class="row g-4 mb-5">
<div class="col-md-4">
<div class="stat-box">
<div class="small text-muted mb-2"><?php echo mt('Total Balance'); ?></div>
<h2 class="fw-bold text-white"><?php echo number_format($user['balance_usdt'], 2); ?> <span class="fs-6 text-muted">USDT</span></h2>
</div>
</div>
<div class="col-md-4">
<div class="stat-box">
<div class="small text-muted mb-2"><?php echo mt('Identity Verification'); ?></div>
<h4 class="fw-bold <?php
echo $user['kyc_status'] == 'approved' ? 'text-success' :
($user['kyc_status'] == 'pending' ? 'text-warning' : 'text-danger'); ?>">
<?php echo mt($user['kyc_status'] == 'none' ? 'Unverified' : ucfirst($user['kyc_status'])); ?>
</h4>
</div>
</div>
<div class="col-md-4">
<div class="stat-box">
<div class="small text-muted mb-2"><?php echo mt('Security'); ?></div>
<h4 class="fw-bold text-success">Level 2</h4>
</div>
</div>
</div>
<h5 class="fw-bold mb-3 text-white"><?php echo mt('Recent Activities'); ?></h5>
<div class="table-responsive">
<table class="table table-dark table-hover border-secondary">
<thead>
<tr class="text-muted small">
<th><?php echo mt('Time'); ?></th>
<th><?php echo mt('Action'); ?></th>
<th><?php echo mt('Status'); ?></th>
</tr>
</thead>
<tbody class="small">
<tr>
<td><?php echo date('Y-m-d H:i'); ?></td>
<td><?php echo mt('Account Login'); ?></td>
<td><span class="badge bg-success bg-opacity-10 text-success border border-success border-opacity-25 px-2"><?php echo mt('Success'); ?></span></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<!-- Assets -->
<div class="tab-pane fade" id="assets">
<div class="content-card">
<div class="d-flex justify-content-between align-items-center mb-4">
<h3 class="fw-bold mb-0 text-white"><?php echo mt('Assets Overview'); ?></h3>
<div>
<a href="deposit.php" class="btn btn-primary px-4 me-2 border-0" style="background: var(--okx-blue);"><?php echo mt('Deposit'); ?></a>
<a href="withdraw.php" class="btn btn-outline-light px-4"><?php echo mt('Withdraw'); ?></a>
</div>
</div>
<div class="bg-dark bg-opacity-50 p-4 rounded-4 mb-4 border border-secondary">
<div class="row">
<div class="col-md-6 border-end border-secondary">
<div class="small text-muted mb-1"><?php echo mt('Total Net Value'); ?> (USDT)</div>
<h1 class="fw-bold text-white"><?php echo number_format($user['balance_usdt'], 2); ?></h1>
</div>
<div class="col-md-6 ps-md-4">
<div class="small text-muted mb-1"><?php echo mt('Yesterday Profit/Loss'); ?></div>
<h3 class="fw-bold text-success">+$0.00 (0.00%)</h3>
</div>
</div>
</div>
<div class="asset-list">
<div class="asset-row">
<div class="d-flex align-items-center">
<img src="https://static.okx.com/cdn/oksupport/asset/currency/icon/usdt.png" width="40" class="me-3">
<div>
<div class="fw-bold text-white">USDT</div>
<div class="small text-muted">Tether</div>
</div>
</div>
<div class="text-end">
<div class="fw-bold text-white"><?php echo number_format($user['balance_usdt'], 2); ?></div>
<div class="small text-muted"> $<?php echo number_format($user['balance_usdt'], 2); ?></div>
</div>
</div>
</div>
</div>
</div>
<!-- Security -->
<div class="tab-pane fade" id="security">
<div class="content-card">
<h3 class="fw-bold mb-4 text-white"><?php echo mt('Security Settings'); ?></h3>
<div class="mb-5">
<div class="d-flex justify-content-between align-items-center py-4 border-bottom border-secondary">
<div>
<h6 class="mb-1 text-white"><?php echo mt('Login Password'); ?></h6>
<p class="small text-muted mb-0"><?php echo mt('Last updated'); ?>: <?php echo mt('Recently'); ?></p>
</div>
<button class="btn btn-outline-light btn-sm px-4 rounded-pill" data-bs-toggle="modal" data-bs-target="#loginPassModal"><?php echo mt('Change'); ?></button>
</div>
<div class="d-flex justify-content-between align-items-center py-4 border-bottom border-secondary">
<div>
<h6 class="mb-1 text-white"><?php echo mt('Trading Password'); ?></h6>
<p class="small text-muted mb-0"><?php echo mt('Required for withdrawals'); ?></p>
</div>
<button class="btn btn-outline-light btn-sm px-4 rounded-pill" data-bs-toggle="modal" data-bs-target="#secPassModal"><?php echo mt('Change'); ?></button>
</div>
<div class="d-flex justify-content-between align-items-center py-4 border-bottom border-secondary">
<div>
<h6 class="mb-1 text-white"><?php echo mt('2FA Authentication'); ?></h6>
<p class="small text-muted mb-0"><?php echo mt('Google Authenticator'); ?></p>
</div>
<button class="btn btn-outline-light btn-sm px-4 rounded-pill"><?php echo mt('Link'); ?></button>
</div>
</div>
</div>
</div>
<!-- KYC -->
<div class="tab-pane fade" id="kyc">
<div class="content-card">
<h3 class="fw-bold mb-4 text-white"><?php echo mt('Identity Verification'); ?></h3>
<?php if ($user['kyc_status'] == 'pending'): ?>
<div class="text-center py-5">
<i class="fas fa-clock fa-5x text-warning mb-4"></i>
<h4 class="text-white"><?php echo mt('Reviewing...'); ?></h4>
<p class="text-muted"><?php echo mt('Your identity documents are being verified by our team.'); ?></p>
<div class="mt-4 p-3 bg-dark rounded-3 text-start small">
<div class="text-white mb-2 fw-bold"><?php echo mt('Submitted Details'); ?>:</div>
<div class="text-muted"><?php echo mt('Name'); ?>: <span class="text-white"><?php echo htmlspecialchars($user['real_name']); ?></span></div>
<div class="text-muted"><?php echo mt('ID Number'); ?>: <span class="text-white"><?php echo htmlspecialchars($user['id_number']); ?></span></div>
</div>
</div>
<?php elseif ($user['kyc_status'] == 'approved'): ?>
<div class="text-center py-5">
<i class="fas fa-check-circle fa-5x text-success mb-4"></i>
<h4 class="text-white"><?php echo mt('Verified'); ?></h4>
<p class="text-muted"><?php echo mt('Your account is fully verified for all features.'); ?></p>
<div class="mt-4 p-3 bg-dark rounded-3 text-start small">
<div class="text-white mb-2 fw-bold"><?php echo mt('Verified Identity'); ?>:</div>
<div class="text-muted"><?php echo mt('Name'); ?>: <span class="text-white"><?php echo htmlspecialchars($user['real_name']); ?></span></div>
<div class="text-muted"><?php echo mt('ID Number'); ?>: <span class="text-white"><?php echo htmlspecialchars($user['id_number']); ?></span></div>
</div>
</div>
<?php else: ?>
<form action="" method="POST" enctype="multipart/form-data" id="kycForm">
<div class="row g-4 mb-4">
<div class="col-md-6">
<label class="form-label text-muted small"><?php echo mt('Full Name'); ?></label>
<input type="text" name="real_name" class="form-control" placeholder="<?php echo mt('Enter your real name'); ?>" required value="<?php echo htmlspecialchars($user['real_name'] ?? ''); ?>">
</div>
<div class="col-md-6">
<label class="form-label text-muted small"><?php echo mt('ID Number'); ?></label>
<input type="text" name="id_number" class="form-control" placeholder="<?php echo mt('Enter ID/Passport Number'); ?>" required value="<?php echo htmlspecialchars($user['id_number'] ?? ''); ?>">
</div>
</div>
<div class="row g-4 mb-5">
<div class="col-md-4">
<div class="upload-area" onclick="document.getElementById('id_front').click()">
<input type="file" name="id_front" id="id_front" accept="image/*" required onchange="previewImage(this, 'preview_front')">
<div id="preview_front">
<?php if ($user['id_front']): ?>
<img src="assets/uploads/kyc/<?php echo $user['id_front']; ?>">
<?php else: ?>
<i class="fas fa-id-card fa-3x mb-3 text-muted opacity-25"></i>
<div class="small text-muted"><?php echo mt('Front Side'); ?></div>
<?php endif; ?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="upload-area" onclick="document.getElementById('id_back').click()">
<input type="file" name="id_back" id="id_back" accept="image/*" required onchange="previewImage(this, 'preview_back')">
<div id="preview_back">
<?php if ($user['id_back']): ?>
<img src="assets/uploads/kyc/<?php echo $user['id_back']; ?>">
<?php else: ?>
<i class="fas fa-id-card fa-3x mb-3 text-muted opacity-25"></i>
<div class="small text-muted"><?php echo mt('Back Side'); ?></div>
<?php endif; ?>
</div>
</div>
</div>
<div class="col-md-4">
<div class="upload-area" onclick="document.getElementById('id_handheld').click()">
<input type="file" name="id_handheld" id="id_handheld" accept="image/*" required onchange="previewImage(this, 'preview_handheld')">
<div id="preview_handheld">
<?php if ($user['id_handheld']): ?>
<img src="assets/uploads/kyc/<?php echo $user['id_handheld']; ?>">
<?php else: ?>
<i class="fas fa-camera fa-3x mb-3 text-muted opacity-25"></i>
<div class="small text-muted"><?php echo mt('Selfie with ID'); ?></div>
<?php endif; ?>
</div>
</div>
</div>
</div>
<button type="submit" name="kyc_submit" class="btn btn-primary w-100 py-3 fw-bold border-0" style="background: var(--okx-blue); border-radius: 16px;"><?php echo mt('Submit'); ?></button>
</form>
<?php endif; ?>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<script>
function previewImage(input, previewId) {
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function(e) {
document.getElementById(previewId).innerHTML = '<img src="' + e.target.result + '">';
}
reader.readAsDataURL(input.files[0]);
}
}
</script>
<!-- Modals -->
<div class="modal fade" id="loginPassModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content bg-dark border-secondary" style="border-radius: 20px;">
<div class="modal-header border-secondary p-4">
<h5 class="modal-title text-white fw-bold"><?php echo mt('Change Login Password'); ?></h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<form action="" method="POST">
<div class="modal-body p-4">
<input type="hidden" name="change_password" value="1">
<input type="hidden" name="type" value="login">
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Current Password'); ?></label>
<input type="password" name="old_password" class="form-control shadow-none" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('New Password'); ?></label>
<input type="password" name="new_password" class="form-control shadow-none" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Confirm New Password'); ?></label>
<input type="password" name="confirm_password" class="form-control shadow-none" required>
</div>
</div>
<div class="modal-footer border-0 p-4 pt-0">
<button type="button" class="btn btn-secondary px-4 rounded-pill" data-bs-dismiss="modal"><?php echo mt('Cancel'); ?></button>
<button type="submit" class="btn btn-primary px-4 rounded-pill border-0" style="background: var(--okx-blue);"><?php echo mt('Save Changes'); ?></button>
</div>
</form>
</div>
</div>
</div>
<div class="modal fade" id="secPassModal" tabindex="-1">
<div class="modal-dialog modal-dialog-centered">
<div class="modal-content bg-dark border-secondary" style="border-radius: 20px;">
<div class="modal-header border-secondary p-4">
<h5 class="modal-title text-white fw-bold"><?php echo mt('Change Trading Password'); ?></h5>
<button type="button" class="btn-close btn-close-white" data-bs-dismiss="modal"></button>
</div>
<form action="" method="POST">
<div class="modal-body p-4">
<input type="hidden" name="change_password" value="1">
<input type="hidden" name="type" value="security">
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Current Trading Password'); ?></label>
<input type="password" name="old_password" class="form-control shadow-none" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('New Trading Password'); ?> (6 <?php echo mt('digits'); ?>)</label>
<input type="password" name="new_password" class="form-control shadow-none" pattern="\d{6}" maxlength="6" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Confirm New Trading Password'); ?></label>
<input type="password" name="confirm_password" class="form-control shadow-none" pattern="\d{6}" maxlength="6" required>
</div>
</div>
<div class="modal-footer border-0 p-4 pt-0">
<button type="button" class="btn btn-secondary px-4 rounded-pill" data-bs-dismiss="modal"><?php echo mt('Cancel'); ?></button>
<button type="submit" class="btn btn-primary px-4 rounded-pill border-0" style="background: var(--okx-blue);"><?php echo mt('Save Changes'); ?></button>
</div>
</form>
</div>
</div>
</div>
<?php require_once 'includes/footer.php'; ?>

97
register.php Normal file
View File

@ -0,0 +1,97 @@
<?php
require_once 'includes/header.php';
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$username = $_POST['username'] ?? '';
$password = $_POST['password'] ?? '';
$confirm_password = $_POST['confirm_password'] ?? '';
$agree = $_POST['agree'] ?? '';
if (empty($username) || empty($password)) {
$error = mt('Please fill in all fields.');
} elseif ($password !== $confirm_password) {
$error = mt('Passwords do not match.');
} elseif (!$agree) {
$error = mt('You must agree to the terms and privacy policy.');
} else {
try {
$pdo = db();
// Check if user exists
$stmt = $pdo->prepare("SELECT id FROM users WHERE username = ?");
$stmt->execute([$username]);
if ($stmt->fetch()) {
$error = mt('Username already exists.');
} else {
// Generate unique 6-digit UID
do {
$uid = rand(100000, 999999);
$stmt = $pdo->prepare("SELECT id FROM users WHERE uid = ?");
$stmt->execute([$uid]);
} while ($stmt->fetch());
$hash = password_hash($password, PASSWORD_DEFAULT);
$stmt = $pdo->prepare("INSERT INTO users (username, uid, email, password_hash, balance_usdt) VALUES (?, ?, ?, ?, ?)");
$stmt->execute([$username, $uid, $username . '@example.com', $hash, 10000.00]); // Give $10k demo balance
$userId = $pdo->lastInsertId();
$_SESSION['user_id'] = $userId;
header('Location: index.php');
exit;
}
} catch (Exception $e) {
$error = mt('Error') . ': ' . $e->getMessage();
}
}
}
?>
<div class="container my-5 py-5">
<div class="row justify-content-center">
<div class="col-md-5">
<div class="card bg-dark border-secondary p-4 shadow-lg" style="border-radius: 20px;">
<h2 class="text-center mb-4 fw-bold text-white"><?php echo mt('Sign Up'); ?></h2>
<p class="text-center text-muted mb-4 small"><?php echo mt("Join the world's leading crypto exchange"); ?></p>
<?php if ($error): ?>
<div class="alert alert-danger border-0 small"><?php echo $error; ?></div>
<?php endif; ?>
<form method="POST">
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Username / Email'); ?></label>
<input type="text" name="username" class="form-control bg-dark text-white border-secondary py-2" required placeholder="<?php echo mt('Enter username'); ?>">
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Password'); ?></label>
<input type="password" name="password" class="form-control bg-dark text-white border-secondary py-2" required placeholder="<?php echo mt('Enter password'); ?>">
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Confirm Password'); ?></label>
<input type="password" name="confirm_password" class="form-control bg-dark text-white border-secondary py-2" required placeholder="<?php echo mt('Repeat password'); ?>">
</div>
<div class="mb-4 form-check">
<input type="checkbox" name="agree" class="form-check-input" id="agree" required>
<label class="form-check-label small text-muted" for="agree">
<?php echo mt('I have read and agree to the'); ?> <a href="#" class="text-primary fw-bold text-decoration-none"><?php echo mt('Terms of Service'); ?></a> <?php echo mt('and'); ?> <a href="#" class="text-primary fw-bold text-decoration-none"><?php echo mt('Privacy Policy'); ?></a>.
</label>
</div>
<button type="submit" class="btn btn-primary w-100 py-3 fw-bold mb-3" style="border-radius: 12px; background-color: var(--okx-blue); border: none;"><?php echo mt('Create Account'); ?></button>
<div class="text-center">
<span class="text-muted small"><?php echo mt('Already have an account?'); ?></span>
<a href="login.php" class="text-primary text-decoration-none fw-bold small ms-1"><?php echo mt('Login'); ?></a>
</div>
</form>
</div>
</div>
</div>
</div>
<style>
.form-control:focus {
background-color: #2b2f36;
border-color: var(--okx-blue);
box-shadow: none;
color: #fff;
}
</style>
<?php require_once 'includes/footer.php'; ?>

386
trade.php Normal file
View File

@ -0,0 +1,386 @@
<?php
require_once 'includes/header.php';
$symbol = $_GET['symbol'] ?? 'BTC';
$type = $_GET['type'] ?? 'spot';
?>
<style>
.trade-container { height: calc(100vh - 62px); overflow: hidden; background-color: var(--primary-bg); }
.market-list { height: 100%; overflow-y: auto; background-color: var(--primary-bg); border-right: 1px solid #2b2f36; }
.trade-main { height: 100%; display: flex; flex-direction: column; background-color: var(--primary-bg); }
.order-sidebar { height: 100%; overflow-y: auto; background-color: var(--primary-bg); border-left: 1px solid #2b2f36; }
.market-bar { background-color: var(--primary-bg); border-bottom: 1px solid #2b2f36; }
.chart-container { flex-grow: 1; min-height: 450px; background-color: var(--primary-bg); }
.trade-tabs .nav-link { color: #848e9c; border: none; font-weight: 600; padding: 10px 15px; font-size: 0.85rem; background: transparent; }
.trade-tabs .nav-link.active { color: var(--okx-blue); background: transparent; border-bottom: 2px solid var(--okx-blue); }
.order-book-row { display: flex; justify-content: space-between; font-size: 0.75rem; padding: 2px 10px; position: relative; cursor: pointer; }
.order-book-row:hover { background-color: rgba(255,255,255,0.05); }
.order-book-row .price { z-index: 1; font-family: 'Roboto Mono', monospace; }
.order-book-row .amount { z-index: 1; color: #848e9c; }
.order-book-row.ask .price { color: #f6465d; }
.order-book-row.bid .price { color: #0ecb81; }
.depth-bg { position: absolute; right: 0; top: 0; height: 100%; opacity: 0.15; z-index: 0; transition: width 0.3s; }
.depth-bg.ask { background-color: #f6465d; }
.depth-bg.bid { background-color: #0ecb81; }
.crypto-item { padding: 8px 12px; border-bottom: 1px solid rgba(255,255,255,0.03); cursor: pointer; transition: background 0.2s; }
.crypto-item:hover { background-color: #1e2329; }
.crypto-item.active { background-color: #1e2329; border-left: 2px solid var(--okx-blue); }
.crypto-icon { width: 18px; height: 18px; margin-right: 8px; border-radius: 50%; }
.crypto-name-text { font-size: 0.75rem; font-weight: 600; }
.crypto-sub-text { font-size: 0.65rem; color: #848e9c; }
.crypto-price-text { font-size: 0.75rem; font-weight: 600; }
.crypto-change-text { font-size: 0.65rem; }
.btn-buy { background-color: #0ecb81; color: white; border: none; font-weight: bold; transition: opacity 0.2s; }
.btn-buy:hover { opacity: 0.9; color: white; }
.btn-sell { background-color: #f6465d; color: white; border: none; font-weight: bold; transition: opacity 0.2s; }
.btn-sell:hover { opacity: 0.9; color: white; }
.percent-btn { font-size: 0.65rem; padding: 2px 5px; background: #2b2f36; border: 1px solid #3b3f46; color: #848e9c; border-radius: 4px; }
.percent-btn:hover { background: #3b3f46; color: white; }
@media (max-width: 991px) {
.trade-container { height: auto; overflow: visible; }
.market-list { display: none; }
.order-sidebar { border-left: none; border-top: 1px solid #2b2f36; padding-bottom: 80px; }
.chart-container { min-height: 350px; }
}
</style>
<div class="container-fluid trade-container px-0">
<div class="row g-0 h-100">
<!-- Market List (Left) -->
<div class="col-lg-2 market-list d-none d-lg-block">
<div class="p-2 border-bottom border-secondary">
<div class="input-group input-group-sm">
<span class="input-group-text bg-transparent border-0 text-muted"><i class="fas fa-search"></i></span>
<input type="text" id="market-search" class="form-control bg-transparent text-white border-0 shadow-none" placeholder="<?php echo mt('Search Pairs'); ?>" style="font-size: 0.75rem;">
</div>
</div>
<div id="crypto-list-container">
<div class="text-center py-5"><div class="spinner-border spinner-border-sm text-primary"></div></div>
</div>
</div>
<!-- Main Trading Area (Middle) -->
<div class="col-lg-7 trade-main">
<!-- Market Info Bar -->
<div class="market-bar p-2 d-flex align-items-center flex-wrap gap-4">
<div class="d-flex align-items-center me-2 ps-2">
<img id="current-coin-icon" src="https://static.okx.com/cdn/oksupport/asset/currency/icon/<?php echo strtolower($symbol); ?>.png" width="24" class="me-2">
<h5 class="mb-0 fw-bold text-white" style="font-size: 1.1rem;"><?php echo $symbol; ?>/USDT <span class="badge bg-secondary ms-2" style="font-size: 0.6rem; vertical-align: middle;"><?php echo mt($type === 'contract' ? 'Perpetual' : 'Spot'); ?></span></h5>
</div>
<div>
<div id="last-price" class="fw-bold text-success fs-5">--</div>
<div id="price-fiat" class="small text-muted" style="font-size: 0.7rem;"> $0.00</div>
</div>
<div>
<div class="small text-muted" style="font-size: 0.7rem;">24h <?php echo mt('Change'); ?></div>
<div id="24h-change" class="fw-bold" style="font-size: 0.8rem;">--</div>
</div>
<div class="d-none d-md-block">
<div class="small text-muted" style="font-size: 0.7rem;">24h <?php echo mt('High'); ?></div>
<div id="24h-high" class="fw-bold text-white" style="font-size: 0.8rem;">--</div>
</div>
</div>
<!-- Chart -->
<div class="chart-container border-bottom border-secondary">
<div id="tradingview_chart" class="h-100"></div>
<script type="text/javascript" src="https://s3.tradingview.com/tv.js"></script>
<script type="text/javascript">
function initChart(symbol) {
new TradingView.widget({
"autosize": true,
"symbol": "BINANCE:" + symbol + "USDT",
"interval": "15",
"timezone": "Etc/UTC",
"theme": "dark",
"style": "1",
"locale": "<?php echo ($lang == 'zh' ? 'zh_CN' : 'en'); ?>",
"toolbar_bg": "#101216",
"enable_publishing": false,
"hide_side_toolbar": false,
"allow_symbol_change": true,
"container_id": "tradingview_chart",
"studies": [
"MASimple@tv-basicstudies",
"RSI@tv-basicstudies"
],
"show_popup_button": true,
"popup_width": "1000",
"popup_height": "650",
"backgroundColor": "#101216",
"gridColor": "rgba(255, 255, 255, 0.05)",
"overrides": {
"mainSeriesProperties.candleStyle.upColor": "#0ecb81",
"mainSeriesProperties.candleStyle.downColor": "#f6465d",
"mainSeriesProperties.candleStyle.drawWick": true,
"mainSeriesProperties.candleStyle.drawBorder": true,
"mainSeriesProperties.candleStyle.borderColor": "#378658",
"mainSeriesProperties.candleStyle.borderUpColor": "#0ecb81",
"mainSeriesProperties.candleStyle.borderDownColor": "#f6465d",
"mainSeriesProperties.candleStyle.wickUpColor": "#0ecb81",
"mainSeriesProperties.candleStyle.wickDownColor": "#f6465d",
"paneProperties.background": "#101216",
"paneProperties.vertGridProperties.color": "rgba(255, 255, 255, 0.05)",
"paneProperties.horzGridProperties.color": "rgba(255, 255, 255, 0.05)",
"symbolWatermarkProperties.transparency": 90,
"scalesProperties.textColor" : "#848e9c",
"mainSeriesProperties.showPriceLine": true
}
});
}
initChart("<?php echo $symbol; ?>");
</script>
</div>
<!-- Orders/History (Bottom) -->
<div class="flex-grow-1 overflow-auto" style="background-color: var(--primary-bg);">
<ul class="nav nav-tabs trade-tabs border-bottom border-secondary sticky-top bg-dark" id="bottomTabs">
<li class="nav-item"><a class="nav-link active" data-bs-toggle="tab" href="#open-orders"><?php echo mt('Open Orders'); ?></a></li>
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#order-history"><?php echo mt('Order History'); ?></a></li>
<li class="nav-item"><a class="nav-link" data-bs-toggle="tab" href="#positions"><?php echo mt('Positions'); ?></a></li>
</ul>
<div class="tab-content">
<div class="tab-pane fade show active p-2" id="open-orders">
<table class="table table-dark table-sm small align-middle mb-0">
<thead>
<tr class="text-muted border-0" style="font-size: 0.7rem;">
<th><?php echo mt('Time'); ?></th>
<th><?php echo mt('Pair'); ?></th>
<th><?php echo mt('Type'); ?></th>
<th><?php echo mt('Side'); ?></th>
<th><?php echo mt('Price'); ?></th>
<th><?php echo mt('Amount'); ?></th>
<th><?php echo mt('Filled'); ?></th>
<th><?php echo mt('Action'); ?></th>
</tr>
</thead>
<tbody id="open-orders-list">
<tr><td colspan="8" class="text-center py-5 text-muted"><?php echo mt('No open orders'); ?></td></tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<!-- Order Sidepanel (Right) -->
<div class="col-lg-3 order-sidebar">
<div class="order-book p-0 border-bottom border-secondary" style="height: 320px; display: flex; flex-direction: column;">
<div class="p-2 d-flex justify-content-between small text-muted border-bottom border-secondary" style="background: var(--primary-bg); font-size: 0.65rem;">
<span><?php echo mt('Price'); ?> (USDT)</span>
<span><?php echo mt('Amount'); ?> (<?php echo $symbol; ?>)</span>
</div>
<div id="order-book-asks" style="flex: 1; overflow: hidden; display: flex; flex-direction: column-reverse;"></div>
<div id="mid-price-row" class="px-3 py-1 fs-5 fw-bold text-success bg-black bg-opacity-25 border-top border-bottom border-secondary">
<span id="book-price">--</span>
</div>
<div id="order-book-bids" style="flex: 1; overflow: hidden;"></div>
</div>
<div class="p-3">
<div class="d-flex justify-content-between align-items-center mb-3">
<div class="nav nav-pills small bg-dark p-1 rounded-pill" id="order-type-tabs">
<button class="nav-link active py-1 px-3 rounded-pill" id="tab-limit" style="font-size: 0.7rem; color: #848e9c;"><?php echo mt('Limit'); ?></button>
<button class="nav-link py-1 px-3 rounded-pill" id="tab-market" style="font-size: 0.7rem; color: #848e9c;"><?php echo mt('Market'); ?></button>
</div>
<?php if ($type === 'contract'): ?>
<div class="dropdown">
<button class="btn btn-sm btn-dark border-secondary dropdown-toggle py-0" type="button" data-bs-toggle="dropdown" id="leverage-btn" style="font-size: 0.7rem;">20x</button>
<ul class="dropdown-menu dropdown-menu-dark">
<li><a class="dropdown-item" href="#" onclick="setLeverage(10)">10x</a></li>
<li><a class="dropdown-item active" href="#" onclick="setLeverage(20)">20x</a></li>
<li><a class="dropdown-item" href="#" onclick="setLeverage(50)">50x</a></li>
<li><a class="dropdown-item" href="#" onclick="setLeverage(100)">100x</a></li>
</ul>
</div>
<?php endif; ?>
</div>
<form id="order-form">
<input type="hidden" id="current-symbol" value="<?php echo $symbol; ?>">
<input type="hidden" id="trade-type" value="<?php echo $type; ?>">
<input type="hidden" id="user-balance" value="<?php echo $user['balance_usdt'] ?? 0; ?>">
<div class="btn-group w-100 mb-3" role="group">
<input type="radio" class="btn-check" name="side" id="side-buy" value="buy" checked>
<label class="btn btn-outline-success border-0 py-2 fw-bold" for="side-buy" style="background-color: rgba(14, 203, 129, 0.05); font-size: 0.85rem;"><?php echo mt('Buy'); ?></label>
<input type="radio" class="btn-check" name="side" id="side-sell" value="sell">
<label class="btn btn-outline-danger border-0 py-2 fw-bold" for="side-sell" style="background-color: rgba(246, 70, 93, 0.05); font-size: 0.85rem;"><?php echo mt('Sell'); ?></label>
</div>
<div class="mb-2" id="price-input-group">
<div class="input-group input-group-sm">
<span class="input-group-text bg-dark border-secondary text-muted" style="min-width: 70px; font-size: 0.7rem;"><?php echo mt('Price'); ?></span>
<input type="number" id="order-price" class="form-control bg-dark text-white border-secondary shadow-none" step="0.01" style="font-size: 0.8rem;">
<span class="input-group-text bg-dark border-secondary text-muted" style="font-size: 0.7rem;">USDT</span>
</div>
</div>
<div class="mb-2">
<div class="input-group input-group-sm">
<span class="input-group-text bg-dark border-secondary text-muted" style="min-width: 70px; font-size: 0.7rem;"><?php echo mt($type === 'contract' ? 'Lots' : 'Amount'); ?></span>
<input type="number" id="order-amount" class="form-control bg-dark text-white border-secondary shadow-none" placeholder="0.00" style="font-size: 0.8rem;">
<span class="input-group-text bg-dark border-secondary text-muted" style="font-size: 0.7rem;"><?php echo $symbol; ?></span>
</div>
</div>
<div class="d-flex justify-content-between gap-1 mb-3">
<button type="button" class="percent-btn flex-grow-1" onclick="setPercent(0.25)">25%</button>
<button type="button" class="percent-btn flex-grow-1" onclick="setPercent(0.50)">50%</button>
<button type="button" class="percent-btn flex-grow-1" onclick="setPercent(0.75)">75%</button>
<button type="button" class="percent-btn flex-grow-1" onclick="setPercent(1.00)">100%</button>
</div>
<?php if ($type === 'contract'): ?>
<div class="mb-2">
<div class="input-group input-group-sm">
<span class="input-group-text bg-dark border-secondary text-muted" style="min-width: 70px; font-size: 0.7rem;"><?php echo mt('Take-Profit'); ?></span>
<input type="number" id="take-profit" class="form-control bg-dark text-white border-secondary shadow-none" placeholder="0.00" style="font-size: 0.8rem;">
</div>
</div>
<div class="mb-3">
<div class="input-group input-group-sm">
<span class="input-group-text bg-dark border-secondary text-muted" style="min-width: 70px; font-size: 0.7rem;"><?php echo mt('Stop-Loss'); ?></span>
<input type="number" id="stop-loss" class="form-control bg-dark text-white border-secondary shadow-none" placeholder="0.00" style="font-size: 0.8rem;">
</div>
</div>
<?php endif; ?>
<div class="d-flex justify-content-between small text-muted mb-4 px-1" style="font-size: 0.7rem;">
<span><?php echo mt('Available'); ?></span>
<span class="text-white"><?php echo number_format($user['balance_usdt'] ?? 0, 2); ?> USDT</span>
</div>
<button type="button" id="submit-btn" class="btn btn-buy w-100 py-3 mb-3 fs-6 rounded-3" onclick="submitOrder()">
<?php echo mt('Buy'); ?> <?php echo $symbol; ?>
</button>
</form>
</div>
</div>
</div>
</div>
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
<script>
let currentLeverage = 20;
function setLeverage(lev) {
currentLeverage = lev;
const btn = document.getElementById('leverage-btn');
if (btn) btn.innerText = lev + 'x';
calculateMax();
}
function calculateMax() {
const balance = parseFloat(document.getElementById('user-balance').value);
const priceInput = document.getElementById('order-price');
let price = parseFloat(priceInput.value);
const symbol = document.getElementById('current-symbol').value;
const isMarket = document.getElementById('tab-market').classList.contains('active');
if (isMarket || !price) {
if (window.currentMarketData && window.currentMarketData[symbol]) {
price = window.currentMarketData[symbol].price;
}
}
if (price > 0) {
let max = balance / price;
if (document.getElementById('trade-type').value === 'contract') {
max *= currentLeverage;
}
window.currentMaxAmount = max;
if (isMarket) {
priceInput.value = price.toFixed(2);
}
}
}
function setPercent(p) {
if (window.currentMaxAmount > 0) {
document.getElementById('order-amount').value = (window.currentMaxAmount * p).toFixed(4);
}
}
function submitOrder() {
const amount = document.getElementById('order-amount').value;
if (!amount || amount <= 0) {
alert(t('Please enter a valid amount.'));
return;
}
const side = document.querySelector('input[name="side"]:checked').value;
const type = document.getElementById('tab-limit').classList.contains('active') ? 'Limit' : 'Market';
const symbol = document.getElementById('current-symbol').value;
const price = type === 'Limit' ? document.getElementById('order-price').value : 'Market';
const list = document.getElementById('open-orders-list');
const row = `
<tr class="border-secondary">
<td>${new Date().toLocaleTimeString()}</td>
<td>${symbol}/USDT</td>
<td>${type}</td>
<td class="${side === 'buy' ? 'text-success' : 'text-danger'}">${side.toUpperCase()}</td>
<td>${price}</td>
<td>${amount}</td>
<td>0%</td>
<td><button class="btn btn-sm btn-link text-danger p-0 text-decoration-none">${t('Cancel')}</button></td>
</tr>
`;
if (list.innerHTML.includes('colspan="8"')) {
list.innerHTML = row;
} else {
list.innerHTML = row + list.innerHTML;
}
alert(t('Order submitted successfully!'));
}
document.addEventListener('DOMContentLoaded', () => {
setTimeout(calculateMax, 1000);
setInterval(calculateMax, 3000);
document.getElementById('tab-limit').addEventListener('click', function() {
document.getElementById('price-input-group').style.display = 'block';
this.classList.add('active');
document.getElementById('tab-market').classList.remove('active');
calculateMax();
});
document.getElementById('tab-market').addEventListener('click', function() {
document.getElementById('price-input-group').style.display = 'none';
this.classList.add('active');
document.getElementById('tab-limit').classList.remove('active');
calculateMax();
});
document.querySelectorAll('input[name="side"]').forEach(radio => {
radio.addEventListener('change', (e) => {
const btn = document.getElementById('submit-btn');
const sym = document.getElementById('current-symbol').value;
const buyText = t('Buy');
const sellText = t('Sell');
if (e.target.value === 'buy') {
btn.className = 'btn btn-buy w-100 py-3 mb-3 fs-6 rounded-3';
btn.textContent = buyText + ' ' + sym;
} else {
btn.className = 'btn btn-sell w-100 py-3 mb-3 fs-6 rounded-3';
btn.textContent = sellText + ' ' + sym;
}
});
});
});
</script>
<?php require_once 'includes/footer.php'; ?>

103
withdraw.php Normal file
View File

@ -0,0 +1,103 @@
<?php
require_once 'includes/header.php';
if (!$user) {
header('Location: login.php');
exit;
}
$error = '';
$success = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$amount = (float)($_POST['amount'] ?? 0);
$address = $_POST['address'] ?? '';
$security_password = $_POST['security_password'] ?? '';
if ($amount <= 0) {
$error = mt('Please enter a valid amount.');
} elseif ($amount > $user['balance_usdt']) {
$error = mt('Insufficient balance.');
} elseif (!password_verify($security_password, $user['security_password'])) {
$error = mt('Current password incorrect.');
} else {
try {
db()->prepare("UPDATE users SET balance_usdt = balance_usdt - ? WHERE id = ?")->execute([$amount, $user['id']]);
$success = mt('Withdrawal request submitted successfully.');
$user['balance_usdt'] -= $amount;
} catch (Exception $e) {
$error = mt('Error');
}
}
}
?>
<div class="container my-5 py-5">
<div class="row justify-content-center">
<div class="col-md-6">
<div class="card bg-dark border-secondary p-4 shadow-lg overflow-hidden" style="border-radius: 24px;">
<div class="d-flex align-items-center mb-4">
<button onclick="history.back()" class="btn btn-dark rounded-circle me-3 border-secondary" style="width: 40px; height: 40px;">
<i class="fas fa-arrow-left"></i>
</button>
<h3 class="fw-bold mb-0 text-white"><i class="fas fa-arrow-up me-2 text-danger"></i> <?php echo mt('Withdrawal'); ?></h3>
</div>
<?php if ($error): ?>
<div class="alert alert-danger bg-danger bg-opacity-10 border-0 text-danger small" style="border-radius: 12px;"><?php echo $error; ?></div>
<?php endif; ?>
<?php if ($success): ?>
<div class="alert alert-success bg-success bg-opacity-10 border-0 text-success small" style="border-radius: 12px;"><?php echo $success; ?></div>
<?php endif; ?>
<div class="bg-secondary bg-opacity-10 p-4 rounded-4 mb-4 border border-secondary border-opacity-25">
<div class="small text-muted mb-1"><?php echo mt('Available'); ?></div>
<h4 class="fw-bold text-white mb-0"><?php echo number_format($user['balance_usdt'], 2); ?> <span class="fs-6 text-muted">USDT</span></h4>
</div>
<form method="POST">
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Withdrawal Address'); ?></label>
<input type="text" name="address" class="form-control bg-dark text-white border-secondary py-3 px-3 rounded-3 shadow-none" placeholder="USDT (TRC20)" required>
</div>
<div class="mb-3">
<label class="form-label text-muted small"><?php echo mt('Amount'); ?></label>
<div class="input-group">
<input type="number" name="amount" class="form-control bg-dark text-white border-secondary py-3 px-3 rounded-start-3 shadow-none" placeholder="Min 10.00" step="0.01" required>
<span class="input-group-text bg-dark border-secondary text-white rounded-end-3">USDT</span>
</div>
</div>
<div class="mb-4">
<label class="form-label text-muted small"><?php echo mt('Trading Password'); ?></label>
<input type="password" name="security_password" class="form-control bg-dark text-white border-secondary py-3 px-3 rounded-3 shadow-none" placeholder="6-digit" pattern="\d{6}" maxlength="6" required>
</div>
<button type="submit" class="btn btn-danger w-100 py-3 fw-bold fs-5 rounded-3 shadow-sm" style="background-color: var(--danger); border: none;">
<?php echo mt('Withdrawal'); ?>
</button>
</form>
</div>
<div class="mt-4 p-4 bg-secondary bg-opacity-10 rounded-4 border border-secondary border-opacity-25">
<h6 class="text-white fw-bold mb-3 small text-uppercase" style="letter-spacing: 1px;"><?php echo mt('Notes'); ?></h6>
<ul class="text-muted small mb-0 ps-3">
<li class="mb-2"><?php echo mt('Withdrawals are processed within 10-30 minutes.'); ?></li>
<li class="mb-2"><?php echo mt('Minimum withdrawal amount is 10 USDT.'); ?></li>
<li><?php echo mt('Ensure the receiving address supports the TRC20 network.'); ?></li>
</ul>
</div>
</div>
</div>
</div>
<style>
.form-control:focus {
background-color: #2b2f36;
border-color: var(--danger);
color: #fff;
}
</style>
<?php require_once 'includes/footer.php'; ?>