diff --git a/docs/index.php b/docs/index.php index b65d8ac..16b242b 100644 --- a/docs/index.php +++ b/docs/index.php @@ -10,9 +10,19 @@ global $db; if (!$username) return; if (!array_key_exists('post',$_POST)) return; + + $postie = $_POST['post']; + + if (strlen($postie) < 1 || strlen($postie) > 1024) { + return 'Post is too long or short.'; + } + $stmt = $db->prepare("INSERT INTO main.comment (username, targetType, targetId, date, content, id) VALUES (?,?,?,?,?,?)"); $stmt->execute([$username,"root","root",microtime(true) - $ref,$postie,bin2hex(random_bytes(16))]); + + header("Location: " . $_SERVER["REQUEST_URI"]); + die(); } page_header();