title: Jquery cross domain login with PHP sessions
body: <p>I have two websites</p>
  
  <ul>
  <li>www.example.com</li>
  <li>www.m.example.com</li>
  </ul>
  
  <p>The all PHP scripts are based on the first domain. I need to login user from the mobile site using the first domain PHP scripts. And I need to make sessions over the domains. How can I do this?</p>
  
  <p>PHP file:</p>
  
  <pre><code>&lt;?php
  session_start();
  
  $username = $_POST['username'];
  $password = md5($_POST['password']);
  
  //DB check
  
  $_SESSION['log'] = $dbarray;
  ?&gt;
  </code></pre>
  
  <p>The script on the second domain</p>
  
  <pre><code>$.post('../scripts/login.php',{username:username,password:password},function(data){
    //Success
  });
  </code></pre>