By default, PHP will use the same session for all scripts in the same domain. Make sure to bounce between domain.com and www.domain.com as they may not have the same session.
Instead of creating completely separate sessions for each section, why not use one global session for the user and the section? There is no reason that $ _SESSION cannot be a multidimensional array.
//// things needed in multiple sections could go into a common grouping: $_SESSION['common']['user'] = 'josh'; $_SESSION['common']['privileges']['section_access'] = array( 'section1'=>"yes", 'section2'=>"no", 'section5'=>"security-prompt" ); //// while things that were section specific could be grouped by section: $_SESSION['section1']['agreed_to_terms'] = true; //// you could also group by logical functionality: $_SESSION['staff']['badge_no'] = 44815;
Using this structure, you will have all the information available to you in each script, but use only the parts that you need.
In addition, it saves you the headache of juggling session_name () and other complex bits in your logic. In addition, this solves the problem of exchanging some bits of information (for example, the current user) between sessions.
source share