37237-vm/delete_process.php
Flatlogic Bot e1227cfbcd mvp.4
2026-01-02 11:42:24 +00:00

27 lines
795 B
PHP

<?php
require_once 'db/config.php';
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['id'])) {
$id = filter_var($_POST['id'], FILTER_SANITIZE_NUMBER_INT);
try {
$pdo = db();
$stmt = $pdo->prepare("DELETE FROM processes WHERE id = :id");
$stmt->bindParam(':id', $id, PDO::PARAM_INT);
if ($stmt->execute()) {
header('Location: index.php?success=processdeleted');
exit();
} else {
header('Location: index.php?error=deletionfailed');
exit();
}
} catch (PDOException $e) {
error_log("DB Error: " . $e->getMessage());
header('Location: index.php?error=dberror');
exit();
}
} else {
header('Location: index.php?error=invalidrequest');
exit();
}
?>