From 80d9e02ea47bfb783cc2033162ae9231551e5654 Mon Sep 17 00:00:00 2001 From: "David T. Sadler" Date: Tue, 9 Nov 2021 20:47:01 +0000 Subject: Delete files that are no longer needed --- public/read/index.php | 33 --------------------------------- 1 file changed, 33 deletions(-) delete mode 100644 public/read/index.php (limited to 'public') diff --git a/public/read/index.php b/public/read/index.php deleted file mode 100644 index 74bb4ed..0000000 --- a/public/read/index.php +++ /dev/null @@ -1,33 +0,0 @@ - $config['max_url_length']) { - respondAndExit(400, 'Bad Request'); -} - -$urls = file($config['path_to_file'], FILE_IGNORE_NEW_LINES); - -// Remove requested url from list if present. -$remaingUrls = array_diff($urls, [$requestedUrl]); - -// Count will not have changed if requested url doesn't exist in the list. -if (count($remaingUrls) === count($urls)) { - respondAndExit(404, 'Not Found'); -} - -if (!file_put_contents($config['path_to_file'], implode("\n", $remaingUrls)."\n")) { - respondAndExit(500, 'Internal Server Error'); -} - -respondAndExit(308, 'Permanent Redirect', ["Location: $requestedUrl"]); -- cgit v1.2.3-13-gbd6f