From ea1269577fcd9d9b05f4b29ae2ad0d7c4c9a6ca2 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Thu, 8 Jul 2021 21:47:20 +0100 Subject: Shorten urls --- public/add/index.php | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 public/add/index.php (limited to 'public/add/index.php') diff --git a/public/add/index.php b/public/add/index.php new file mode 100644 index 0000000..12119b6 --- /dev/null +++ b/public/add/index.php @@ -0,0 +1,38 @@ + $config['max_url_length']) { + respondAndExit(400, 'Bad Request'); +} + +if (!file_put_contents($config['path_to_file'], "$url\n", FILE_APPEND)) { + respondAndExit(500, 'Internal Server Error'); +} + +respondAndExit(201, 'Created'); -- cgit v1.2.3-13-gbd6f