title: How do I login into two different codeigniter project
body: <p>I have two different CodeIgniter project first is on a root domain
  and another one is one subdomain.</p>
  
  <p>I try to use the existing login function of both the projects, 
  I put my multi-login code in subdomain its work fine</p>
  
  <p>Checking whether it's available or not in a subdomain or if not present check the root domain database </p>
  
  <p>after submitting the form it comes here in checkUser()</p>
  
  <pre><code> function checkUser(){  
  
               $username = $this-&gt;input-&gt;post('username');  
               $password = $this-&gt;input-&gt;post('password');
  
               $this-&gt;load-&gt;model('CheckUserModel');
               $data = $this-&gt;CheckUserModel-&gt;checkUser($username,$password);
    if($data['user']['instance']=="sub-domain"){
              print_r("Inside Subdomain instance");
  
  
          //Model Function
          $this-&gt;load-&gt;model('login_model');
  
          if ($this-&gt;login_model-&gt;can_login_valid($username,$password)) {
  
              $data = $this-&gt;login_model-&gt;can_login($username,$password);
  
  
                 redirect(base_url());
              //redirect(base_url().'user/SigninController/enter');
          }else {
  
              $this-&gt;session-&gt;set_flashdata('error','Invalid Username and Password');
              redirect(base_url().'user/CheckUserContoller/');
          }
  
  
        }else if($data['user']['instance']=="root-domain"){
              print_r("Inside root-doamin instance");
  
  
          //Model Function
          $this-&gt;load-&gt;model('login_model');
  
  
          if ($this-&gt;login_model-&gt;can_login_valid2($username,$password)) {
  
              $data = $this-&gt;login_model-&gt;can_login2($username,$password);
  
  
                //load the Curl library
                $this-&gt;load-&gt;library('curl');       
  
                //Request using POST Method
                $url = 'https://root-domain.online/user/SigninController/';     
                $postData= array(
  
                             "user_email" =&gt; $username,
                             "user_password" =&gt; $password,
                             'redirect_to' =&gt; $url,
                             'testcookie' =&gt; '1'
                          );
  
  
              curl_setopt_array($ch, array(
                  CURLOPT_URL =&gt; 'https://root-domain.online/user/SigninController/login_validation',
                  CURLOPT_RETURNTRANSFER =&gt; true,
                  CURLOPT_POST =&gt; true,
                  CURLOPT_POSTFIELDS =&gt; $postData,
                  CURLOPT_FOLLOWLOCATION =&gt; true
              ));
  
              $output = curl_exec($ch);
              echo $output;
  
              //redirect(base_url().'user/SigninController/enter');
          }else {
  
              $this-&gt;session-&gt;set_flashdata('error','Invalid Username and Password');
              redirect(base_url().'user/CheckUserContoller/');
          }
           }
  }
  </code></pre>
  
  <p>it works fine in a subdomain and logged in me</p>
  
  <p>but the problem is that when I try to login to root domain it shows the login page </p>