title: How to pass SESSION variable to a page in the parent directory?
body: <p>On my web site I would like to have several sub-domains. Files that create context for a given sub-domain are stored in corresponding sub-directory. </p>
  
  <p>Sometimes I need to link to the files that do not belong to the sub-domain.</p>
  
  <p>For example, on my "subdomain1.mysite.org" I have a link to "www.mysite.org/login.php". The "login.php" is stored in the directory that contains all subdirectories corresponding to the sub-domains.</p>
  
  <p>If I make the link to the "www.mysite.org/login.php" in this way: <code>href='../login.php'</code>, it does not work. Because browser tries to access "subdomain1.mysite.org/../login.php". To solve this problem I make the link in this way: <code>href='http://www.mysite.org/login.php'</code> but I think that in this way I cannot pass my session variables to the new page (can it be the case?).</p>
  
  <p>So, my problem is that I cannot find a way to pass session variables to the page that is located in the parent directory (or to the page that is located on another domain). Does anybody know how this problem can be solved?</p>
  
  <p><strong>ADDED</strong></p>
  
  <p>As recommended, I tired to use <code>session_set_cookie_params</code> to solve the problem. But I still cannot manage to get the desired result. In more details I do the following:</p>
  
  <p>I have in the <code>index.php</code> file that generates content for <code>subdomain1.mysite.org</code> I use the following code:</p>
  
  <pre><code>session_set_cookie_params(24*60*60,'/','.mysite.org');
  session_start();
  $_SESSION['page'] = $PHP_SELF;
  </code></pre>
  
  <p>Than later, in the same file I make a link to one of my pages (I think problem can be here). I create the link in the following way:</p>
  
  <pre><code>href='http://www.mysite.org/login.php'
  </code></pre>
  
  <p>In the login.php file I have the following code:</p>
  
  <pre><code>session_set_cookie_params(24*60*60,'/','.mysite.org');
  session_start();
  print "a".$_SESSION['page']."b";
  </code></pre>
  
  <p>As the result there is nothing between "a" and "b". So, I still cannot pass the session variables from one page to another one. Does anybody know what I am doing wrong?</p>
  
  <p><strong>ADDED 2</strong>
  I have to say that my problem is solved if I add the following line: 
  <code>session_name("some_name");</code></p>
  
  <p>before the </p>
  
  <p><code>session_set_cookie_params</code>.</p>