Location: PHPKode > projects > ProjectPress > projectpress/forum/delete.php
<?php
/**
 * ProjectPress delete forum reply
 *
 * @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');
    
// Checks if user is logged in; if not redirect to login page.
if($current_user->hasPermission('access_site') != true) { pm_redirect(PM_URI . '/index.php'); }

// Enable for error checking and troubleshooting.
# display_errors();

?>

				<div id="page-title">
					<img src="<?php echo PM_URI; ?>/images/comment.png" alt="" /><h1>Forum</h1>
				</div>

<div id="middle">			
<?php

$user = $_SESSION['username'];
$id = $_GET['a_id'];

if($_GET['a_id']) {

    $sql = pmdb::connect()->query ("SELECT a_answer FROM ". DB ."forum_answer WHERE a_user = '$user' AND a_id = '$id'");
    $row_a = $sql->fetch_array();
        //Delete the Forum Answer
        pmdb::connect()->query("DELETE FROM ". DB ."forum_answer WHERE a_id = '$id' AND a_user = '$user'");
        
				echo '<div class="success">Your message has been deleted.  <a href="' . PM_URI . '/forum/">Click here</a> to go back to your the main forum.</div>';
				} else {
				echo '<div class="error">You forgot to choose a message to delete.  <a href="' . PM_URI . '/forum/">Click here</a> to go back to the main forum and try again.</div>';
				}
?>

</div>

<?php

include(PM_DIR . 'pm-includes/footer.php');
Return current item: ProjectPress