mirror of https://github.com/itflow-org/itflow
Merge pull request #781 from wrongecho/session-timeout-garbage-workaround
Add background ajax query in an attempt to prevent session timeout
This commit is contained in:
commit
33abf8a9eb
|
|
@ -24,6 +24,7 @@
|
||||||
<script src="plugins/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
<script src="plugins/tinymce/tinymce.min.js" referrerpolicy="origin"></script>
|
||||||
<script src="plugins/Show-Hide-Passwords-Bootstrap-4/bootstrap-show-password.min.js"></script>
|
<script src="plugins/Show-Hide-Passwords-Bootstrap-4/bootstrap-show-password.min.js"></script>
|
||||||
<script src="plugins/clipboardjs/clipboard.min.js"></script>
|
<script src="plugins/clipboardjs/clipboard.min.js"></script>
|
||||||
|
<script src="js/keepalive.js"></script>
|
||||||
|
|
||||||
<!-- AdminLTE App -->
|
<!-- AdminLTE App -->
|
||||||
<script src="dist/js/adminlte.min.js"></script>
|
<script src="dist/js/adminlte.min.js"></script>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
// Keep PHP sessions alive
|
||||||
|
// Sends requests to keepalive.php in the background every 10 mins to prevent PHP garbage collection ending sessions
|
||||||
|
|
||||||
|
function keep_alive() {
|
||||||
|
|
||||||
|
//Send a GET request to keepalive.php as keepalive.php?keepalive
|
||||||
|
jQuery.get(
|
||||||
|
"keepalive.php",
|
||||||
|
{keepalive: 'true'},
|
||||||
|
function(data) {
|
||||||
|
// Don't care about a response
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// Run every 10 mins
|
||||||
|
setInterval(keep_alive, 600000);
|
||||||
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
// Keep PHP sessions alive
|
||||||
|
// Receives requests via AJAX in the background every 10 mins to prevent PHP garbage collection ending sessions
|
||||||
|
// See footer.php & js/keepalive.js
|
||||||
|
|
||||||
|
session_start();
|
||||||
|
session_write_close();
|
||||||
Loading…
Reference in New Issue