<?php ob_start(); ?>
<?php include_once('includes/header.php'); ?>

<?php

if (isset($_GET['id'])) {
	$ID = clean($_GET['id']);
} else {
	$ID = clean("");
}

if (validateResourceAccess($inputToken)) {

	// get image file from table
	$sql = "SELECT icon FROM tbl_social WHERE id = '$ID'";
	$result = $connect->query($sql);
	$row = $result->fetch_assoc();

	$icon = $row['icon'];

	// delete data from menu table
	$sql_delete = "DELETE FROM tbl_social WHERE id = '$ID'";
	$delete = $connect->query($sql_delete);

	// if delete data success
	if ($delete) {
		$delete_image = unlink('upload/social/'.$icon);
		$_SESSION['msg'] = "Social deleted successfully...";
		header( "Location: social.php");
		exit;
	}

} else {
	systemUpdateFlag($invalidResponse);
}

?>

<?php include_once('includes/footer.php'); ?>