| 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 : |
<?php include 'protect.php'; ?>
<?php
include 'db.php';
$customer_id = isset($_POST['customer_id']) ? intval($_POST['customer_id']) : 0;
$quantities = $_POST['quantity'] ?? [];
$items = $_POST['item_name'] ?? [];
$prices = $_POST['price'] ?? [];
$taxable_flags = $_POST['taxable'] ?? []; // associative: [index => 'on']
$notes = $_POST['notes'] ?? [];
if ($customer_id > 0 && !empty($items)) {
for ($i = 0; $i < count($items); $i++) {
$item = trim($items[$i]);
$quantity = isset($quantities[$i]) ? floatval($quantities[$i]) : 1;
$price = isset($prices[$i]) ? floatval($prices[$i]) : 0;
$taxable = array_key_exists($i, $taxable_flags) ? 1 : 0; // ensure mapping
$note = trim($notes[$i]);
if ($item !== '' && $quantity > 0) {
$stmt = $conn->prepare("INSERT INTO transactions (customer_id, item_name, quantity, price, taxable, notes, date) VALUES (?, ?, ?, ?, ?, ?, NOW())");
$stmt->bind_param("isddis", $customer_id, $item, $quantity, $price, $taxable, $note);
$stmt->execute();
}
}
}
header("Location: view_account.php?customer_id=" . $customer_id);
exit;
?>