<?php
$deleted = false;
$OK = false;
// if confirm deletion button has been clicked, delete record
if (isset($_POST['delete'])) {
$deleted = unlink('../../newsletter/'.$_GET['file']);
}
if ($deleted || isset($_POST['cancel_delete']) || !isset($_GET['file'])) {
header('Location: /admin/newsletter/index.php');
exit;
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Delete | Admin | Community Education Services | The Family & Community Resource Centre</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/require/head.php');?>
<link href="/professional/education/css/education-admin.css" rel="stylesheet">
</head>
<body>
<div class="wrapper">
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/require/header.php');?>
<section class="middle">
<article style="width: 100%;">
<h2>Community Education Services</h2>
<div class="admin-subtitle">
<h3>Admin Section: Delete File Conformation</h3>
</div>
<p class="warning">Please confirm that you want to delete the following item. This action cannot be undone.</p>
<?php
$file = $_GET['file'];
echo '<p><a href="/newsletter/'.$file.'" target="_blank">'.$file.'</a></p>';
?>
<form id="form1" method="post" action="">
<p>
<?php if(isset($_GET['file'])) { ?>
<!-- <input type="submit" name="delete" value="Confirm Deletion"> -->
<button type="submit" name="delete" id="delete" class="btn btn-warning" >Confirm Deletion</button>
<?php } ?>
<!-- <input name="cancel_delete" type="submit" id="cancel_delete" value="Cancel"> -->
<button type="submit" name="cancel_delete" id="cancel_delete" class="btn btn-danger" >Cancel</button>
<?php if(isset($_GET['file'])) { ?>
<input name="file" type="hidden" value="<?php echo $_GET['file']; ?>">
<?php } ?>
</p>
</form>
</article>
</section><!-- #middle-->
</div><!-- #wrapper -->
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/require/footer.php';?>