From 168f4ece7532cbb4ff3af2f2debceeb6791f0d45 Mon Sep 17 00:00:00 2001 From: Bryan Pedini Date: Fri, 8 Feb 2019 10:14:22 +0100 Subject: [PATCH] Added licensing, redirected null /go requests to homepage, corrected 404 errors. --- LICENSE | 32 ++++++++++++++++++++++++++++++++ index.php | 7 ++++++- templates/LICENSE | 16 ++++++++++++++++ 3 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 LICENSE create mode 100644 templates/LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..66321ef --- /dev/null +++ b/LICENSE @@ -0,0 +1,32 @@ +OpenShorte - An open source URL shortener +Copyright © 2019 - Bryan Pedini + +This program is licensed per section, +please read carefully every LICENSE file provided +to fully understand what you can do and what not. + + +errors/* - js/* - functions.php - index.php: +Copyright © 2019 - Bryan Pedini + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. + + +config.php: +It's a stupid config file, do you really think I want to +beat my head to decide what license is it under or to +create one? Use it to do whatever you want, it may break +the website or it may not, it's up to you and the fact that +it is provided empty. +Only a suggestion: if you don't populate the config file, +what part of the website you think that will work properly? \ No newline at end of file diff --git a/index.php b/index.php index e605204..935c9b4 100644 --- a/index.php +++ b/index.php @@ -23,13 +23,18 @@ $result = $statement->get_result ( ); $row = $result->fetch_assoc ( ); if ( ! $row ) { + http_response_code ( 404 ); include ( 'errors/404.html' ); + exit; } else { include ( 'templates/redirect.html' ); echo ( '' ); } } + else { + header ( "Location: " . substr ( $_SERVER [ 'SCRIPT_NAME' ], 0, -10 ) ); + } break; case "login": if ( isset ( $_SESSION [ 'user_id' ] ) ) { @@ -113,7 +118,7 @@ break; default: http_response_code ( 404 ); - echo "fuck, 404!"; + include ( 'errors/404.html' ); die ( ); } } diff --git a/templates/LICENSE b/templates/LICENSE new file mode 100644 index 0000000..2cd9da9 --- /dev/null +++ b/templates/LICENSE @@ -0,0 +1,16 @@ +Copyright © 2019 - Bryan Pedini + +Every file within this folder and it's subfolders is provided +with the website for the correct work of the website itself, +is provided AS IS, comes with NO WARRANTY of scope or +working purposes, and is proprietary software. + +Such this code may not be copied without explicit permission from +myself only, this code may not be modified within the website, +you may not copy, edit, share, clone or do anything else but +use the code as is without explicit permission to do so. + +Such permissions can be requested at copyright@bryanpedini.it +No permissions to do anything against this license is given +without an explicit and valid motivation to do so, so please +don't email me asking to do so or so without providing why. \ No newline at end of file