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/thelittlebigshow/self-hosted/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/thelittlebigshow/self-hosted/unarchive_month.php
<?php include 'protect.php'; ?>

<?php
include 'db.php';

$customer_id = isset($_POST['customer_id']) ? intval($_POST['customer_id']) : 0;
$month = $_POST['month'] ?? '';

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

// Fetch archived transactions for that month
$stmt = $conn->prepare("
    SELECT * FROM archived_transactions
    WHERE customer_id = ? AND DATE_FORMAT(archived_on, '%Y-%m') = ?
");
$stmt->bind_param("is", $customer_id, $month);
$stmt->execute();
$transactions = $stmt->get_result();

// Prepare insert into live transactions
$insert = $conn->prepare("
    INSERT INTO transactions (customer_id, item_name, quantity, price, taxable, notes, date)
    VALUES (?, ?, ?, ?, ?, ?, ?)
");

// Loop and insert each record back
while ($row = $transactions->fetch_assoc()) {
    $insert->bind_param(
        "isidiss",
        $row['customer_id'],
        $row['item_name'],
        $row['quantity'],
        $row['price'],
        $row['taxable'],
        $row['notes'],
        $row['original_date']
    );
    $insert->execute();
}

// Delete them from archive
$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;
?>

Youez - 2016 - github.com/yon3zu
LinuXploit