I am working on my localhost and I have two applications running there.
Let's say the urls are:
- localhost/apps/app1/
- localhost/apps/app2/
Each of the applications have there own login module which is using PHP based sessions to restrict/allow user to enter the application. The name of session variable is same i.e. uid
. The way I am using it is:
<?php
session_start();
if(!isset($_SESSION["uid"]))
header('location:login/index.php');
?>
But the session variable of app1 is working and accessible in app2, which I don't want. How can I restrict the accessibility of session variable created in app1 so that it doesn't interfere with the other session variable.
I read this How to restrict a session to a directory only in PHP? but this won't work in my case as it is for one directory only.