It is displaying a blank page for one of my php scripts
<p>I am trying to keep the user logged in until they have clicked on the logout link or have closed down the browser.</p>

<p>The problem I am having is that for the teacherlogin.php page, it is just displaying a blank page. There are no php errors or javascript errors so my question is that what am I doing incorrectly in the teacherlogin.php code below;</p>

<p><strong>teacherlogin.php</strong> </p>

<pre><code>        &lt;?php
/*
file: login.php
authorized (logged in) users must be redirected to a secure page (member.php) or (secure.php)
unauthorized (guests) users have to see the login form
*/

#include the class file and start it.

ini_set('display_errors', TRUE);
error_reporting(E_ALL);

require_once('session.class.php');
$session = new Session();

#check user's access
if($session-&gt;get("auth"))header("location:members.php");
?&gt;

&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html&gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html;charset=utf-8" /&gt;
        &lt;title&gt;Teacher Login&lt;/title&gt;
   &lt;link rel="stylesheet" type="text/css" href="TeacherLoginStyle.css"&gt;
   &lt;/head&gt;
&lt;?php

// connect to the database
include('connect.php');
/* check connection */
if (mysqli_connect_errno()) {
    printf("Connect failed: %s\n", mysqli_connect_error());
    die();
}

// required variables (make them explciit no need for foreach loop)
if (isset($_POST['submit'])) {
    $teacherusername = (isset($_POST['teacherusername'])) ? $_POST['teacherusername'] : '';
    $teacherpassword = md5(md5("g3f".$_POST['teacherpassword']."rt4"));  

    // don't use $mysqli-&gt;prepare here
    $query = "SELECT TeacherId, TeacherForename, TeacherSurname, TeacherUsername, TeacherPassword, Active FROM Teacher WHERE TeacherUsername = ? AND TeacherPassword = ? LIMIT 1";
    // prepare query
    $stmt=$mysqli-&gt;prepare($query);
    // You only need to call bind_param once
    $stmt-&gt;bind_param("ss",$teacherusername,$teacherpassword);
    // execute query
    $stmt-&gt;execute(); 
    // get result and assign variables (prefix with db)
    $stmt-&gt;bind_result($dbTeacherId, $dbTeacherForename,$dbTeacherSurname,$dbTeacherUsername,$dbTeacherPassword, $dbActive);

    while($stmt-&gt;fetch()) {
        if ($teacherusername == $dbTeacherUsername &amp;&amp; $teacherpassword == $dbTeacherPassword) {
            if ($dbActive == 0) {
                $error = "You Must Activate Your Account from Email to Login";
            }else{
                $session-&gt;set('auth',TRUE);
                $session-&gt;set('active',TRUE);
                $session-&gt;set('teacherid',$dbTeacherId);
                $session-&gt;set('teacherusername',$dbTeacherUsername);
                header('Location: members.php') ;
            }
        }else{
            //password and username dont match
                $error = "The Username or Password that you Entered is not Valid. Try Entering it Again";
        }
    }

    /* close statement */
    $stmt-&gt;close();

    /* close connection */
    $mysqli-&gt;close();
}

include('noscript.php');

?&gt;

&lt;body&gt;

    &lt;h1&gt;TEACHER LOGIN&lt;/h1&gt;

  &lt;form action="&lt;?php echo htmlentities($_SERVER['PHP_SELF']); ?&gt;" method="post" id="teachLoginForm"&gt;        
  &lt;p&gt;Username&lt;/p&gt;&lt;p&gt;&lt;input type="text" name="teacherusername" /&gt;&lt;/p&gt;      &lt;!-- Enter Teacher Username--&gt;
  &lt;p&gt;Password&lt;/p&gt;&lt;p&gt;&lt;input type="password" name="teacherpassword" /&gt;&lt;/p&gt;  &lt;!-- Enter Teacher Password--&gt; 
  &lt;p&gt;&lt;input id="loginSubmit" type="submit" value="Login" name="submit" /&gt;&lt;/p&gt;
  &lt;/form&gt;

  &lt;a href="./forgotpass.php"&gt;Forgot Password&lt;/a&gt;


&lt;/body&gt;

&lt;/html&gt;
</code></pre>

<p><strong>session.class.php</strong></p>

<pre><code>&lt;?php
/*
Simple PHP Session Class:
    a simple class to help managing the Session function in
    php for beginners and it introduces them to OOP where
    they can modify it and add new features and extend its
    functionality (session in database, track users actions,etc)
*/
#Session settings.

#Session cookie lifetime at the user browser. (seconds)
ini_set('session.cookie_lifetime', '0');

#Read the functions reference below before you change these values.
ini_set('session.gc_maxlifetime',7200);# 2 hours.
ini_set('session.gc_probability', '1'); #default PHP value.
ini_set('session.gc_divisor', '100'); #default PHP value.

/*====================================================================

ini_set('session.cookie_lifetime', '0');

    User cookie life time in seconds.
    0 means the cookie wont expire until the user closes the broswer


ini_set('session.gc_maxlifetime',7200); #default: 1440 (24 mins).

    Session Garbage Collection cleaner (GC). 

    7200(seconds) equals to (2 hours): The GC will try to
    clean session data in the server for (users who logged
    out, closed the browser AND users who are inactive for
    more than that time) however the clean function does
    not run directly, read the next block for more explaination.

    PHP manual:
        session.gc_maxlifetime specifies the number of
        seconds after which data will be seen as 'garbage'
        and potentially cleaned up. Garbage collection may
        occur during session start
        (depending on session.gc_probability and session.gc_divisor).


ini_set('session.gc_probability', '1'); #default PHP value (1).
ini_set('session.gc_divisor', '100'); #default PHP value (100).

    Garbage Collection (GC) Settings:
    PHP manual:
        session.gc_divisor coupled with
        session.gc_probability defines the probability
        that the gc (garbage collection) process is started
        on every session initialization. The probability is
        calculated by using gc_probability/gc_divisor
        e.g. 1/100 means there is a 1% chance that the GC
        process starts on each request.
        session.gc_divisor defaults to 100.  
====================================================================*/

/*
    HOW TO USE:
    - include the session file in all your files and call the session object
    require_once('session.class.php');
    $session = new Session();


    GET SESSION ID:
    - $session-&gt;sid;
      @return type (string)
      @example:
      echo $session-&gt;sid;

    GENEREATE NEW SESSION ID:
    - $session-&gt;re();
      @return type (string)
      #note: returns the value of the new session id.
      @example:
      $sid = $session-&gt;sid;
      $new_sid = $session-&gt;re();
      echo "My Session ID is: {$sid} but I got a new one now: {$new_sid};

    ASSIGN NEW SESSION VALUE:
    - $session-&gt;set($key,$value);
      @return type (void)
      @examples:
        $session-&gt;set("name","foo bar");
        $session-&gt;set("age",24);
        $session-&gt;set("auth",TRUE);

    GET SESSION VALUE:
    - $session-&gt;get($key);
      @return type (boolean, int, string, array).
      #note: returns FALSE if the value is not set
      @examples:
      echo $session-&gt;get("name");
      if($session-&gt;get("auth")) echo "hello authorized user!";

      if(($age = $session-&gt;get("age")) &gt; 21)
      echo "your age is {$age}, you can drive!";

    DELETE SESSION VALUE:
    - $session-&gt;delete($key);
      @return type (void);
      @example
      $session-&gt;delete("age");

    DESTROY SESSION
    - $session-&gt;destroy();
      @return type (void);
*/
/*==================================================================*/
class Session{
    public $sid;
    public function __construct() {
        @session_start();
        $this-&gt;sid = session_id();
    }
    public function re(){
        @session_regenerate_id();
        $this-&gt;sid = session_id();
        return $this-&gt;sid;
    }
    public function set($key, $val) {
        $_SESSION[$key] = $val;
        return true;
    }

    public function get($key) {
        if ( isset($_SESSION[$key]) ) {
            return $_SESSION[$key];
        }

        return false;
    }

    public function delete($key) {
        unset($_SESSION[$key]);
    }

    public function destroy() {
        $_SESSION = array();
        session_destroy();
    }
}            
?&gt;
</code></pre>

<p><strong>member.php</strong></p>

<pre><code>&lt;?php
    ini_set('display_errors',1); 
    error_reporting(E_ALL);

    /*
    file: secure.php, profile.php, member.php
    authorized (logged in) users =&gt; log them out and show goodbye msg or send them to login.php
    unauthorized (guests) users =&gt; redirect them to login.php
    */
    require_once('session.class.php');
    $session = new Session();

    #if user is not logged in, he will be sent to the login.php page
    #note the (!) sign before the $session, it means if the $session-&gt;get("auth") == false
    if(!$session-&gt;get("auth")) header("location:teacherlogin.php");

    echo "hello, you are logged in";
    echo "&lt;br /&gt;";
    echo "username: ".$session-&gt;get("teacherusername");
    echo "&lt;br /&gt;";
    echo "teacherid: ".$session-&gt;get("teacherid");
    echo "&lt;br /&gt;";
    echo "active status: ".$session-&gt;get("active") ? "Active" : "Not Active";
    echo "&lt;br /&gt;";
    echo "&lt;a href='logout.php'&gt;Log out&lt;/a&gt;";

?&gt;
</code></pre>
