<?php

session_start();
include '../config/database.php';
include_once '../security/session_config.php';
include_once '../security/csrf.php';
include_once '../config/properties.php';
include_once "../resources/forum.php";

$csrf_token = $_POST['csrf_token'];
validate_csrf_request($csrf_token);

// initialize objects
$forum = new Forum();

$result = FALSE;

$topic_id = $_POST['topic_id'];
$user_id=$_SESSION['uid'];
$forum->topic_id = $topic_id;

if ($forum->delete_question()) {
    $forum->delete_question_spam();
    //Fetch topic name.
    $stmt = $forum->get_forum_topic_name($user_id);
    echo '   <option value="" >All Topics</option>   ';
    while ($row = $stmt->fetch(PDO::FETCH_ASSOC)) {
        echo '   <option  value="' . $row['topic_name'] . '" >' . $row['topic_name'] . '</option>';
    }
}
?>

