lundi 25 mars 2019

Site management using php Login system solution?

Imagine that I have a website xyz.com with several subdomains like site1.xyz.com [ a drupal site ] , site2.xyz.com [a symfony site] , site3.xyz.com [ a laravel site ] and so on.

I would like to create a php login system which will be on xyz.com. A user will login to xyz.com and then be able to access any of the subdomains mentioned above. After set time, session will timeout and bring the user back to login screen.

Is this possible with the php login system or any other javascript or java framework ?

I have already implemented the php login system but SESSION thing is not working with all of sites mentioned above. I tried to create a sample inside.php with SESSION, it didn't work.

Do I need to put this code in each of the subdomains site1.xyz.com that needs to be controlled by the php login system ?

if (!isset($_SESSION['userId']) || !isset($_SESSION['userUid']))


{ echo '<p class="login-status">You are logged out.. </p>'; 
header("Location: ../index.php");
exit(); 


}

Results: Even if the SESSION : userId and userUid was NOT set, it would still display the page.




Aucun commentaire:

Enregistrer un commentaire