ok
Direktori : /home2/selectio/public_html/wedding-info-new/api/ |
Current File : /home2/selectio/public_html/wedding-info-new/api/delete.php |
<?php include_once('config/config.php'); session_start(); error_log('Script started...'.$_SESSION['user']['id']); if ($_SERVER["REQUEST_METHOD"] == "POST" ) { // Sanitize and validate input data $feedback = $_POST['feedback']; $reason = $_POST['reason']; $ids = $_POST['ids']; // $name = $_SESSION['user']['name']; try { // Prepare SQL statement $statement = $pdo->prepare("INSERT INTO `tbl_delete` ( `feedback`, `reason`) VALUES ( ?, ?)"); $result = $statement->execute([$feedback,$reason]); error_log("DELETE FROM `tbl_alliances_register` where id = ".$ids); $statement1 = $pdo->prepare("DELETE FROM `tbl_alliances_register` where id = ".$ids); $result1 = $statement1->execute(); echo json_encode(["success" => true, "message" => "User accounts deactivated successfully"]); } catch (PDOException $e) { echo json_encode(["success" => false, "message" => "Error deactivating users: " . $e->getMessage()]); } finally { // Close the connection $pdo = null; } } else { // Handle invalid request or session data echo json_encode(["success" => false, "message" => "Invalid request"]); } ?>