I have been trying to do something like below.
JavaScript
$.ajax({
url: 'login.php',
type: 'GET',
success: function(response) {
// get token and store in cookie for further requests to other files
}
});
Login.php
<?php
// getting $user_id from database again user email and password
$user_id = "12345";
$_SESSION["user"] = $user_id;
echo $user_id;
?>
Now as multiple users would be using the app and calling the same login.php passing their email and password, I want to return them their id which they can use to access other resources. I am interested to know if PHP sessions would be different for all users or the same user would overwritten if 2 or more than 2 users login at the same time? I am not sure about PHP session scope.