Ability to post

This is HUUUUUUUGE milestone B)
This commit is contained in:
Lauren Toivanen 2024-12-20 16:41:21 +02:00
parent f717080e8a
commit de4cbe9ee6
Signed by: jt
GPG key ID: 9151B109B73ECAD5
3 changed files with 36 additions and 4 deletions

14
src/post.php Normal file
View file

@ -0,0 +1,14 @@
<?php
if (empty($_POST) || !isset($_POST['submit'])) {
die("Post canceled: no post / no submit");
}
require_once('inc/database.php');
$db = new DataBase();
$userid = $db->getAuthedUserId();
$persid = $_POST['persona']; // TODO: CHECK OWNERSHIP! (db schema?)
if($userid) {
$db->addPost($_POST['text'], $userid, $persid);
}
header("Location: /");
?>