From a273843dd7dea053e9d8ca91775a4f0d6d60eee2 Mon Sep 17 00:00:00 2001 From: Banana Date: Sat, 21 Dec 2019 21:15:37 +0100 Subject: [PATCH] message if requested paste was not found --- documentation/security.txt | 4 +++- webroot/index.php | 3 +++ webroot/view/view.inc.php | 3 +++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/documentation/security.txt b/documentation/security.txt index 1ddae39..1cf218b 100644 --- a/documentation/security.txt +++ b/documentation/security.txt @@ -23,4 +23,6 @@ So, here is a friendly REMINDER: - Check regularly what is added - Clean everything what you do not know - You provide the service by hosting it. Your are responsible for it! - - Change your secret often \ No newline at end of file + - Change your secret often + +Make sure DEBUG is false for production. \ No newline at end of file diff --git a/webroot/index.php b/webroot/index.php index 7ebb536..a390cd4 100644 --- a/webroot/index.php +++ b/webroot/index.php @@ -64,11 +64,14 @@ $httpResponseCode = 200; if(!empty($_short)) { $contentType = 'Content-type: text/plain; charset=UTF-8'; $contentView = 'view'; + $httpResponseCode = 404; + $contentBody = 'File not found.'; $_requestFile = Summoner::createStoragePath($_short); $_requestFile .= $_short; if(is_readable($_requestFile)) { $contentBody = $_requestFile; + $httpResponseCode = 200; } } elseif ($_create === true) { diff --git a/webroot/view/view.inc.php b/webroot/view/view.inc.php index 38b06de..3a85ae5 100644 --- a/webroot/view/view.inc.php +++ b/webroot/view/view.inc.php @@ -15,4 +15,7 @@ if (file_exists($contentBody)) { header('Pragma: public'); readfile($contentBody); exit; +} +else { + echo $contentBody; } \ No newline at end of file -- 2.39.5