2024-01-04 15:02:57 +00:00
|
|
|
<?php
|
|
|
|
$return = $_GET["return"];
|
|
|
|
?>
|
2024-07-08 09:20:49 +00:00
|
|
|
<hr>
|
2024-01-04 15:02:57 +00:00
|
|
|
<h2>Comments</h2>
|
|
|
|
<form action="/blog/comment/submit.php" method="post" autocomplete="off">
|
|
|
|
<?php echo "<input type='text' name='entry' value='".preg_replace("/^.*\//","",getcwd())."' style='display: none;' readonly>"; ?>
|
|
|
|
<table>
|
|
|
|
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<td><input type="text" name="name" placeholder="Name"></td>
|
|
|
|
<td><input type="text" name="botcheck" placeholder="Bot test (type "isopod")"></td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td colspan="2"><textarea name="message" placeholder="Comment"></textarea></td>
|
|
|
|
</tr>
|
|
|
|
|
|
|
|
<tr>
|
|
|
|
<?php
|
|
|
|
switch ($return) {
|
|
|
|
case 'noname':
|
|
|
|
echo "<td><span class='error'>Name required!</span></td>";
|
|
|
|
break;
|
|
|
|
case 'nomessage':
|
|
|
|
echo "<td><span class='error'>Message required!</span></td>";
|
|
|
|
break;
|
|
|
|
case 'botcheckfailed':
|
|
|
|
echo "<td><span class='error'>You failed the bot check!</span></td>";
|
|
|
|
break;
|
|
|
|
case 'success':
|
|
|
|
echo "<td><span class='success'>Successfully posted!</span></td>";
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
echo "<td></td>";
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
<td style="text-align: right;"><input type="submit" value="Post"></td>
|
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
</form>
|
|
|
|
<?php
|
|
|
|
$totaloutput = "";
|
|
|
|
$postlist = json_decode(file_get_contents("../../comment/posts.json"));
|
|
|
|
foreach($postlist as $post) {
|
|
|
|
if ($post->entry == preg_replace("/^.*\//","",getcwd())) {
|
|
|
|
$output = "";
|
|
|
|
$date = date("Y-m-d h:iA", $post->date);
|
|
|
|
$name = $post->name;
|
|
|
|
$message = $post->message;
|
|
|
|
|
|
|
|
$output = $output."<hr><article><table><tr><td style='text-align: left;'>".$name."</td><td style='text-align: right;'>".$date."</td></tr><tr><td colspan='2'>".$message."</td></tr></table></article>";
|
|
|
|
$totaloutput = $output.$totaloutput;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
echo $totaloutput; ?>
|