title: getting moodle session variables and should work on external site(php)
body: <p>I'm developing a web page using the php that will be accessed through a fake moodle course. I don't want to force the user to login twice, so I need access to the moodle session variables in order to know which user is connecting, and log him in automatically.</p>
  
  <p>Both webs are on the same server, but on different directories. </p>
  
  <p>How could I get the logged in user from the other site?</p>
  
  <p>My two websites are on the same domain, but on different paths.</p>
  
  <p>Let's say, for example, that:</p>
  
  <ul>
  <li><p>moodle is on localhost/moodle</p></li>
  <li><p>my web is on localhost/moodle/cap/login.php</p></li>
  </ul>
  
  <p>Moodle creates a session cookie that is only valid for localhost/moodle. When the browser is redirected to localhost/myweb, it doesn't send the moodle session cookie.</p>
  
  <p>Thank you in advance!</p>