Added licensing, redirected null /go requests to homepage, corrected 404 errors.
This commit is contained in:
parent
7acb2ca533
commit
168f4ece75
32
LICENSE
Normal file
32
LICENSE
Normal file
@ -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?
|
@ -23,13 +23,18 @@
|
|||||||
$result = $statement->get_result ( );
|
$result = $statement->get_result ( );
|
||||||
$row = $result->fetch_assoc ( );
|
$row = $result->fetch_assoc ( );
|
||||||
if ( ! $row ) {
|
if ( ! $row ) {
|
||||||
|
http_response_code ( 404 );
|
||||||
include ( 'errors/404.html' );
|
include ( 'errors/404.html' );
|
||||||
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
include ( 'templates/redirect.html' );
|
include ( 'templates/redirect.html' );
|
||||||
echo ( '<script>var my_location = "' . $row [ 'URL' ] . '";</script>' );
|
echo ( '<script>var my_location = "' . $row [ 'URL' ] . '";</script>' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
header ( "Location: " . substr ( $_SERVER [ 'SCRIPT_NAME' ], 0, -10 ) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case "login":
|
case "login":
|
||||||
if ( isset ( $_SESSION [ 'user_id' ] ) ) {
|
if ( isset ( $_SESSION [ 'user_id' ] ) ) {
|
||||||
@ -113,7 +118,7 @@
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
http_response_code ( 404 );
|
http_response_code ( 404 );
|
||||||
echo "fuck, 404!";
|
include ( 'errors/404.html' );
|
||||||
die ( );
|
die ( );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
16
templates/LICENSE
Normal file
16
templates/LICENSE
Normal file
@ -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.
|
Reference in New Issue
Block a user