Location: PHPKode > projects > ProjectPress > projectpress/projects/forum/delete_pfp.php
<?php
/**
 * ProjectPress project delete form reply
 *
 * @package ProjectPress
 * @since 2.0
 */

// Starts the session.
session_start();

define('access',true);

include(dirname(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');

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="tabs">
					<ul>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "project.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/project.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Project</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "discussions.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>
							<?php if (basename($_SERVER["REQUEST_URI"]) == "add_ptopic.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/forum/discussions.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Forum</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "contact.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/contact.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Email</span></a>
						</li>
						<li <?php if (basename($_SERVER["REQUEST_URI"]) == "project_members.php?p_id=".$_GET['p_id']) echo "class='active_link'";?>>
							<a href="<?php echo PM_URI ?>/projects/project_members.php?p_id=<?php echo $_GET['p_id']; ?>"><span>Members</span></a>
						</li>
					</ul>
				</div>

<div id="middle">				
<?php

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

if($_GET['p_id']) {

    $sql = pmdb::connect()->query("SELECT pfp_post FROM " . DB . "project_forum_posts WHERE p_id = '$id' AND pp_id = '".$_GET['g_id']."' AND pfp_user = '$user'");
    $row_a = $sql->fetch_array();
    
    $sql = "SELECT MAX(p_id) AS Maxp_id FROM " . DB . "project_forum_posts WHERE topic_id='".$_GET['id']."' AND pp_id = '".$_GET['g_id']."'";
	$result = pmdb::connect()->query($sql);
	$r = $result->fetch_array();
    
        //Delete the Forum post and update reply number.
        pmdb::connect()->query("DELETE FROM " . DB . "project_forum_posts WHERE p_id = '$id' AND pp_id = '".$_GET['p_id']."' AND pfp_user = '$user'");        
        
        
				echo '<div class="success">Your message has been deleted.  <a href="' . PM_URI . '/projects/forum/discussions.php?g_id='.$_GET['p_id'].'">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 . '/projects/forum/discussions.php?g_id='.$_GET['p_id'].'">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