title: Hash session login sometimes works, sometimes doesn't
body: <p>I am stuck here. I made a very simple login script based on sessions and cookies. It's nothing fancy.</p>
  
  <p>What i have is this:</p>
  
  <p>On top of the page: <code>&lt;?php session_start(); ?&gt;</code>
  After a succesfull registration, somewhere around line 400: </p>
  
  <p>On page 1, after a succesfull registration, sessions are set.</p>
  
  <pre><code>&lt;?php    
      $hash = md5(time()); // Time is just for testing purposes.
      $_SESSION['emailadres'] = filter_var($emailadres, FILTER_VALIDATE_EMAIL);
      $_SESSION['hash'] = $hash;
  ?&gt;
  </code></pre>
  
  <p>The login and emailadres are succesfully stored within the database, then the page get's forwarded: <code>&lt;?php header("location: nextpage.php"); ?&gt;</code></p>
  
  <p>The next page requires a successfull registration and session login:</p>
  
  <pre><code>session_set_cookie_params(0);
  session_start();
  $emailadres = filter_var($_SESSION["emailadres"], FILTER_VALIDATE_EMAIL);
  $hash = filter_var($_SESSION["hash"], FILTER_SANITIZE_STRING);
  </code></pre>
  
  <p>That's it.</p>
  
  <p>It goes right about 75% of the times, but sometimes, following the exact same road, the hash in the database and the hash in the session are not the same.</p>
  
  <p>Anyone a suggestion? Has it perhaps something to do with P3P and such. See:
  <a href="https://stackoverflow.com/questions/14438461/iframes-iexplorer-doesnt-write-or-read-sessions-or-cookies/14439820#14439820">iFrames Iexplorer doesn&#39;t write or read sessions (or cookies)</a></p>