(11-22-2018, 12:48 AM)TGates Wrote: I'm wondering if there is something in the server config that is taking over. A timeout setting in the php config maybe? I really do not have the time right now to dig into it Maybe a quick snoop on google could shed some light on this
Google: php set session timeout
Or maybe see if there is a better/working way of doing this:
Google: php auto logout after inactivity
That will not work.
When the PHP script is called, the session variable does not exist yet so the "if" routine does not run, therefore nothing gets echoed from the script, therefore the jquery in the HTML code redirects to the logged out page. This happens after 60 seconds because this interval is set within the javascript. The timeout in the PHP code doesn't get a look-in. Plus, the session is never called with session_start(); so I doubt the session timeout would ever be found by the "if" routine even if we got it to run anyway.
Even if you add the necessary code to make it run, I fail to see how this would log you out if you closed your browser and reopened it again at a later time. So if that's the case, all it would do anyway is log you out if you keep the browser open and do nothing for more than 60 seconds. So why not just rewrite the javascript and use a timer within that to log you out? And forget the PHP completely?
Code:
<!-- auto-logout JS -->
<script type="text/javascript">
$(document).ready(function(){
setTimeout(function(){
window.location.href="?logout";
},1*60*1000);
});
</script>
If you want to specify the number of seconds before auto-logout, change the "60" to the number of seconds you want. If you want to specify the timeout in minutes, leave the "60" alone and change the "1" to the number of minutes.
I'm sure you'd have to delve deeper into the session data and cookies already written by Sentora, and record the time Sentora is last visited in one of these, to then compare the next time it is opened and look if it is greater than a timeout or not, to determine whether to log someone out or not. But that's far more advanced than just timing out an open page.
If anyone sees something I don't let me know but I can't see how this ever worked as it was.
Keith