Then in my PHP authentication library, if no one is logged in, it is redirected to the home page:
Redirect ('Home / Index');
The problem is that I have some modal windows that load the content via AJAX. If a user is logged out in any way (but still on the page where he is "logged in") then the modal login page shows because the model was "redirected" to the home page.
This problem may occur when the user has not done anything for a long time (and logged out), or if they have multiple tabs open and sign out on one of them, but the other Try opening a modal popup at
Is there a way to redirect the entire window?
two solutions:
1) Set up a Javascript function on the main page, Check every X seconds cookie, if not present, then redirect the entire page
location.href = "login.php"
2 ) In the page loaded with AJAX, set the JavaScript code to redirect, you can not do it with PHP because the script does not know the context, it only results W processing request. Javascript code that can be printed anywhere with PHP (body is included)
if (notLogged) {window.redirect = 'login.php'; }
Comments
Post a Comment