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/Backups/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/wcfs/tabs/Backups/view_account.php.nao.red and heading
<?php
include 'db.php';

$tax_rate = 0.082;
$customer_id = isset($_GET['customer_id']) ? intval($_GET['customer_id']) : 0;
$archive_month = $_GET['archive_month'] ?? '';
$show_archives = isset($_GET['view_archives']) && $_GET['view_archives'] == '1';

$transactions = [];
$total = 0.0;
$customer_name = '';

$customers = $conn->query("SELECT id, first_name, last_name FROM customers ORDER BY last_name, first_name");

// Get customer name
if ($customer_id > 0) {
    $stmt = $conn->prepare("SELECT first_name, last_name FROM customers WHERE id = ?");
    $stmt->bind_param("i", $customer_id);
    $stmt->execute();
    $result = $stmt->get_result();
    if ($row = $result->fetch_assoc()) {
        $customer_name = $row['first_name'] . ' ' . $row['last_name'];
    } else {
        $customer_id = 0;
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>View Account - <?= htmlspecialchars($customer_name) ?></title>
    
    <style>
        body {
            font-family: 'Segoe UI', sans-serif;
            background-color: #f9f9f9;
            margin: 0;
            padding: 30px;
            color: #333;
        }

        .container {
            max-width: 1000px;
            margin: auto;
            background: #fff;
            padding: 30px;
            box-shadow: 0 2px 6px rgba(0,0,0,0.1);
        }

        .top-bar {
            display: flex;
            justify-content: space-between;
            flex-wrap: wrap;
            gap: 10px;
            margin-bottom: 20px;
        }

        .top-bar select {
            padding: 8px;
            font-size: 16px;
            min-width: 250px;
        }

        .actions {
            display: flex;
            gap: 10px;
        }

        .actions form {
            display: inline-block;
        }

        .actions input[type="submit"] {
            padding: 8px 12px;
            background-color: #f44336;
            border: none;
            color: #fff;
            cursor: pointer;
            border-radius: 4px;
        }

        .actions input[type="submit"]:hover {
            background-color: #c62828;
        }

        .archive-list a {
            margin-right: 10px;
            text-decoration: none;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 15px;
        }

        th, td {
            border: 1px solid #ddd;
            padding: 8px;
        }

        th {
            background-color: #f0f0f0;
        }

        .total-row {
            font-weight: bold;
            background-color: #fafafa;
        }

        .submit-btn {
            margin-top: 10px;
            padding: 10px 16px;
            background-color: #4CAF50;
            border: none;
            color: white;
            font-size: 16px;
            border-radius: 4px;
            cursor: pointer;
        }

        .submit-btn:hover {
            background-color: #45a049;
        }

        .back-link {
            margin-top: 30px;
        }

        button {
            padding: 6px 10px;
            font-size: 14px;
            background-color: #eee;
            border: 1px solid #ccc;
            cursor: pointer;
            border-radius: 4px;
        }

        button:hover {
            background-color: #ddd;
        }
    </style>

</head>
<body>
<div class="container">
    <h1>View Customer Account</h1>

    <div class="top-bar">
        <form method="get">
            <label>Select Customer: </label>
            <select name="customer_id" onchange="this.form.submit()">
                <option value="">-- Choose --</option>
                <?php while ($c = $customers->fetch_assoc()): ?>
                    <option value="<?= $c['id'] ?>" <?= $c['id'] == $customer_id ? 'selected' : '' ?>>
                        <?= htmlspecialchars($c['last_name'] . ', ' . $c['first_name']) ?>
                    </option>
                <?php endwhile; ?>
            </select>
        </form>

        <?php if ($customer_id): ?>
        <div class="actions">
            <form method="post" action="clear_balance.php" onsubmit="return confirm('Archive this customer�s current tab?')">
                <input type="hidden" name="customer_id" value="<?= $customer_id ?>">
                <input type="hidden" name="confirm" value="start">
                <input type="submit" value="Archive Tab">
            </form>

            <form method="post" action="delete_customer.php" onsubmit="return confirm('Are you sure you want to delete this customer?')">
                <input type="hidden" name="customer_id" value="<?= $customer_id ?>">
                <input type="hidden" name="confirm" value="start">
                <input type="submit" value="Delete Customer">
            </form>
        </div>
        <?php endif; ?>
    </div>

    <?php if ($customer_id): ?>
        <h2><?= htmlspecialchars($customer_name) ?></h2>
        <p><a href="view_account.php?customer_id=<?= $customer_id ?>&view_archives=1">View Archived Months</a></p>

        <?php
        // Load archive months
        $months = [];
        $stmt = $conn->prepare("SELECT DISTINCT DATE_FORMAT(archived_on, '%Y-%m') AS month FROM archived_transactions WHERE customer_id = ? ORDER BY month DESC");
        $stmt->bind_param("i", $customer_id);
        $stmt->execute();
        $result = $stmt->get_result();
        while ($row = $result->fetch_assoc()) {
            $months[] = $row['month'];
        }
        ?>

        <?php if ($months && ($archive_month || $show_archives)): ?>
        <div class="archive-list">
            <h4>Archived Months:</h4>
            <?php foreach ($months as $m): ?>
                <a href="view_account.php?customer_id=<?= $customer_id ?>&archive_month=<?= $m ?>">
                    <?= date('F Y', strtotime($m . '-01')) ?>
                </a>
            <?php endforeach; ?>

            <?php if ($archive_month): ?>
                <p><a href="view_account.php?customer_id=<?= $customer_id ?>">Return to Current Tab</a></p>
                <form method="post" action="unarchive_month.php" class="unarchive-form" onsubmit="return confirm('Unarchive this month and return items to current tab?')">
                    <input type="hidden" name="customer_id" value="<?= $customer_id ?>">
                    <input type="hidden" name="month" value="<?= $archive_month ?>">
                    <input type="submit" value="Unarchive This Month">
                </form>
            <?php endif; ?>
        </div>
        <?php endif; ?>
    <?php endif; ?>

    <p><a href="index.php">&larr; Back to Dashboard</a></p>

<?php if ($customer_id && !$archive_month): ?>

    <!-- Current Balance -->
    <?php
    $stmt = $conn->prepare("SELECT * FROM transactions WHERE customer_id = ?");
    $stmt->bind_param("i", $customer_id);
    $stmt->execute();
    $result = $stmt->get_result();
    $total = 0;
    while ($row = $result->fetch_assoc()) {
        $line_total = $row['price'] * $row['quantity'];
        if ($row['taxable']) {
            $line_total *= (1 + $tax_rate);
        }
        $total += $line_total;
    }
    ?>
    <p><strong>Current Balance:</strong> $<?= number_format($total, 2) ?></p>

    <!-- Add Items -->
    <div class="add-items">
        <h3>Add More Items</h3>
        <form method="post" action="add_transaction.php">
            <input type="hidden" name="customer_id" value="<?= $customer_id ?>">
            <table id="items-table">
                <tr>
                    <th>Qty</th>
                    <th>Item</th>
                    <th>Price</th>
                    <th>Taxable</th>
                    <th>Notes</th>
                </tr>
                <?php for ($i = 0; $i < 3; $i++): ?>
                <tr>
                    <td><input type="number" name="quantity[]" value="1" min="1"></td>
                    <td><input type="text" name="item_name[]"></td>
                    <td><input type="number" step="0.01" name="price[]"></td>
                    <td><input type="checkbox" name="taxable[]" checked></td>
                    <td><input type="text" name="notes[]"></td>
                </tr>
                <?php endfor; ?>
            </table>
            <button type="button" onclick="addRow()">+ Add More Rows</button><br><br>
            <input class="submit-btn" type="submit" value="Add Items to Account">
        </form>
    </div>

    <!-- Live Transactions -->
    <?php
    $stmt = $conn->prepare("SELECT * FROM transactions WHERE customer_id = ? ORDER BY date DESC");
    $stmt->bind_param("i", $customer_id);
    $stmt->execute();
    $result = $stmt->get_result();
    $transactions = [];
    $total = 0;
    while ($row = $result->fetch_assoc()) {
        $line_total = $row['price'] * $row['quantity'];
        if ($row['taxable']) {
            $line_total *= (1 + $tax_rate);
        }
        $total += $line_total;
        $transactions[] = $row;
    }
    ?>

    <?php if ($transactions): ?>
        <table>
            <tr>
                <th>Date</th>
                <th>Qty</th>
                <th>Item</th>
                <th>Price</th>
                <th>Taxable</th>
                <th>Total</th>
                <th>Notes</th>
            </tr>
            <?php foreach ($transactions as $t): ?>
            <?php
                $line_total = $t['price'] * $t['quantity'];
                if ($t['taxable']) {
                    $line_total *= (1 + $tax_rate);
                }
            ?>
            <tr>
                <td><?= $t['date'] ?></td>
                <td><?= $t['quantity'] ?></td>
                <td><?= htmlspecialchars($t['item_name']) ?></td>
                <td>$<?= number_format($t['price'], 2) ?></td>
                <td><?= $t['taxable'] ? '<span style="color:red;">Yes</span>' : 'No' ?></td>

                <td>$<?= number_format($line_total, 2) ?></td>
<td>
    <form method="post" action="delete_transaction.php" onsubmit="return confirm('Delete this item?');">
        <input type="hidden" name="transaction_id" value="<?= $t['id'] ?>">
        <input type="hidden" name="customer_id" value="<?= $customer_id ?>">
        <input type="submit" value="Delete">
    </form>
</td>
                <td><?= htmlspecialchars($t['notes']) ?></td>
            </tr>
            <?php endforeach; ?>
            

<?php
    $item_total = 0;
    $taxable_total = 0;
    foreach ($transactions as $t) {
        $line_base = $t['price'] * $t['quantity'];
        $item_total += $line_base;
        if ($t['taxable']) {
            $taxable_total += $line_base;
        }
    }
    $tax_amount = $taxable_total * $tax_rate;
    ?>
    
<?php
$item_total = 0;
$taxable_total = 0;
foreach ($transactions as $t) {
    $line_base = $t['price'] * $t['quantity'];
    $item_total += $line_base;
    if ($t['taxable']) {
        $taxable_total += $line_base;
    }
}
$tax_amount = $taxable_total * $tax_rate;
$total_with_tax = $item_total + $tax_amount;
?>
<tr class="total-row">
    <td colspan="5" align="right">Item Total:</td>
    <td colspan="2">$<?= number_format($item_total, 2) ?></td>
</tr>
<tr class="total-row">
    <td colspan="5" align="right">Tax Total (8.2%):</td>
    <td colspan="2">$<?= number_format($tax_amount, 2) ?></td>
</tr>
<tr class="total-row">
    <td colspan="5" align="right">Total with Tax:</td>
    <td colspan="2">$<?= number_format($total_with_tax, 2) ?></td>
</tr>
    <tr class="total-row">
        <td colspan="5" align="right">Tax Total (8.2%):</td>
        <td colspan="2">$<?= number_format($tax_amount, 2) ?></td>
    </tr>
    <tr class="total-row">
        <td colspan="5" align="right">Total with Tax:</td>
        <td colspan="2">$<?= number_format($item_total + $tax_amount, 2) ?></td>
    </tr>


        </table>
    <?php else: ?>
        <p><em>No transactions yet for this customer.</em></p>
    <?php endif; ?>

<?php endif; ?>

</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit