<?php
/**
* ProjectPress delete news
*
* @package ProjectPress
* @since 2.0
*/
// Starts the session.
session_start();
define('access',true);
include(dirname(dirname(__FILE__)) . '/config.inc.php');
include(PM_DIR . 'pm-includes/global.inc.php');
require(PM_DIR . 'pm-includes/functions.php');
include(PM_DIR . 'pm-includes/header.php');
// User is logged in and is an admin.
is_admin();
// Enable for error checking and troubleshooting.
//display_errors();
?>
<div id="middle">
<?php
$id = $_GET['id'];
$username = $_SESSION['username'];
//Delete the news posting.
pmdb::connect()->query("DELETE FROM ". DB ."news WHERE newsid='$id' AND author = '$username'");
if($_GET) {
echo '<div class="success">Your news posting has been deleted. <a href="' . PM_URI . '/news/news.php">Click here</a> to go back to your the main news page.</div>';
} else {
echo '<div class="error">You forgot to choose a news posting to delete. <a href="' . PM_URI . '/news/news.php">Click here</a> to go back to the main news page and try again.</div>';
}
?>
</div>
<?php
include(PM_DIR . 'pm-includes/footer.php');