snuffler-web/src/post.php
Jarkko Toivanen de4cbe9ee6
Ability to post
This is HUUUUUUUGE milestone B)
2024-12-20 16:41:21 +02:00

14 lines
351 B
PHP

<?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: /");
?>