38451-vm/profile.php
2026-02-16 05:50:45 +00:00

123 lines
7.0 KiB
PHP

<?php
include __DIR__ . '/includes/header.php';
if (!$user) {
header('Location: /auth/login.php');
exit;
}
// Get balances
$stmt = db()->prepare("SELECT * FROM user_balances WHERE user_id = ?");
$stmt->execute([$user['id']]);
$balances = $stmt->fetchAll();
?>
<div class="container py-5">
<div class="row g-4">
<!-- User Info Card -->
<div class="col-lg-4">
<div class="card bg-dark border-0 shadow-lg h-100" style="background: #161a1e !important; border: 1px solid #2b3139 !important; border-radius: 24px;">
<div class="card-body p-4 text-center">
<div class="position-relative d-inline-block mb-3">
<div class="rounded-circle bg-primary d-flex align-items-center justify-content-center text-white shadow-lg" style="width: 100px; height: 100px; font-size: 40px; background: linear-gradient(135deg, #0062ff, #00d2ff) !important;">
<?= strtoupper(substr($user['username'], 0, 1)) ?>
</div>
<div class="position-absolute bottom-0 end-0 bg-success border border-4 border-dark rounded-circle" style="width: 25px; height: 25px;"></div>
</div>
<h3 class="fw-bold text-white mb-1"><?= htmlspecialchars($user['username']) ?></h3>
<p class="text-muted small mb-4"><?= htmlspecialchars($user['email'] ?? 'No email linked') ?></p>
<div class="bg-black bg-opacity-25 rounded-4 p-3 mb-4 text-start border border-secondary border-opacity-25">
<div class="d-flex justify-content-between mb-2 small">
<span class="text-muted">UID</span>
<span class="text-white fw-bold"><?= $user['uid'] ?? ($user['id'] + 10000) ?></span>
</div>
<div class="d-flex justify-content-between mb-2 small">
<span class="text-muted">Account Status</span>
<span class="text-success fw-bold"><i class="bi bi-patch-check-fill me-1"></i>Verified</span>
</div>
<div class="d-flex justify-content-between small">
<span class="text-muted">Credit Score</span>
<span class="text-primary fw-bold"><?= $user['credit_score'] ?? 80 ?></span>
</div>
</div>
<div class="d-grid gap-2">
<button class="btn btn-outline-secondary rounded-pill py-2 small fw-bold">Security Settings</button>
<button class="btn btn-outline-danger border-0 rounded-pill py-2 small fw-bold" onclick="location.href='/auth/logout.php'">Logout</button>
</div>
</div>
</div>
</div>
<!-- Assets Card -->
<div class="col-lg-8">
<div class="card bg-dark border-0 shadow-lg h-100" style="background: #161a1e !important; border: 1px solid #2b3139 !important; border-radius: 24px;">
<div class="card-body p-4">
<div class="d-flex justify-content-between align-items-center mb-4">
<h4 class="fw-bold text-white m-0">Wallet Balances</h4>
<div class="btn-group">
<button class="btn btn-primary btn-sm px-3 rounded-pill me-2"><?= __('deposit') ?></button>
<button class="btn btn-outline-light btn-sm px-3 rounded-pill"><?= __('withdraw') ?></button>
</div>
</div>
<div class="table-responsive">
<table class="table table-dark table-hover mb-0 align-middle">
<thead style="background: rgba(255,255,255,0.02);">
<tr class="text-muted small border-0">
<th class="ps-3 py-3 border-0">Asset</th>
<th class="py-3 border-0 text-center">Icon</th>
<th class="py-3 border-0">Available</th>
<th class="py-3 border-0">Frozen</th>
<th class="text-end pe-3 py-3 border-0">Action</th>
</tr>
</thead>
<tbody class="border-0">
<?php
$icons = [
'USDT' => '325/small/tether.png',
'BTC' => '1/small/bitcoin.png',
'ETH' => '279/small/ethereum.png',
'BNB' => '825/small/binance-coin-logo.png'
];
foreach($balances as $b):
?>
<tr style="border-bottom: 1px solid rgba(255,255,255,0.05);">
<td class="ps-3 py-4 border-0">
<div class="fw-bold text-white fs-5"><?= $b['symbol'] ?></div>
</td>
<td class="py-4 border-0 text-center">
<img src="<?= getCoinIcon($b['symbol']) ?>" width="24" height="24">
</td>
<td class="py-4 border-0">
<div class="fw-bold text-white"><?= number_format((float)$b['available'], 4) ?></div>
</td>
<td class="py-4 border-0 text-muted small">
<?= number_format((float)$b['frozen'], 4) ?>
</td>
<td class="text-end pe-3 border-0">
<a href="/trade.php?symbol=<?= $b['symbol'] ?>" class="btn btn-outline-primary btn-sm px-3 rounded-pill"><?= __('trade') ?></a>
</td>
</tr>
<?php endforeach; ?>
<?php if (empty($balances)): ?>
<tr>
<td colspan="5" class="py-5 text-center text-muted">
<i class="bi bi-wallet2 fs-1 d-block mb-2"></i>
No assets found in your wallet.
</td>
</tr>
<?php endif; ?>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
</div>
<?php include __DIR__ . '/includes/footer.php'; ?>