I have an existing webapp in php and js and I am trying to add authentication to it. I have figured out the part on how to create a login page and authenticate against my organisation's LDAP server where multiple users have their accounts created.
My question is about the $_SESSION variable being same for all users who visit.
If a user visits the page and I set
$_SESSION["username"]="xyz";
$_SESSION["logged_in"]=true;
and then if another user logs in, will the $_SESSION variable be totally new for him or will the keys like "username" and "logged_in" be set with the previous user's data?
If not, then how does PHP or the httpd webserver know whether the tab is closed or a new request has come in?
If I open multiple tabs in the browser (or multiple browser windows) will it all have the same $_SESSION variable in the backend?
Basically I have questions about the lifecycle of the $_SESSION variable.