I have a main directory called System with a subdirectory named Subsystem . My session from the main directory does not work in a subdirectory.
When I echo session_save_path(); in both folders, they show me "/tmp" .
Then I tried to put session_save_path("../tmp"); to your subdirectory, but it shows me "This webpage has a redirect loop" .
session.php in the System directory:
<?php session_start( ); if (!($_SESSION['uid'])) { header("Location:index.php"); } else { $_SESSION['uid'] = $_SESSION['uid']; } ?>
session.php in the subsystem folder:
<?php session_save_path("../tmp"); session_start( ); if (!($_SESSION['uid'])) { header("Location:index.php"); } else { $_SESSION['uid'] = $_SESSION['uid']; }
? >
I have Googled all over, but I still can't get it to work.
source share