173 lines
9.1 KiB
PHP
173 lines
9.1 KiB
PHP
<?php
|
|
include __DIR__ . '/includes/header.php';
|
|
|
|
if (!$user) {
|
|
header('Location: /auth/login.php');
|
|
exit;
|
|
}
|
|
|
|
// Get user data again to ensure we have latest fields
|
|
$stmt = db()->prepare("SELECT * FROM users WHERE id = ?");
|
|
$stmt->execute([$user['id']]);
|
|
$userData = $stmt->fetch();
|
|
|
|
// Get balances
|
|
$stmt = db()->prepare("SELECT * FROM user_balances WHERE user_id = ?");
|
|
$stmt->execute([$user['id']]);
|
|
$balances = $stmt->fetchAll();
|
|
|
|
// Total USDT Balance calculation
|
|
$totalBalanceUsdt = 0;
|
|
foreach ($balances as $b) {
|
|
if ($b['symbol'] === 'USDT') {
|
|
$totalBalanceUsdt += $b['available'] + $b['frozen'];
|
|
}
|
|
}
|
|
|
|
function getVipLevel($totalRecharge) {
|
|
if ($totalRecharge >= 10000000) return 7;
|
|
if ($totalRecharge >= 5000000) return 6;
|
|
if ($totalRecharge >= 1000000) return 5;
|
|
if ($totalRecharge >= 500000) return 4;
|
|
if ($totalRecharge >= 100000) return 3;
|
|
if ($totalRecharge >= 50000) return 2;
|
|
if ($totalRecharge >= 10001) return 1;
|
|
return 0;
|
|
}
|
|
|
|
$vipLevel = getVipLevel($userData['total_recharge'] ?? 0);
|
|
|
|
$kycStatusText = [
|
|
0 => __('unverified'),
|
|
1 => __('pending'),
|
|
2 => __('verified'),
|
|
3 => __('rejected')
|
|
];
|
|
$kycStatusColor = [
|
|
0 => 'text-white-50',
|
|
1 => 'text-warning',
|
|
2 => 'text-success',
|
|
3 => 'text-danger'
|
|
];
|
|
?>
|
|
|
|
<div class="container py-4">
|
|
<div class="row g-4">
|
|
<!-- Sidebar -->
|
|
<div class="col-lg-3">
|
|
<div class="card bg-surface border-secondary rounded-4 overflow-hidden h-100">
|
|
<div class="card-body p-0">
|
|
<!-- User Header -->
|
|
<div class="p-4 text-center border-bottom border-secondary bg-black bg-opacity-20">
|
|
<div class="avatar-wrapper mb-3 mx-auto">
|
|
<div class="rounded-circle bg-primary bg-gradient d-flex align-items-center justify-content-center text-white shadow" style="width: 80px; height: 80px; font-size: 32px;">
|
|
<?= strtoupper(substr($userData['username'], 0, 1)) ?>
|
|
</div>
|
|
</div>
|
|
<h5 class="fw-bold text-white mb-0"><?= htmlspecialchars($userData['username']) ?></h5>
|
|
</div>
|
|
|
|
<!-- Menu List -->
|
|
<div class="list-group list-group-flush bg-transparent">
|
|
<div class="list-group-item bg-transparent border-secondary py-3 d-flex justify-content-between align-items-center">
|
|
<span class="text-white-50 small"><i class="bi bi-person-badge me-2 text-primary"></i>UID</span>
|
|
<span class="text-white fw-bold small"><?= $userData['uid'] ?></span>
|
|
</div>
|
|
<div class="list-group-item bg-transparent border-secondary py-3 d-flex justify-content-between align-items-center">
|
|
<span class="text-white-50 small"><i class="bi bi-shield-check me-2 text-info"></i><?= __('credit_score') ?></span>
|
|
<span class="text-info fw-bold small"><?= $userData['credit_score'] ?></span>
|
|
</div>
|
|
<div class="list-group-item bg-transparent border-secondary py-3 d-flex justify-content-between align-items-center">
|
|
<span class="text-white-50 small"><i class="bi bi-gem me-2 text-warning"></i><?= __('vip_level') ?></span>
|
|
<span class="badge bg-warning text-dark fw-bold">VIP <?= $vipLevel ?></span>
|
|
</div>
|
|
|
|
<a href="/kyc.php" class="list-group-item list-group-item-action bg-transparent border-secondary py-3 d-flex justify-content-between align-items-center text-white">
|
|
<span class="text-white-50 small"><i class="bi bi-person-vcard me-2 text-success"></i><?= __('kyc') ?></span>
|
|
<span class="small <?= $kycStatusColor[$userData['kyc_status'] ?? 0] ?>">
|
|
<?= $kycStatusText[$userData['kyc_status'] ?? 0] ?> <i class="bi bi-chevron-right ms-1"></i>
|
|
</span>
|
|
</a>
|
|
|
|
<a href="/security.php" class="list-group-item list-group-item-action bg-transparent border-secondary py-3 d-flex justify-content-between align-items-center text-white">
|
|
<span class="text-white-50 small"><i class="bi bi-lock me-2 text-danger"></i><?= __('security') ?></span>
|
|
<span class="text-white-50 small"><i class="bi bi-chevron-right"></i></span>
|
|
</a>
|
|
|
|
<a href="/auth/logout.php" class="list-group-item list-group-item-action bg-transparent border-0 py-3 d-flex justify-content-between align-items-center text-danger">
|
|
<span class="small"><i class="bi bi-box-arrow-right me-2"></i><?= __('logout') ?></span>
|
|
<span class="small"><i class="bi bi-chevron-right"></i></span>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Main Content -->
|
|
<div class="col-lg-9">
|
|
<!-- Asset Summary -->
|
|
<div class="card bg-surface border-secondary rounded-4 mb-4">
|
|
<div class="card-body p-4">
|
|
<div class="row align-items-center">
|
|
<div class="col-md-6">
|
|
<p class="text-white-50 small mb-1"><?= __('balance') ?> (USDT)</p>
|
|
<h2 class="text-white fw-bold mb-0">≈ <?= number_format($totalBalanceUsdt, 2) ?> <span class="fs-6 fw-normal text-white-50">USDT</span></h2>
|
|
</div>
|
|
<div class="col-md-6 text-md-end mt-3 mt-md-0">
|
|
<a href="/recharge.php" class="btn btn-primary rounded-pill px-4 me-2">
|
|
<i class="bi bi-plus-circle me-2"></i><?= __('deposit') ?>
|
|
</a>
|
|
<a href="/withdraw.php" class="btn btn-outline-light rounded-pill px-4">
|
|
<i class="bi bi-arrow-up-circle me-2"></i><?= __('withdraw') ?>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Asset Table -->
|
|
<div class="card bg-surface border-secondary rounded-4 overflow-hidden">
|
|
<div class="table-responsive">
|
|
<table class="table table-dark table-hover mb-0 align-middle">
|
|
<thead class="bg-black bg-opacity-40 text-white-50 small border-secondary">
|
|
<tr>
|
|
<th class="ps-4 py-3 border-secondary text-white"><?= __('coin') ?></th>
|
|
<th class="py-3 border-secondary text-white"><?= __('available_balance') ?></th>
|
|
<th class="py-3 border-secondary text-white"><?= __('frozen') ?></th>
|
|
<th class="py-3 border-secondary text-white"><?= __('converted_to') ?> (USDT)</th>
|
|
<th class="text-end pe-4 py-3 border-secondary text-white"><?= __('trade') ?></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="border-0">
|
|
<?php foreach ($balances as $b): ?>
|
|
<tr class="border-secondary">
|
|
<td class="ps-4 py-4">
|
|
<div class="d-flex align-items-center gap-3">
|
|
<img src="<?= getCoinIcon($b['symbol']) ?>" width="32" height="32" class="rounded-circle">
|
|
<span class="fw-bold text-white"><?= $b['symbol'] ?></span>
|
|
</div>
|
|
</td>
|
|
<td class="py-4">
|
|
<span class="text-white fw-bold"><?= number_format($b['available'], 4) ?></span>
|
|
</td>
|
|
<td class="py-4">
|
|
<span class="text-white-50 small"><?= number_format($b['frozen'], 4) ?></span>
|
|
</td>
|
|
<td class="py-4">
|
|
<span class="text-white-50 small">≈ <?= number_format($b['available'] + $b['frozen'], 2) ?></span>
|
|
</td>
|
|
<td class="text-end pe-4">
|
|
<a href="/trade.php?symbol=<?= $b['symbol'] ?>" class="btn btn-sm btn-outline-primary rounded-pill px-3"><?= __('trade') ?></a>
|
|
</td>
|
|
</tr>
|
|
<?php endforeach; ?>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<?php include __DIR__ . '/includes/footer.php'; ?>
|