title: Login script not redirecting, Receiving blank page
body: <p>I have tested my login by using the following script on my index.php file, </p>
  
  <pre><code> &lt;?php 
    include 'core/init.php';
   ?&gt;
  &lt;html&gt;
   &lt;?php 
   if (isset($_SESSION['user_id'])) {
       echo 'logged in';
       } else {
           echo 'Not Logged In';
   }
   ?&gt; 
  </code></pre>
  
  <p>So at first the page displays, 'not logged in' but when email and password is entered correctly the page is supposed to redirect to the index.php page. But instead I am getting a blank page when running the login.php file. I have to manually change the page back to index.php, where then it says 'logged in'.</p>
  
  <p>Heres my Login.php script: </p>
  
  <pre><code>&lt;?php
  include 'core/init.php';
  
  
  if (empty($_POST) === false) {
  $email = $_POST['email'];
  $password = $_POST['password'];
  
  if (empty($email) === true || empty($password) === true) {
      $errors[] = 'You need to enter a email and password';
  } else if (user_exists($email) === false) {
      $errors[] = 'We can\'t find that email. Have you registered?';
  } else if (user_active($email) === false) {
      $errors[] = 'You haven\'t activated your account!';
  } else {
  
      if (strlen($password) &gt; 32) {
          $errors[] = 'Password too long';
      }
  
      $login = login($email, $password);
      if ($login === false) {
          $errors[] = 'That email/password combination is incorrect';
      } else {
          $_SESSION['user_id'] = $login;
          header('Location: Index.php');
          exit();         
      }
  }
    print_r($errors);
  
   }
   ?&gt;
  </code></pre>
  
  <p>My Login.php file includes another file called init.php which I start the session; </p>
  
  <pre><code>&lt;?php
  session_start();
  
  
  require 'database/connect.php';
  require 'functions/general.php';
  require 'functions/users.php';
  
  $errors = array();
  ?&gt;
  </code></pre>
  
  <p>An update, I have created a logout.php file to log the user out which redirects to the index.php file. Logout.php</p>
  
  <pre><code>&lt;?php 
  session_start();
  session_destroy();
  header('Location: index.php');
  ?&gt;
  </code></pre>
  
  <p>PS - I am new to PHP ad there may be a small error I am overlooking, any feedback or comments are welcome. Thanks (Y) </p>