title: $_SESSION is read after page reload only
body: <p>I am trying to work out a few things about Sessions lately and now I need help to get a small page to work using XAMPP.<br />
  <br />
  I am using 4 pages for testing purposes: <br />
  1) <code>index.php</code> is the page where the user puts his ID and PW.<br />
  2) <code>logon.php</code> checks the database for a matching entry and redirects einter to <code>index.php</code> or <code>profile.php</code><br />
  3) <code>profil.php</code> echoes all relevant User Data<br />
  4) <code>logout.php</code> <br />
  <br /></p>
  
  <p>Test No. 1: Now as a User I do the following: I start on index.php and type in my ID and PW. Let's say my ID is 1234. Logon says that I am fine and redirects me to profil.php, showing Data for User 1234. Now I can log out, the Session gets deleted and everything seems fine.<br />
  <br />
  Test No. 2: As a new user I start on <code>index.php</code>, but now my ID is 5678. <code>logon.php</code> tells me that everything is fine and redirects me to <code>profil.php</code>, but it shows the Data from the first login (1234). I can also move to other pages and come back to <code>profil.php</code>, but data will always be for User 1234 until I refresh the page (F5 or CTRL + SHIFT + R). Either way now it states the correct 5678 Data. I can log out and the Session will be destroyed again.</p>
  
  <p>Here is how I handle the sessions:</p>
  
  <p><code>index.php</code>:</p>
  
  <pre><code>&lt;?php
      @session_start();
  ?&gt;
  </code></pre>
  
  <p><code>logon.php</code>: </p>
  
  <pre><code>&lt;?php
      @session_start();
      session_regenerate_id(true);
  ?&gt;
  </code></pre>
  
  <p><code>profile.php</code>:</p>
  
  <pre><code>&lt;?php
      @session_start();
      if(!isset($_SESSION['personal_id'])){
          header('Location: /index.php');
          exit;
      }
  ?&gt;
  </code></pre>
  
  <p><code>logout.php</code>:</p>
  
  <pre><code>&lt;?php
      @session_start();
      $_SESSION = array();
      setcookie( session_name(), "", time()-3600, session_save_path() );
      session_destroy();
      session_write_close();
  ?&gt;
  </code></pre>
  
  <p>All headers look like this:</p>
  
  <pre><code>&lt;head&gt;
      &lt;title&gt;Scheffel Shoptime&lt;/title&gt;
      &lt;link href="style.css" rel="stylesheet" type="text/css"&gt;
      &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
      &lt;meta http-equiv="cache-control" content="max-age=0" /&gt;
      &lt;meta http-equiv="cache-control" content="no-cache" /&gt;
      &lt;meta http-equiv="expires" content="0" /&gt;
      &lt;meta http-equiv="expires" content="Tue, 01 Jan 1980 1:00:00 GMT" /&gt;
      &lt;meta http-equiv="pragma" content="no-cache" /&gt;
      &lt;meta http-equiv="Refresh" content="5;url=./index.php"&gt;
  &lt;/head&gt;
  </code></pre>
  
  <p>Can you already see where I go wrong, or do you need further information?
  Thanks in advance to everyone who tries to help!</p>