title: PHP Session Issue
body: <p>I'm having a problem with PHP and sessions. This is my code for dictionary.php.</p>
  
  <pre><code>&lt;?php
  if(!isset($_SESSION['auth'])){
  $_SESSION['auth'] = 0;
  }
  if($_SESSION['auth'] == 0){
  header("Location: index.php");
  }
  ?&gt;
  </code></pre>
  
  <p>So, there is index.php which is supposed to set the session "auth" to 0 or 1:</p>
  
  <pre><code>&lt;?php
      $msg = "";
  
  //Password handler
  if(!isset($_POST['password'])){
      $password = "";
  }else{
      $password = $_POST['password'];
  }
  
  if(!isset($_SESSION['auth'])){
      $_SESSION['auth'] = 0;
  }
  
  //Username handler
  if(!isset($_POST['username'])){
      $username = "";
  }else{
         $username = $_POST['username'];
      if($username == "potato" &amp;&amp; $password == "poteto"){
          $_SESSION['auth'] = 1;
          header("Location: dictionary.php");
      }else{
          $msg = "&lt;br /&gt;
  &lt;font color=\"#FF0000\"&gt;Invalid username or password!&lt;/font&gt;&lt;br /&gt;";
      }
  }
  
  if($_SESSION['auth'] == 0){
          header("Location: dictionary.php");
  }
  
  ?&gt;
  </code></pre>
  
  <p>(The above may be bad practice or something, but I'm just doing this for a school project and I don't want anyone else to see the file dictionary.php.)</p>
  
  <p>index.php uses a form with the POST method to send <code>$username</code> and <code>$password</code>, just in case you haven't noticed yet.</p>
  
  <p>When I enter the login details, "potato" and "poteto", it redirects me to dictionary.php, but then immediately throws me back into index.php. I've tried tweaking the above code but no luck.</p>
  
  <p>If anyone needs me to show this to them, then I can provide a URL.</p>
  
  <p>Thanks.</p>