blob: 051aaa4dd4d3d75d8ea35de605213a732adb8afc (
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 'header.php';
include_once 'connect.php';
if ($_SERVER['REQUEST_METHOD'] != 'POST') {
echo 'This file cannot be called directly.';
} else {
if (!isset($_SESSION['signed_in'])) {
echo 'You must be signed in to reply to a topic.';
} else {
$sql = "INSERT INTO posts(post_content, post_date, post_topic, post_author) VALUES(
'" . mysqli_real_escape_string($dbc, $_POST['reply_content']) . "',
NOW(),
" . mysqli_real_escape_string($dbc, $_GET['reply_to']) . ",
" . $_SESSION['user_id'] . ")";
$result = mysqli_query($dbc, $sql);
if (!$result) {
echo 'An error occurred trying to reply to the post.' . mysqli_error($dbc);
} else {
echo 'Your reply has been saved, check out <a href="topic.php?id=' . $_GET['reply_to'] . '">the topic</a>.';
}
}
}
include 'footer.php';
?>
|