I want to check if a session is currently established, and if so, that the page works as usual (do nothing), if it does not create a session.
I looked at another SO question in which the following code was posted:
if ( empty( $_SESSION['login'] )) { } else { }
The easiest way to do this is to set something like $_SESSION['a'] for each session, and then run if(empty($_SESSION['a'])) to check if the session exists?
Again, you can use a session variable without calling session_start () in the first place, which makes it obsolete (I tried it yesterday as an echo, but not an if statement, to check if the variable was transferred without realizing that session_start () needs to be called, before I can repeat the variable).
This is probably an easy way that is often used, I just can't find it.
Any help would be greatly appreciated!
Fireworksable
source share