<?php include('data/config.php'); ?>
<?php include('layout/header.php'); ?>
<table width="900" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td><?php
echo '<table width="100%" cellpadding="5" class="maintable">
<tr>
<td>';
if($_SERVER['REQUEST_METHOD'] != 'POST') {
echo '<br /><p align="center" class="false"> This page can not be called directly.</p><br />';
}else{
include_once('data/secure.php');
$idb = htmlentities($_GET['id']);
if (sha1($_POST["zip"]) != $_POST["zip2"]) {
echo '<br /><p class="false"> The Spam protection result is incorrect!</p>
<p> [ <a href="topic.php?id=' . $idb . '">Back</a> ]</p><br />';
}else{
if(!$_SESSION['signed_in']) {
echo '<br /><p class="false"> You are not <a href="signin.php">signed in</a></p><br />';
}else{
$errors = array();
if(isset($_POST['reply']))
{
if(trim($_POST['reply']) == "")
{
$errors[] = '<p> You did not enter a text.</p><br />';
}
}else{
$errors[] = '<p> The response field was not filled.</p><br />';
}
if(!empty($errors))
{
echo '<br /><p class="false"> You have not filled in all the fields correctly</p>
<p> [ <a href="topic.php?id=' . $idb . '">Back</a> ]</p><br />';
echo '<ul>';
foreach($errors as $key => $value)
{
echo '<li>' . $value . '</li>';
}
echo '</ul>';
}else{
$sql = "INSERT INTO
posts(post_content,
post_date,
post_topic,
post_by)
VALUES ('" . $_POST['reply'] . "',
NOW(),
'" . mysql_real_escape_string($_GET['id']) . "',
'" . $_SESSION['user_id'] . "')";
$result = mysql_query($sql);
if(!$result) {
echo '<br /><p class="false"> Your answer could not be entered - Try again.</p><br />';
}else{
$autoforward = 3;
echo '<br /><p class="right"> Your reply message has successfully entered!</strong></p>';
echo '<p><meta http-equiv="refresh" content="' . $autoforward . '; URL=topic.php?id=' . htmlentities($_GET['id']) . '">' .
' <small>You will be redirected in ' . $autoforward . ' seconds...</small></p><br />';
echo '<p> If you are not redirected - [ <a href="topic.php?id=' . htmlentities($_GET['id']) . '">Your Reply</a> ]</p><br />';
echo '</td></tr>';
}
}
}
}
}
echo '</table>';
?></td>
</tr>
<tr>
<td><?php include('layout/infobox.php'); ?></td>
</tr>
</table>
<?php include('layout/footer.php'); ?>