<?php
/**
 * Created by PhpStorm.
 * User: jaskokoyn
 * Date: 2/20/2015
 * Time: 2:01 PM
 */

include( '../../inc/db.php' );
include( '../../inc/functions.php' );

if(!isset($_SESSION['loggedin']) || $user['mem_level'] != 2){
    die("AYYYYYY");
}

if( !isReady($_POST, array( "mid" ) ) ){
    die( "EMPTY" );
}

$mid  =   secure($_POST['mid']);

$delMessageQuery    =   $db->prepare("DELETE FROM messages WHERE id = :id");
$delMessageQuery->execute(array(
    ":id"        =>  $mid
));

die("SUCCESS");