| 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 : |
<?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') {
?>
<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>
<?php
exit;
}
// Step 2: Final confirmation
if ($confirm === 'final') {
?>
<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>
<?php
exit;
}
// Step 3: Delete
if ($confirm === 'yes' && $customer_id > 0) {
// Delete transactions
$stmt = $conn->prepare("DELETE FROM transactions WHERE customer_id = ?");
$stmt->bind_param("i", $customer_id);
$stmt->execute();
// Delete customer
$stmt = $conn->prepare("DELETE FROM customers WHERE id = ?");
$stmt->bind_param("i", $customer_id);
$stmt->execute();
echo "<h3>? Customer and all related data deleted.</h3>";
echo "<p><a href='index.php'>Back to Dashboard</a></p>";
exit;
}
}
echo "Invalid request.";