todays minor progress on post.php. since this is one of the most important files this will take a while
This commit is contained in:
parent
e5318a9f1d
commit
9d9e3e2a25
|
@ -34,7 +34,7 @@ function display_board(array $settings) {
|
|||
<p><?php echo $settings['splash'][array_rand($settings['splash'])]; ?></p>
|
||||
<?php if (isset($_SESSION['username'])): ?>
|
||||
<hr>
|
||||
<form action="post.php" method="post" class="input-form">
|
||||
<form action="/post.php" method="post" class="input-form">
|
||||
<table>
|
||||
<tr>
|
||||
<td><b>title:</b></td>
|
||||
|
|
22
post.php
22
post.php
|
@ -1,9 +1,18 @@
|
|||
<?php
|
||||
require_once($path . '/core/database.php');
|
||||
|
||||
//function for image validation
|
||||
function validate_iamge() {
|
||||
}
|
||||
|
||||
// function to handle the creation of a new thread
|
||||
function new_thread(string $board_code, string $title, string $username) {
|
||||
}
|
||||
|
||||
// function to handle the creation of a new post
|
||||
function new_post(int $thread_id, string $message, string $username, string $file_path) {
|
||||
}
|
||||
|
||||
// handle non-post requests
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
echo 'this isn\'t for you!';
|
||||
|
@ -11,13 +20,20 @@ if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
|||
}
|
||||
|
||||
if ($_POST['type'] == 'new_thread') {
|
||||
|
||||
// get the variables from the post request
|
||||
$title = $_POST['title'] or die('invalid request!');
|
||||
$message = $_POST['message'] or die('invalid request!');
|
||||
$upload = $_POST['upload'] or die('invalid request!');
|
||||
|
||||
$message = $_POST['message'] ?? '';
|
||||
|
||||
// get the posters username
|
||||
session_start();
|
||||
$username = $_SESSION['username'] or die('not logged in, nice try.');
|
||||
|
||||
// clean up user input
|
||||
$title = htmlspecialchars($title);
|
||||
$message = htmlspecialchars($message);
|
||||
|
||||
//todo: validate the image and move it into the filesystem
|
||||
|
||||
} elseif ($_POST['type'] == 'thread_reply') {
|
||||
} else {
|
||||
|
|
Loading…
Reference in New Issue