| 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;
$confirm = $_POST['confirm'] ?? '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// Step 1: First confirmation
if ($confirm === 'start') {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Confirm Delete Customer</title>
</head>
<body>
<h2>⚠ Confirm: Delete Customer</h2>
<p>Are you sure you want to delete this customer and all their transactions?</p>
<form method="post" action="delete_customer.php">
<input type="hidden" name="customer_id" value="<?= $customer_id ?>">
<input type="hidden" name="confirm" value="final">
<input type="submit" value="? Yes, Continue">
<a href="view_account.php?customer_id=<?= $customer_id ?>">Cancel</a>
</form>
</body>
</html>
<?php
exit;
}
// Step 2: Final confirmation
if ($confirm === 'final') {
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Final Warning</title>
</head>
<body>
<h2>💥 Final Warning</h2>
<p>This will <strong>permanently delete this customer and all their transactions</strong>. Are you absolutely sure?</p>
<form method="post" action="delete_customer.php">
<input type="hidden" name="customer_id" value="<?= $customer_id ?>">
<input type="hidden" name="confirm" value="yes">
<input type="submit" value="?? Yes, DELETE CUSTOMER">
<a href="view_account.php?customer_id=<?= $customer_id ?>">Cancel</a>
</form>
</body>
</html>
<?php
exit;
}
// Step 3: Perform deletion
if ($confirm === 'yes' && $customer_id > 0) {
// Delete current transactions
$stmt = $conn->prepare("DELETE FROM transactions WHERE customer_id = ?");
$stmt->bind_param("i", $customer_id);
$stmt->execute();
// Delete archived transactions
$stmt = $conn->prepare("DELETE FROM archived_transactions WHERE customer_id = ?");
$stmt->bind_param("i", $customer_id);
$stmt->execute();
// Delete customer record
$stmt = $conn->prepare("DELETE FROM customers WHERE id = ?");
$stmt->bind_param("i", $customer_id);
$stmt->execute();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Customer Deleted</title>
</head>
<body>
<h3>✅ Customer and all related data deleted.</h3>
<p><a href="index.php">Back to Dashboard</a></p>
</body>
</html>
<?php
exit;
}
}
echo "Invalid request.";
?>