title: Why does this session always return true?
body: <p>I'm having trouble with my code.
  Somehow an if-statement that checks sessions always returns true. Even at start. I can't really figure out why..</p>
  
  <p>Here is my login page.</p>
  
  <pre><code>&lt;?php
  session_start();
  if(isset($_SESSION['username']))   //&lt;-----This always returns true here for a strange reason.
  {
  }   
  ?&gt;
  </code></pre>
  
  <p>Here is my my login controller.</p>
  
  <pre><code>if($_POST)
  {
      if(isset($_POST['submit']) AND $_POST['submit'] == "login")
      {
          $username = $_POST['username'];
          $password = $_POST['password'];
          try
          {
              include '../model/Login.php';
              $login = new Login($username, $password);
  
              if($login == TRUE)
              {
                  session_start();
                  $_SESSION['username'] = $username;
                  header("Location:../index.php");
              }
  
          }
          catch (Exception $exc)
          {
              echo $exc-&gt;getMessage();
          }
      }
  }
  </code></pre>