blob: 3b8d05dfd3a2375f39fdb047a676acf586fe78ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
<?php
include_once './includes/db_inc.php';
include_once './includes/functions_thread.php';
include_once './includes/Session.php';
include_once './includes/model/User.php';
session_start();
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$thread_id = filter_input(INPUT_POST, 'id', FILTER_SANITIZE_NUMBER_INT);
$delete = filter_input(INPUT_POST, "delete", FILTER_SANITIZE_STRING);
$user = Session::get()->get_current_user();
if ($user->level == USER_LEVEL_MODERATOR) {
if (strcasecmp($delete, "on") == 0) {
$thread = new Thread();
$thread->get_from_database($thread_id, $dbc);
delete_thread($thread);
header("Location: /");
exit();
}
}
header("Location: viewthread.php?id=$thread_id");
exit();
}
header("Location: /");
|