45 lines
1.9 KiB
JavaScript
45 lines
1.9 KiB
JavaScript
const myTimeout = setTimeout(kill_session,900000);
|
|
function kill_session() {
|
|
if (window.XMLHttpRequest)
|
|
{// code for IE7+, Firefox, Chrome, Opera, Safari
|
|
xmlhttp=new XMLHttpRequest();
|
|
}
|
|
else
|
|
{// code for IE6, IE5
|
|
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
|
}
|
|
location.reload();
|
|
xmlhttp.open("GET","model/logout.php",false);
|
|
xmlhttp.send();
|
|
|
|
// document.getElementById("id_of_a_hidden_div").innerHTML=xmlhttp.responseText;
|
|
}
|
|
function time_loader() {
|
|
setInterval(function() {
|
|
var date = new Date();
|
|
var day = ("0" + (date.getDate())).slice(-2);
|
|
var mon = ("0" + (date.getMonth() + 1)).slice(-2);
|
|
var year = date.getFullYear();
|
|
var hours = ("0" + (date.getHours())).slice(-2);
|
|
var minute = ("0" + (date.getMinutes())).slice(-2);
|
|
var seconds = ("0" + (date.getSeconds())).slice(-2);
|
|
|
|
if (hours == 0 && minute == 0 && seconds == 0) {
|
|
localStorage.clear();
|
|
localStorage.clickcount = 0;
|
|
location.reload();
|
|
|
|
|
|
}
|
|
|
|
var num = Number(localStorage.clickcount)+1;
|
|
|
|
document.getElementById("codepasien").value = year+''+mon + '' +day+ '' + num;
|
|
}, 1000);
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|