From: Banana Date: Sat, 21 Dec 2019 20:15:37 +0000 (+0100) Subject: message if requested paste was not found X-Git-Tag: v0.2-beta~7 X-Git-Url: http://91.132.146.200/gitweb/?a=commitdiff_plain;h=a273843dd7dea053e9d8ca91775a4f0d6d60eee2;p=selfpaste.git message if requested paste was not found --- 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