0
0

Refactored the website

Renamed "includes" to "templates"
Added .htaccess to redirect requests to index.php
Added function to split request URL into array
Corrected locations in scripts and pages
This commit is contained in:
Bryan Pedini
2019-02-07 12:36:44 +01:00
parent 9210890eda
commit 7acb2ca533
8 changed files with 173 additions and 138 deletions

26
templates/insert.php Normal file
View File

@@ -0,0 +1,26 @@
<!DOCTYPE html>
<html>
<head>
<title>BJPHoster URL Shortener | Control Panel</title>
</head>
<body>
<button onclick="logout()">Logout</button>
<div id="urllist">
<?php
if ( ! $row ) {
echo ( "You have not created any URL yet.<br>" );
}
else {
do {
echo ( "\t\t\t" . '<div>' . $row [ 'ID' ] . " | " . $row [ 'URL' ] . "</div>\n" );
} while ( $row = $result->fetch_assoc ( ) );
}
?>
</div>
<input type="text" id="form-url" placeholder="URL:">
<button onclick="urlinsert()">Insert new URL</button><br>
<div id="responsetext"></div>
<script src="js/insertnew.js"></script>
<script>var script_name = "<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>";</script>
</body>
</html>

15
templates/login.php Normal file
View File

@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html>
<head>
<title>BJPHoster URL Shortener | Login</title>
</head>
<body>
<input type="text" id="form-username"><br>
<input type="password" id="form-password"><br>
<button onclick="login()">Login</button><br>
<div id="responsetext"></div>
<script src="js/sha512.min.js"></script>
<script src="js/login.js"></script>
<script>var script_name = "<?=substr($_SERVER['SCRIPT_NAME'],0,-10)?>";</script>
</body>
</html>

26
templates/redirect.html Normal file
View File

@@ -0,0 +1,26 @@
<!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>