Website refactoring
Moved PHP files to "lib" folder Moved Javascript files to "lib" folder Moved login page inline CSS to "login.css" Moved database functions to class "Database" Removed the html template, compensated with a direct HTML code inside PHP "else" statement
This commit is contained in:
parent
5a75d5335e
commit
18dc9b18d3
@ -4,7 +4,6 @@ body {
|
|||||||
.login-container{
|
.login-container{
|
||||||
margin-top: 5%;
|
margin-top: 5%;
|
||||||
margin-bottom: 5%;
|
margin-bottom: 5%;
|
||||||
margin-left: 30%;
|
|
||||||
}
|
}
|
||||||
.login-form-1{
|
.login-form-1{
|
||||||
padding: 5%;
|
padding: 5%;
|
||||||
@ -19,8 +18,8 @@ body {
|
|||||||
}
|
}
|
||||||
.btnSubmit
|
.btnSubmit
|
||||||
{
|
{
|
||||||
width: 50%;
|
width: 40%;
|
||||||
border-radius: 1rem;
|
border-radius: 2rem;
|
||||||
padding: 1.5%;
|
padding: 1.5%;
|
||||||
border: none;
|
border: none;
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
0
js/sha512.min.js → lib/js/sha512.min.js
vendored
0
js/sha512.min.js → lib/js/sha512.min.js
vendored
@ -18,12 +18,38 @@
|
|||||||
$row = $result->fetch_assoc ( );
|
$row = $result->fetch_assoc ( );
|
||||||
if ( ! $row ) {
|
if ( ! $row ) {
|
||||||
http_response_code ( 404 );
|
http_response_code ( 404 );
|
||||||
include ( 'errors/404.html' );
|
include ( $config [ 'installation_path' ] . '/lib/errors/404.html' );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
include ( 'templates/redirect.html' );
|
?>
|
||||||
echo ( '<script>var my_location = "' . $row [ 'URL' ] . '";</script>' );
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title id="title">Redirect in 5 seconds</title>
|
||||||
|
<link href="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/favicon.ico" rel="icon" type="image/x-icon">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<center>
|
||||||
|
<h1>You will be redirected to <?=$row['URL']?> in <span id="body-timeout">5</span></h1>
|
||||||
|
</center>
|
||||||
|
<script>
|
||||||
|
window.onload = function() {
|
||||||
|
var seconds = 5;
|
||||||
|
function update_timeout (interval) {
|
||||||
|
document.getElementById("title").innerHTML = "Redirect in "+seconds+" seconds";
|
||||||
|
document.getElementById("body-timeout").innerHTML = seconds;
|
||||||
|
if (seconds == 0) {
|
||||||
|
window.location.href = "<?=$row['URL']?>";
|
||||||
|
clearInterval (interval);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
interval = setInterval (function() {update_timeout(interval); seconds = seconds - 1;}, 1000);
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
|
<?php
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -37,6 +37,7 @@
|
|||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>BJPHoster URL Shortener | Control Panel</title>
|
<title>BJPHoster URL Shortener | Control Panel</title>
|
||||||
|
<link href="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/favicon.ico" rel="icon" type="image/x-icon">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<button onclick="logout()">Logout</button>
|
<button onclick="logout()">Logout</button>
|
||||||
@ -55,7 +56,7 @@
|
|||||||
<input type="text" id="form-url" placeholder="URL:">
|
<input type="text" id="form-url" placeholder="URL:">
|
||||||
<button onclick="urlinsert()">Insert new URL</button><br>
|
<button onclick="urlinsert()">Insert new URL</button><br>
|
||||||
<div id="responsetext"></div>
|
<div id="responsetext"></div>
|
||||||
<script src="js/insertnew.js"></script>
|
<script src="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/lib/js/insertnew.js"></script>
|
||||||
<script>var script_name = "<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>";</script>
|
<script>var script_name = "<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>";</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -3,8 +3,8 @@
|
|||||||
header ( "Location: " . substr ( $_SERVER [ 'SCRIPT_NAME' ], 0, -10 ) . "/insert" );
|
header ( "Location: " . substr ( $_SERVER [ 'SCRIPT_NAME' ], 0, -10 ) . "/insert" );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if ( isset ( $session [ 1 ] ) && $session [ 1 ] == "forgot" ) {
|
if ( isset ( $request [ 1 ] ) && $request [ 1 ] == "forgot" ) {
|
||||||
include ( $config [ 'installation_path ' ] . '/lib/php/forgotpassword.php' );
|
include ( $config [ 'installation_path' ] . '/lib/php/forgot.php' );
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
if ( isset ( $_POST [ 'username' ] ) && isset ( $_POST [ 'password' ] ) ) {
|
if ( isset ( $_POST [ 'username' ] ) && isset ( $_POST [ 'password' ] ) ) {
|
||||||
@ -49,7 +49,7 @@
|
|||||||
<title>BJPHoster URL Shortener | Login</title>
|
<title>BJPHoster URL Shortener | Login</title>
|
||||||
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link href="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/lib/css/login.css" rel="stylesheet">
|
<link href="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/lib/css/login.css" rel="stylesheet">
|
||||||
<link href="favicon.ico" rel="icon" type="image/x-icon">
|
<link href="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/favicon.ico" rel="icon" type="image/x-icon">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div class="container login-container">
|
<div class="container login-container">
|
||||||
@ -74,8 +74,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
|
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.1/js/bootstrap.min.js"></script>
|
||||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
|
||||||
<script src="js/sha512.min.js"></script>
|
<script src="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/lib/js/sha512.min.js"></script>
|
||||||
<script src="js/login.js"></script>
|
<script src="<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>/lib/js/login.js"></script>
|
||||||
<script>var script_name = "<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>";</script>
|
<script>var script_name = "<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>";</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
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.
|
|
@ -1,26 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title id="title">Redirect in 5 seconds</title>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<center>
|
|
||||||
<h1>You will be redirected to <span id="redirect-url"></span> in <span id="body-timeout">5</span></h1>
|
|
||||||
</center>
|
|
||||||
<script>
|
|
||||||
window.onload = function() {
|
|
||||||
var seconds = 5;
|
|
||||||
document.getElementById("redirect-url").innerHTML = my_location;
|
|
||||||
function update_timeout (interval) {
|
|
||||||
document.getElementById("title").innerHTML = "Redirect in "+seconds+" seconds";
|
|
||||||
document.getElementById("body-timeout").innerHTML = seconds;
|
|
||||||
if (seconds == 0) {
|
|
||||||
window.location.href = my_location;
|
|
||||||
clearInterval (interval);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
interval = setInterval (function() {update_timeout(interval); seconds = seconds - 1;}, 1000);
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
Reference in New Issue
Block a user