As you mentioned in your comment, you should know how the user logged in first (login or login-guest), so you will need to have some kind of state for each user.
Now, if you cannot increase the session timeout indefinitely, you will probably need to store the login type somewhere else, like in cookies, or as a query string in your URLs.
In the case of a cookie, it would be something like this:
In the registration section of your login-guest.php :
... $expire = 60 * 60 * 24 * 30 * 24 + time(); // 2 years setcookie('logintype', 'guest', $expire);
And this is when you send the user to the login page:
if(isset($_COOKIE['logintype']) && $_COOKIE['logintype']=='guest'){ header('Location: login-guest.php'); } else { header('Location: login.php'); }
I donβt think cookies can have an endless life, so I set the validity period to two years, which you can change. Obviously, this will not continue if the user deletes cookies or uses a different browser.
source share