0
0

Minor bug fixes, added URL link on redirect page.

This commit is contained in:
Bryan Pedini 2019-02-07 11:51:47 +01:00
parent 9e8f7ed464
commit 9210890eda
No known key found for this signature in database
GPG Key ID: 688D440AE31B40C2
4 changed files with 17 additions and 11 deletions

View File

@ -5,18 +5,22 @@
</head>
<body>
<center>
<h1 id="body-timeout">You will be redirected to ... in 5</h1>
<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;
function update_timeout () {
document.getElementById("redirect-url").innerHTML = my_location;
function update_timeout (interval) {
document.getElementById("title").innerHTML = "Redirect in "+seconds+" seconds";
document.getElementById("body-timeout").innerHTML = "You will be redirected to ... in "+seconds;
document.getElementById("body-timeout").innerHTML = seconds;
if (seconds == 0) {
window.location.href = my_location;
clearInterval (interval);
}
}
setInterval (function() {update_timeout(); seconds = seconds - 1;}, 1000);
interval = setInterval (function() {update_timeout(interval); seconds = seconds - 1;}, 1000);
}
</script>
</body>
</html>

View File

@ -60,7 +60,7 @@
elseif ( isset ( $_GET [ 'logout' ] ) ) {
$_SESSION = array ( );
session_destroy ( );
header ( "Location: /" );
header ( "Location: " . $_SERVER [ 'SCRIPT_NAME' ] );
}
else {
if ( ! isset ( $_SESSION [ 'user_id' ] ) ) {
@ -77,6 +77,7 @@
<div id="responsetext"></div>
<script src="js/sha512.min.js"></script>
<script src="js/login.js"></script>
<script>var script_name = "<?php echo $_SERVER['SCRIPT_NAME']?>";</script>
</body>
</html>
<?php
@ -134,6 +135,7 @@
<button onclick="urlinsert()">Insert new URL</button><br>
<div id="responsetext"></div>
<script src="js/insertnew.js"></script>
<script>var script_name = "<?=$_SERVER['SCRIPT_NAME']?>";</script>
</body>
</html>
<?php

View File

@ -28,5 +28,5 @@ function urlinsert() {
xhr.send( data );
}
function logout ( ) {
window.location.href = "/?logout";
window.location.href = script_name+"?logout";
}

View File

@ -10,7 +10,7 @@ function login() {
var response = xhr.responseText;
response = JSON.parse ( response );
if ( response [ 'status' ] == 200 ) {
window.location.href = "/";
window.location.href = script_name;
}
else {
document.getElementById ( "responsetext" ).innerHTML = response [ 'error_message' ];