From 0f273c0a8ead390346571c4be2296fa6e384eff6 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Thu, 7 Oct 2021 21:31:17 +0100 Subject: Add bookmarks --- public/add/index.php | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'public/add/index.php') diff --git a/public/add/index.php b/public/add/index.php index 12119b6..11ce9bb 100644 --- a/public/add/index.php +++ b/public/add/index.php @@ -1,38 +1,33 @@ - $config['max_url_length']) { - respondAndExit(400, 'Bad Request'); + $bookmarks->add($bookmark); } -if (!file_put_contents($config['path_to_file'], "$url\n", FILE_APPEND)) { - respondAndExit(500, 'Internal Server Error'); -} +$html = $template->render('add'); -respondAndExit(201, 'Created'); +respondAndExit(200, 'OK', $html); -- cgit v1.2.3-13-gbd6f