Add reload action after session expire

This commit is contained in:
Hamid Samak
2019-09-12 15:05:08 +04:30
parent 5d42183a61
commit 56fee2acb6
+16
View File
@@ -76,6 +76,10 @@ if (empty(PASSWORD) === false && (isset($_SESSION['pheditor_admin']) === false |
file_put_contents(LOG_FILE, serialize($log));
}
} else if (isset($_POST['action'])) {
header('HTTP/1.0 403 Forbidden');
die('Your session has expired.');
}
die('<title>Pheditor</title><form method="post"><div style="text-align:center"><h1><a href="http://github.com/hamidsamak/pheditor" target="_blank" title="PHP file editor" style="color:#444;text-decoration:none" tabindex="3">Pheditor</a></h1>' . (isset($error) ? '<p style="color:#dd0000">' . $error . '</p>' : null) . '<input id="pheditor_password" name="pheditor_password" type="password" value="" placeholder="Password&hellip;" tabindex="1"><br><br><input type="submit" value="Login" tabindex="2"></div></form><script type="text/javascript">document.getElementById("pheditor_password").focus();</script>');
@@ -728,6 +732,18 @@ $(function(){
$("#files").on("click", ".jstree-anchor", function(){
location.href = $(this).attr("href");
});
$(document).ajaxError(function(event, request, settings){
var message = "An error occurred with this request.";
if (request.responseText.length > 0) {
message = request.responseText;
}
if (confirm(message + " Do you want to reload the page?")) {
location.reload();
}
});
});
</script>
</head>