var usrsession = null; setInterval(checksessionid, 2000); var sessionid; var usronline = []; var blockcheck; var secondsession; function checksessionid(){ // start checkblock fetch(window.location.protocol+'//' + window.location.hostname+':'+window.location.port + '/backend/' + usrsession + 'block.txt', {cache: "no-store"}) .then(response => response.text()) .then(data => { blockcheck = +data ; }); if(blockcheck == 1){window.location.replace(window.location.protocol+'//' + window.location.hostname+':'+window.location.port+ "/backend/index.php?logout='1'");} // end checkblocked fetch(window.location.protocol+'//' + window.location.hostname+':'+window.location.port + '/backend/' + usrsession + 'session.txt', {cache: "no-store"}) .then(response => response.text()) .then(data => { sessionid = data ; }); /*fetch(window.location.protocol+'//' + window.location.hostname+':'+window.location.port + '/backend/' + usrsession + 'online.txt', {cache: "no-store"}) .then(response => response.text()) .then(data => { usronline = data.split(" "); });*/ console.log("useronline",usronline); console.log("sessionid", sessionid); // if(usronline.length>2 && sessionid.length>2){ // const xmmmp = new XMLHttpRequest(); // xmmmp.open("GET", "sessioncheck.php?ffff="+sessionid); // xmmmp.send(); //document.getElementById("session").setAttribute("src","sessioncheck.php?ffff="+sessionid); var thissession = null; if(thissession != sessionid && sessionid && thissession){window.location.replace(window.location.protocol+'//' + window.location.hostname+':'+window.location.port+ "/backend/index.php?logout='1'"); // } }; }