I have 2 websites running on my localhost
- localhost/sample_website1/index.php
- localhost/sample_website2/index.php
initial code in both the websites is:
if(isset($_SESSION['user'])){
header("location:home.php")
}
// This code redirects index.php to home.php if the session already exists
.........next lines are login code..........
//
//
//
............................................
I have successfully logged into sample_website1 using the login form in index.php and the session is activated. $_SESSION['user']=$username
Now I opened a new tab and visited sample_website2 in which it is using the session variable $_SESSION['user'] that is already set in sample_website1 and automatically logging into home.php from index.php
I need a session variable that will be active only in sample_website1 so that it will not directly authenticate user on some other website like sample_website2.
question from:https://stackoverflow.com/questions/65849653/are-there-any-domain-specific-global-variables-in-php