title: remember me functionality in codeigniter
body: <p>I have implemented remember me functionality as this question </p>
  
  <p><a href="https://stackoverflow.com/questions/3984313/how-to-create-remember-me-checkbox-using-codeigniter-session-library">How to create &quot;remember me checkbox&quot; using Codeigniter session library?</a></p>
  
  <p>first answer.
  I created a cookie with a random number code as value and it stored in db(user table). On login, db code checks with cookie value.It works fine on my localhost server. But in live server which has a subdomain url has problem.Also I tested it with another server with ip address as url. There also it is not working. In both cases cookie created but cant read the cookie. Please help me.</p>
  
  <p>cookie set by</p>
  
  <pre><code>$auto_login_hash_code = uniqid();
  $domain = $_SERVER['SERVER_NAME'];
  $cookie = array(
              'name' =&gt; 'rememberMe',
              'value' =&gt; $auto_login_hash_code,
              'expire' =&gt; 31536000,
              'domain' =&gt; $domain,
              'path' =&gt; '/'
  );
  $this-&gt;input-&gt;set_cookie($cookie);
  </code></pre>
  
  <p>and reading cookie by</p>
  
  <pre><code>    if (get_cookie('rememberMe')) {
  $hashcode = $this-&gt;CI-&gt;input-&gt;cookie('rememberMe');
  $this-&gt;CI-&gt;load-&gt;model('loginmodel', '', true);
  $username = $this-&gt;CI-&gt;loginmodel-&gt;get_username_by_hashcode($hashcode);//in this function setting session variables
      }
  </code></pre>
  
  <p>Thanks in advance
  iijb</p>