<?php
include '../functions.php';

if (isset($_GET['id']) == true) {
	$id = $_GET['id'];

	$seladmin_img = $conn->query("SELECT profile_img FROM administrator WHERE id = '$id' ");
	$sel = mysqli_fetch_array($seladmin_img);
	$admin_img = $sel['profile_img'];

	@unlink("../uploads/profile_pictures/".basename($admin_img));
	$sql = $conn->query("DELETE FROM administrator WHERE id = '$id' ");
	if (isset($sql) == true) {
		echo "<script>alert('User has been deleted Successfully')</script>";
		echo "<script>window.open('members', '_self')</script>";
	}else{
		echo "<script>alert('Failed to delete User')</script>";
		echo "<script>window.open('members', '_self')</script>";
	}
}
?>