summaryrefslogtreecommitdiff
path: root/includes/reply_inc.php
blob: 588b59fcbb1cdd47fce47e1c8e4031c473bc6296 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<?php
include_once 'functions_post.php';

session_start();

if ($_SERVER['REQUEST_METHOD'] != 'POST') {
	die('This file cannot be called directly.');
} 

if (!isset($_SESSION['signed_in'])) {
	die('You must be signed in to reply to a thread.');
} 

$reply_content = filter_input(INPUT_POST, 'reply_content', FILTER_SANITIZE_STRING);
$thread_id = filter_input(INPUT_POST, 'reply_to', FILTER_SANITIZE_NUMBER_INT);

$thread = new Thread();
$thread->get_from_database($thread_id);

create_post($reply_content, $thread_id, $thread->category);

header("Location: ../thread.php?id=" . $_GET['reply_to']);