Create New Item
×
Item Type
File
Folder
Item Name
×
Search file in folder and subfolders...
File Manager
/
admin
Advanced Search
Upload
New Item
Settings
Back
Back Up
Advanced Editor
Save
<?php include('authentication.php'); //to check authorized user if(isset($_POST['location_delete'])) { $location_id = $_POST['location_delete']; // $query = "Delete from location WHERE id = '$location_id' LIMIT 1"; //2 deleted // $query_run = mysqli_query($con, $query); $stmt = $conn->prepare("Delete from location WHERE id = ? LIMIT 1"); $stmt->bind_param("i", $location_id); $stmt->execute(); if($stmt) { $_SESSION['message'] ="location Deleted Successfully"; header('Location: location-view.php'); exit(0); }else{ $_SESSION['message'] ="Something Went Wrong"; header('Location: location-view.php'); exit(0); } } //to check super admin include('middleware/superadminAuth.php'); if(isset($_POST['category_delete'])) { $category_id = $_POST['category_delete']; $status = 2; $stmt = $conn->prepare("UPDATE categories SET status = ? WHERE id = ?"); $stmt->bind_param('si', $status, $category_id); $stmt->execute(); $stmt->close(); // $query = "UPDATE categories SET status ='2' WHERE id = '$category_id' LIMIT 1"; //2 deleted // $query_run = mysqli_query($con, $query); if($stmt) { $_SESSION['message'] ="Category Deleted Successfully"; header('Location: category-view.php'); exit(0); }else{ $_SESSION['message'] ="Something Went Wrong"; header('Location: category-view.php'); exit(0); } } if(isset($_POST['service_detete_btn'])) { // $service_id= $_POST['service_detete_btn']; $find_sql = "SELECT * FROM services WHERE id = ? LIMIT 1"; $stmt = $conn->prepare($find_sql); $stmt->bind_param("s", $_POST['service_detete_btn']); // Assuming modal_id is a string. Use "i" for integer. $stmt->execute(); $result = $stmt->get_result(); // $check_img_query = "SELECT * FROM services WHERE id ='$service_id' LIMIT 1"; // $img_res = mysqli_query($con, $check_img_query); $res_data = mysqli_fetch_array($result); $image = $res_data['image']; $icon = $res_data['icon']; $find_sql = "DELETE from services WHERE id = ? LIMIT 1"; $stmt = $conn->prepare($find_sql); $stmt->bind_param("s", $_POST['service_detete_btn']); // Assuming modal_id is a string. Use "i" for integer. $stmt->execute(); // $result = $stmt->get_result(); // $query = "DELETE from services WHERE id = '$service_id' LIMIT 1"; // $query_run = mysqli_query($con, $query); if($stmt) { if(file_exists('../uploads/service/'.$image)) { unlink('../uploads/service/'.$image); } if(file_exists('../uploads/service/'.$icon)) { unlink('../uploads/service/'.$icon); } $_SESSION['message'] = "Service Deleted Successfully"; header('Location: service-view.php'); exit(0); }else{ $_SESSION['message'] = "Something Went Wrong"; header('Location: service-view.php'); exit(0); } } //merchant delete if(isset($_POST['merchant_detete_btn'])) { $find_sql = "SELECT * FROM merchant_card WHERE id = ? LIMIT 1"; $stmt = $conn->prepare($find_sql); $stmt->bind_param("s", $_POST['merchant_detete_btn']); // Assuming modal_id is a string. Use "i" for integer. $stmt->execute(); $result = $stmt->get_result(); // $check_img_query = "SELECT * FROM services WHERE id ='$service_id' LIMIT 1"; // $img_res = mysqli_query($con, $check_img_query); $res_data = mysqli_fetch_array($result); $image = $res_data['image']; // $icon = $res_data['icon']; $find_sql = "DELETE from merchant_card WHERE id = ? LIMIT 1"; $stmt = $conn->prepare($find_sql); $stmt->bind_param("s", $_POST['merchant_detete_btn']); // Assuming modal_id is a string. Use "i" for integer. $stmt->execute(); // $result = $stmt->get_result(); // $query = "DELETE from services WHERE id = '$service_id' LIMIT 1"; // $query_run = mysqli_query($con, $query); if($stmt) { if(file_exists('../'.$image)) { unlink('../'.$image); } $_SESSION['message'] = "Merchant Deleted Successfully"; header('Location: merchant-view.php'); exit(0); }else{ $_SESSION['message'] = "Something Went Wrong"; header('Location: merchant-view.php'); exit(0); } } if(isset($_POST['page_detete_btn'])) { $find_sql = "SELECT * FROM pages WHERE id = ? LIMIT 1"; $stmt = $conn->prepare($find_sql); $stmt->bind_param("s", $_POST['page_detete_btn']); // Assuming modal_id is a string. Use "i" for integer. $stmt->execute(); $result = $stmt->get_result(); /* $page_id= $_POST['page_detete_btn']; $check_img_query = "SELECT * FROM pages WHERE id ='$page_id' LIMIT 1"; $img_res = mysqli_query($con, $check_img_query);*/ $res_data = mysqli_fetch_array($result); $image = $res_data['image']; $icon = $res_data['icon']; $find_sql = "DELETE from pages WHERE id = ? LIMIT 1"; $stmt = $conn->prepare($find_sql); $stmt->bind_param("s", $_POST['page_detete_btn']); // Assuming modal_id is a string. Use "i" for integer. $stmt->execute(); // $query = "DELETE from pages WHERE id = '$page_id' LIMIT 1"; // $query_run = mysqli_query($con, $query); if($stmt) { if(file_exists('../uploads/page/'.$image)) { unlink('../uploads/page/'.$image); } if(file_exists('../uploads/page/'.$icon)) { unlink('../uploads/page/'.$icon); } $_SESSION['message'] = "Page Deleted Successfully"; header('Location: page-view.php'); exit(0); }else{ $_SESSION['message'] = "Something Went Wrong"; header('Location: page-view.php'); exit(0); } } ?>