recognize the session in a login

Ok, an last idea for you.

Let us take this situation here…

The big problem I have is that once the user logs in to see the content of the “main” page and continues browsing the site and wants to see the “main” page again by clicking on the “events” button of the The menu again directs you to the login without respecting that you had previously logged in

Your LOGIN is placed on the → EVENTS-page, right?
When a USER loggs-in → he will be redirected to your → MAIN-page.
The Main-page itself do NOT exists on your Menu (hidden) and can only be reached trough the LOGIN on EVENTS-page.

OK, i think till here everything is clear now.

So all you need is a timer-function → You have already created one.

Place the Timer-Function on your events-page. When an already logged-in USER starts to navigate trough all of your pages and lands on the events-page again, where he will see the LOGIN again…

…you check your TIMER if LOGIN-TIME already ran out.
If NOTRedirect again to the page you want to .
If YESDo nothing . (the USER has to log-in again, to refil his ONLINE-TIME)

This way you have solved your problem.