PHP WebShell

Текущая директория: /var/www/bitcardoApp/user/fiat

Просмотр файла: deposit_success.php

<?php
// user/fiat/deposit_success.php

include '../common/header.php';

// 1) Resolve wallet/coin FIRST (from GET or session), so the include can use them.
$wallet_id = $_GET['ussgwt'] ?? ($_SESSION['deposit']['wallet_id'] ?? null);
$coin      = $_GET['coin']   ?? ($_SESSION['deposit']['currency'] ?? null); // e.g. "NGN"

// If single-walllet.php expects these in $_GET, set them now
if ($wallet_id !== null) $_GET['ussgwt'] = $wallet_id;
if ($coin !== null)      $_GET['coin']   = $coin;

// 2) Include loader that populates wallet vars using the GETs above
include '../../includes/wallets/single-walllet.php'; 
// expected to set: $wallet_address, $bank_name, $wallet_balance, $userFName, $userLName, $wallet_qr, $coin_label, $coin, $wallet_id

// 3) Pull deposit session (set by verify_paystack.php)
$dep = $_SESSION['deposit'] ?? null;

// 4) Safe defaults to prevent "Undefined variable" warnings if the include didn't set something
$wallet_address = $wallet_address ?? '';
$bank_name      = $bank_name      ?? '';
$wallet_balance = isset($wallet_balance) ? (float)$wallet_balance : 0.0;
$userFName      = $userFName      ?? '';
$userLName      = $userLName      ?? '';
$wallet_qr      = $wallet_qr      ?? '';
$coin           = $coin           ?? ($dep['currency'] ?? 'NGN');
$coin_label     = $coin_label     ?? (strtoupper($coin) . ' Wallet');

// 5) Optional: mask last 4 for NGN display
$display_wallet_address = $wallet_address;
if ($coin && strtoupper($coin) === 'NGN' && $wallet_address !== '') {
    // preserve formatting; replace last 4 digits with *
    $display_wallet_address = preg_replace_callback('/(\d)(?=(?:\D*\d){4}$)/', function($m){ return $m[1]; }, $wallet_address);
    $display_wallet_address = preg_replace('/(\d)(?=(?:\D*\d){0,3}$)/', '*', $display_wallet_address);
}
?>

<!-- Main Container -->
<div class="container mt-3">
  <div class="row">
    <?php include '../common/nav.php'; ?>

    <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">
          <div class="offset-md-3 col-md-6 mt-2">

            <div class="card card-body mt-5 text-center">
              <h4 class="fw-bold mt-3 mb-0"><?= htmlspecialchars($userFName . ' ' . $userLName); ?></h4>
              <h5 class="mb-2 mt-3"><?= htmlspecialchars($coin_label); ?></h5>

              <center>
                <img class="img img-fluid" style="width: 200px;" src="../../assets/qr_codes/<?= htmlspecialchars($wallet_qr); ?>" alt="">
              </center>

              <div class="badge bg-light text-dark border mt-3 px-3 py-2">
                <div id="walletid" style="cursor: pointer;" onclick="copyWalletID(this)">
                  <?= htmlspecialchars($bank_name); ?> 
                  <?= htmlspecialchars($display_wallet_address); ?>
                </div>
              </div>
              <small style="font-size: 10px; color: #8f8e94;">Tap to copy</small>
              <div id="copied-msg" class="mt-3" style="display: none; color: green;">Copied!</div>

              <div class="open-business bg-light mt-3 mb-3">
                <i class="bi bi-briefcase me-1"></i>
                <?= number_format($wallet_balance, 2) . ' ' . htmlspecialchars($coin); ?>
              </div>

              <?php if ($dep): ?>
                <?php if (!empty($dep['ok'])): ?>
                  <div class="alert alert-success mt-3 text-start" role="alert">
                    <div class="fw-bold mb-1">Deposit Confirmed</div>
                    <div>Reference: <span class="text-monospace"><?= htmlspecialchars($dep['reference']); ?></span></div>
                    <div>Paid (Gross): <strong><?= '₦' . number_format((float)$dep['amount'], 2); ?></strong></div>
                    <?php if (isset($dep['fee_total'])): ?>
                      <div class="mt-1">
                        Paystack Fees<?= isset($dep['fee_vat']) ? ' (incl. VAT)' : '' ?>:
                        <strong><?= '₦' . number_format((float)$dep['fee_total'], 2); ?></strong>
                        <?php if (isset($dep['fee_base']) && isset($dep['fee_vat'])): ?>
                          <div class="small text-muted">Base: ₦<?= number_format((float)$dep['fee_base'], 2); ?>, VAT: ₦<?= number_format((float)$dep['fee_vat'], 2); ?></div>
                        <?php endif; ?>
                      </div>
                    <?php endif; ?>
                    <div class="mt-1">
                      Net Credited: <strong><?= '₦' . number_format((float)($dep['net_amount'] ?? max(0, ($dep['amount'] ?? 0) - ($dep['fee_total'] ?? 0))), 2); ?></strong>
                    </div>
                    <?php if (!is_null($dep['new_balance'] ?? null)): ?>
                      <div class="mt-1">New Balance: <strong><?= '₦' . number_format((float)$dep['new_balance'], 2); ?></strong></div>
                    <?php endif; ?>
                    <div class="mt-1 small text-muted"><?= htmlspecialchars($dep['message']); ?></div>
                  </div>
                <?php else: ?>
                  <div class="alert alert-danger mt-3 text-start" role="alert">
                    <div class="fw-bold mb-1">Deposit Failed</div>
                    <div class="small"><?= htmlspecialchars($dep['message'] ?? 'Unable to verify payment.'); ?></div>
                  </div>
                <?php endif; ?>
              <?php else: ?>
                <div class="alert alert-secondary mt-3">No deposit data found in session.</div>
              <?php endif; ?>

            </div>

            <div class="mt-3 d-flex justify-content-center">
              <div class="col-5 me-3">
                <a href="../dashboard/index.php#convert" class="btn btn-outline-secondary w-100">Convert</a>
              </div>
              <div class="col-5">
                <a href="./../wallets/single-wallet.php?ussgwt=<?= urlencode($wallet_id); ?>&coin=<?= urlencode($coin); ?>" class="btn btn-primary w-100">Back to Wallet</a>
              </div>
            </div>

          </div>
        </div>
      </div>

    </main>
  </div>
</div>

<script>
function copyWalletID(element) {
  const text = element.textContent;
  navigator.clipboard.writeText(text).then(() => {
    const msg = document.getElementById("copied-msg");
    msg.style.display = "inline";
    setTimeout(() => msg.style.display = "none", 1500);
  });
}
</script>

<?php include '../common/footer.php'; ?>

Выполнить команду


Для локальной разработки. Не используйте в интернете!