<?php session_start(); if(!isset($_SESSION['user_id'])){ header("location: ../index.php"); exit; } include('../includes/configuration.php'); if (isset($_GET['id']) && isset($_SESSION['user_id'])) { // Decode the base64-encoded ID $id = base64_decode($_GET['id']); $email = base64_decode($_SESSION['user_id']); // Sanitize the ID to prevent SQL injection $id = mysqli_real_escape_string($conn, $id); $email = mysqli_real_escape_string($conn, $email); // Write the SQL query to delete the record with the provided ID $sql = "DELETE FROM smartCard WHERE id = '$id' AND email = '$email'"; // Execute the query if (mysqli_query($conn, $sql)) { // Success message header("location: ../smart_list.php?msg=success&text=ডাটা ডিলে হয়েছে সফলভবে। "); } else { // Error message header("location: ../smart_list.php?msg=error&text=এই ফাইলটি আপনি ডিলিট করতে পারবেন না"); } } else { // If 'id' is not provided in the URL, redirect to the list page header("location: ../index.php"); } // Close the database connection mysqli_close($conn); ?>