PHP WebShell
Текущая директория: /var/www/bitcardoApp/user/wallets
Просмотр файла: wallets.php
<?php include '../common/header.php'; ?>
<?php
// ---------- Amount formatting helpers (safe to redefine) ----------
if (!function_exists('coin_decimals_ui')) {
function coin_decimals_ui(string $coin): int {
$coin = strtoupper($coin);
return match ($coin) {
'BTC' => 8,
'ETH' => 10,
'SOL' => 9,
'TRX' => 6,
'USDT', 'USDC' => 6,
'USD', 'NGN' => 2,
default => 8, // sensible crypto default
};
}
}
if (!function_exists('fmt_coin_amount')) {
function fmt_coin_amount($amount, string $coin): string {
$scale = coin_decimals_ui($coin);
// number_format is fine here—DB DECIMAL(30,10) values fit our scales.
return number_format((float)$amount, $scale, '.', '');
}
}
?>
<!-- Main Container -->
<div class="container mt-3">
<div class="row">
<?php include '../common/nav.php'; ?>
<!-- Main Content -->
<main class="col-md-9 col-lg-10 px-md-5 mb-5">
<?php include '../common/page-header.php'; ?>
<div class="container my-5">
<div class="row g-4">
<!-- Left Column -->
<div class="offset-md-1 col-md-5 mt-2">
<div class="card-soft">
<div class="offset-5 col-4 mb-3">
<div class="rounded-icon align-item-center">
<i class="bi bi-person"></i>
</div>
</div>
<h4 class="fw-bold mt-3 mb-0"><?= htmlspecialchars(($userFName ?? '') . ' ' . ($userLName ?? '')); ?></h4>
<p class="text-muted small mb-2">Your personal account</p>
<div class="open-business bg-light mt-3">
<i class="bi bi-briefcase me-1"></i>
<?= number_format((float)($totalNgn ?? 0), 2) . ' <small>NGN</small>'; ?>
</div>
<p style="font-size:small; color: #8f8e94;" class="small mb-4">
Total Naira Balance
</p>
<div class="open-business bg-light mt-3">
<i class="bi bi-briefcase me-1"></i>
<?= number_format((float)($totalUsd ?? 0), 2) . ' <small>USD</small>'; ?>
</div>
<p style="font-size:small; color: #8f8e94;" class="small mb-4">
Total USD Balance
</p>
</div>
</div>
<!-- Right Column -->
<div class="col-md-6">
<!-- Balance List -->
<?php if (!empty($wallets)): ?>
<?php foreach ($wallets as $wallet): ?>
<?php
$coin = strtoupper($wallet['coin'] ?? '');
$label = $wallet['label'] ?: $coin;
$bal = $wallet['balance'] ?? 0;
$balTxt = fmt_coin_amount($bal, $coin);
?>
<a href="single-wallet.php?ussgwt=<?= urlencode($wallet['wallet_id']); ?>&coin=<?= urlencode($coin); ?>"
class="list-group-item ps-3 balance-item d-flex justify-content-between align-items-center">
<div class="d-flex align-items-center gap-3">
<img src="../../assets/icons/<?= htmlspecialchars($wallet['icon']); ?>" class="bg-white flag" alt="<?= htmlspecialchars($coin); ?>">
<div>
<div class="fw-semibold"><?= htmlspecialchars($label); ?></div>
<small class="text-muted"><?= htmlspecialchars($coin); ?> <?= $balTxt; ?></small>
</div>
</div>
<div><i class="bi bi-chevron-right pe-3"></i></div>
</a>
<?php endforeach; ?>
<?php else: ?>
<!-- CREATE NAIRA WALLET CARD -->
<div class="card">
<div class="card-body text-center mt-3">
<p>You have no wallet yet, <a href="" class="btn btn-primary btn-sm">Create Naira Wallet</a></p>
</div>
</div>
<?php endif; ?>
<?php
// Flags for presence (use 'USDT' not 'TUSDT')
$hasNGN = false;
$hasUSDT = false;
if (!empty($wallets)) {
foreach ($wallets as $w) {
if (!isset($w['coin'])) continue;
$c = strtoupper($w['coin']);
if ($c === 'NGN') $hasNGN = true;
if ($c === 'USDT') $hasUSDT = true;
}
}
?>
</div>
</div>
</div>
</main>
</div>
</div>
<?php include '../common/footer.php'; ?>
Выполнить команду
Для локальной разработки. Не используйте в интернете!