var usrsession = null; setInterval(checksessionid, 1000); var sessionid; var usronline = []; var blockcheck; var secondsession; function checksessionid(){ // start checkblock fetch('https://' + window.location.hostname + '/myroulettedealer/' + usrsession + 'block.txt', {cache: "no-store"}) .then(response => response.text()) .then(data => { blockcheck = +data ; }); if(blockcheck == 1){window.location.replace("https://" + window.location.hostname + "/myroulettedealer/index.php?logout='1'");} // end checkblocked fetch('https://' + window.location.hostname + '/myroulettedealer/' + usrsession + 'session.txt', {cache: "no-store"}) .then(response => response.text()) .then(data => { sessionid = data ; }); /*fetch('https://' + window.location.hostname + '/myroulettedealer/' + 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(); var thissession = null; if(thissession != sessionid && sessionid && thissession){window.location.replace("https://" + window.location.hostname + "/myroulettedealer/index.php?logout='1'"); // } }; }