started the post handler

This commit is contained in:
hayden 2019-07-05 07:07:38 -05:00
parent d938bbd2dd
commit 7bbac7a0c4
2 changed files with 16 additions and 5 deletions

View File

@ -10,7 +10,7 @@ function display_board(array $settings) {
'splash' => array(
'splash 1',
'splash 2',
'splash 3'
'splash 3'
)
);
@ -23,14 +23,16 @@ function display_board(array $settings) {
require_once($path . '/core/database.php');
display_header('~chan - /' . $settings['code'] . '/');
session_start();
?>
<div style="
margin: auto;
width: 40%;
padding-top: 100px;
padding-top: 50px;
">
<h1><?php echo '/' . $settings['code'] . '/ - ' . $settings['title'];?></h1>
<h1><?php echo '/' . $settings['code'] . '/ - ' . $settings['title']; ?></h1>
<p><?php echo $settings['splash'][array_rand($settings['splash'])]; ?></p>
<?php if (isset($_SESSION['username'])): ?>
<hr>
<form action="login.php" method="post" class="input-form">
<table>
@ -52,16 +54,17 @@ function display_board(array $settings) {
<input name="upload" type="file" required>
</td>
</tr>
<input type="hidden" name="board_code" value="<?php echo $settings['code']; ?>">
</table>
<br>
<button type="submit">post</button>
</form>
<?php endif; ?>
<hr>
<b>(<a href="#">archive</a>) (<a href="#">catalog</a>)</b>
<hr>
</div>
<?php
echo '</div>';
}
?>

8
post.php Normal file
View File

@ -0,0 +1,8 @@
<?php
// handle non-post requests
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
echo 'this isn\'t for you!';
header('refresh:1; url=/');
}