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//archive_all.php.NAO
<?php include 'protect.php'; ?>

<?php
include 'db.php';

$confirm = $_POST['confirm'] ?? '';
$today = date('Y-m-d');

if ($_SERVER['REQUEST_METHOD'] === 'POST' && $confirm === 'yes') {
    // Step 1: Get all customers with transactions
    $customers = $conn->query("SELECT DISTINCT customer_id FROM transactions");

    while ($row = $customers->fetch_assoc()) {
        $customer_id = $row['customer_id'];

        // Fetch all transactions
        $stmt = $conn->prepare("SELECT * FROM transactions WHERE customer_id = ?");
        $stmt->bind_param("i", $customer_id);
        $stmt->execute();
        $transactions = $stmt->get_result();

        // Prepare insert into archive
        $insert = $conn->prepare("
            INSERT INTO archived_transactions (customer_id, item_name, quantity, price, taxable, notes, original_date, archived_on)
            VALUES (?, ?, ?, ?, ?, ?, ?, ?)
        ");

        while ($t = $transactions->fetch_assoc()) {
            $insert->bind_param(
                "isidisss",
                $t['customer_id'],
                $t['item_name'],
                $t['quantity'],
                $t['price'],
                $t['taxable'],
                $t['notes'],
                $t['date'],
                $today
            );
            $insert->execute();
        }

        // Delete originals
        $del = $conn->prepare("DELETE FROM transactions WHERE customer_id = ?");
        $del->bind_param("i", $customer_id);
        $del->execute();
    }

    echo "<p><strong>All customer tabs have been archived for $today.</strong></p>";
    echo "<p><a href='export_qbo_zip.php?month=" . date('Y-m') . "'>Download ZIP of QBO exports</a></p>";
    echo "<p><a href='index.php'>&larr; Back to Dashboard</a></p>";
    exit;
}
?>

<!DOCTYPE html>
<html>
<head>
    <title>Archive All Customer Tabs</title>
    <style>
        body { font-family: 'Segoe UI', sans-serif; background: #f9f9f9; padding: 40px; }
        .box { background: white; padding: 30px; max-width: 600px; margin: auto; box-shadow: 0 0 10px rgba(0,0,0,0.1); }
        h1 { margin-top: 0; }
        .confirm-btn { padding: 10px 20px; background: #4CAF50; color: white; border: none; border-radius: 4px; cursor: pointer; }
        .confirm-btn:hover { background: #45a049; }
        .cancel-btn { background: #ccc; color: #333; margin-left: 10px; }
        .cancel-btn:hover { background: #bbb; }
    </style>
</head>
<body>
<div class="box">
    <h1>Archive All Customer Tabs</h1>
    <p>This will move all open customer tabs into the archive and reset their accounts.</p>

    <form method="post" onsubmit="return confirm('Are you sure you want to archive all customer tabs? This cannot be undone.')">
        <input type="hidden" name="confirm" value="yes">
        <input type="submit" class="confirm-btn" value="Yes, Archive All">
        <a href="index.php" class="confirm-btn cancel-btn">Cancel</a>
    </form>
</div>
</body>
</html>

Youez - 2016 - github.com/yon3zu
LinuXploit