title: Page is coming up blank when logging in
body: <p>I am trying to use md5 on my website (its only a local one so really good encryption isn't necessary), my login worked perfectly before this, but now i've implemented md5 and the login button is submitted I get a blank page? I've added error reporting to the top of the page but still nothing. I first of all registered a user to hash their password with md5 then tried logging in- so the login details are correct...</p>
  
  <p>Here is my php and form for the registration page 'register.php'</p>
  
  <pre><code>&lt;div id='form'&gt;
  &lt;form method ="post" action="register.php"&gt;
  &lt;fieldsetclass="fieldset-width"&gt;
  &lt;legend&gt;
  Enter New Details
  &lt;/legend&gt;
  &lt;input type="hidden" name="ID"/&gt;    
  &lt;label for="email"&gt;Email: &lt;/label&gt;
  &lt;input type = "text" name="email" /&gt;
  &lt;br/&gt;
  &lt;label for ="password"&gt; Password: &lt;/label&gt;
  &lt;input type = "password" name="password" /&gt;
  &lt;/fieldset&gt;
  &lt;input type="submit" value="submit" name="submit" /&gt;
  &lt;input type="reset" value="clear" /&gt;
  &lt;/form&gt;
  &lt;?php 
  if(isset($_POST['submit'])){
  $errorString = ""; // This creates a string to collect  any errors 
  
  $email = trim($_POST["email"]); 
  
  if (empty($email)) { 
  
  $errorString = $errorString."&lt;br&gt;&lt;font color=red&gt;Please supply an email."; 
  $email = htmlentities(strip_tags($email)); //removes slashes, striptags and disables html tags
  }
  elseif(!filter_var($email, FILTER_VALIDATE_EMAIL))
  {
  $errorString = $errorString."&lt;br&gt;&lt;font color=red&gt;Invalid Email."; 
  }
  
  $password = trim($_POST["password"]); 
  
  if (empty($password)) { 
  print $errorString = $errorString."&lt;br&gt;&lt;font color=red&gt;Please supply a password."; 
  $password = htmlentities(strip_tags($password));
  }
  
  // check if there were any errors 
  
  else {  //There wer No errors. Insert the data 
  $connection = mysqli_connect('localhost', 'c3410801', 'tatiana1', 'c3410801')
  or exit ("Unable to     connect");
  $id = mysqli_insert_id($connection); 
  $password = md5($_POST["password"]); // creates encryption for the users password 
  $query= "INSERT INTO users (ID, password, email) VALUES ('$id','$password','$email')";
  
  $result = mysqli_query($connection,$query) or exit ("Error in query: $query. ".mysqli_error()); 
  
  
  
  // print message with ID of inserted record 
  print "&lt;br/&gt;Thankyou for registering $email &lt;br /&gt; 
  Your password is encrypted as: $password &lt;br/&gt;
  please login with this and supply a new password"; 
  print "&lt;br/&gt;&lt;a href=\"homepage.php\"&gt;Login&lt;/a&gt;"; 
  }// End else - there where no errors 
  }//End 'if submit'
  ?&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is the homepage which has the login form - 'homepage.php</p>
  
  <pre><code>&lt;?php 
  session_start(); 
  
  // Check if we have already created a authenticated session 
  
  ?&gt;&lt;!doctype html&gt;
  &lt;html lang="en"&gt;
  &lt;head&gt;
  &lt;link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'&gt;
  &lt;title&gt;Style Boutique&lt;/title&gt;
  &lt;link rel="stylesheet" href="gumby/css/gumby.css"&gt;
  &lt;link rel="stylesheet" href="custom.css"&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;header&gt;
      &lt;p&gt;&lt;IMG class="displayed" src="logo.png" alt="Logo"&gt;
  
  
      &lt;div id="nav"&gt;
  &lt;ul&gt;
  &lt;li&gt;&lt;a href="homepage.php"&gt;HOME&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="clothes.php"&gt;CLOTHES&lt;/a&gt;
  &lt;li&gt;&lt;a href="shoes.php"&gt;SHOES&lt;/a&gt;
  &lt;li&gt;&lt;a href="accessories.php"&gt;ACCESSORIES&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;&lt;a href="register.php"&gt;REGISTER&lt;/a&gt;&lt;/li&gt;
                      &lt;/ul&gt;
                  &lt;/li&gt;
  &lt;br class="clearboth"/&gt;
  &lt;/div&gt;
  &lt;div id= "form"&gt;
  &lt;h2&gt;Login&lt;/h2&gt; 
  &lt;?php 
  if (isset($_SESSION["authenticatedUserEmail"])) {
  echo 'Welcome back &lt;br/&gt;'.$_SESSION["authenticatedUserEmail"]. '&lt;br/&gt;';
  echo '&lt;a href="logout.php"&gt;logout&lt;/a&gt; | &lt;a href="account.php"&gt;my account&lt;/a&gt;';
  } else {
  if(isset($_GET['form']) &amp;&amp; $_GET['form']=='invalid') {
      echo "&lt;font color=red&gt;Must enter Username &lt;br/&gt; and Password&lt;/font&gt;"; 
  }
  if(isset($_GET['user']) &amp;&amp; $_GET['user']=='invalid') {
      echo "&lt;font color=red&gt;Invalid User&lt;/font&gt;"; 
  }
  if(isset($_GET['email']) &amp;&amp; $_GET['email']=='invalid') {
      echo "&lt;font color=red&gt;Invalid email&lt;/font&gt;"; 
  }
  ?&gt; 
  &lt;form method="post" action="loginaction.php"&gt; 
      Email: 
      &lt;input type="text" size=10 maxlength=40 name="email"&gt;&lt;/br&gt;
      Password:
      &lt;input type="password" size=10 maxlength=15 name="password"&gt;&lt;br/&gt; 
      &lt;input name="submit" type="submit" value="Log in"&gt; 
      &lt;input name="reset" type="reset" value="Clear"&gt; 
  &lt;/form&gt;
  &lt;?php
  if(isset($_GET['logout']) &amp;&amp; $_GET['logout']=='success') {
      echo "&lt;font color=blue&gt;Logout success&lt;/font&gt;"; 
  }
  } 
  ?&gt;
  &lt;/div&gt;
  &lt;div id="content"&gt;
  
  &lt;a href="womens_shoes.php"&gt;&lt;img src="boots1.jpg" style="float:left;" /&gt;&lt;/a&gt;
  &lt;img src="girl.png" style="float:left;" /&gt;
  
  &lt;a href="womens_shoes.php"&gt;&lt;img src="home.png" style="float:right;" /&gt;&lt;/a&gt;
  &lt;a href="register.php"&gt;&lt;img src="signup.png" style="float:left;" /&gt;&lt;/a&gt;
  
  &lt;div id="bottom"&gt; 
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/body&gt; 
  &lt;/html&gt;
  </code></pre>
  
  <p>And finally my loginaction.php, this connects to the form and seems to be the problem here</p>
  
  <pre><code>&lt;?php 
  error_reporting(E_ALL | E_STRICT);  
  ini_set('display_startup_errors',1);  
  ini_set('display_errors',1);
  
  session_start();
  
  $connection = mysqli_connect('localhost', 'c3410801', 'tatiana1', 'c3410801')
  or exit ("Unable to  connect");
  
  $email = trim($_POST["email"]);
  $password = trim($_POST["password"]); //encrypts but allows user to log in as there own password
  $password = md5($password); 
  
  if (empty($email) or empty($password)) {
  header("Location: homepage.php?form=invalid");   //Redirection information
  exit;
  }
  
  if(!filter_var($email, FILTER_VALIDATE_EMAIL)) // this checks that my email is validated.
  {
  echo "E-mail is not valid";
  header("Location: homepage.php?email=invalid");
  
  }
  
  $query = "SELECT * FROM users WHERE email= '$email' AND password = '$password' ";
   // this is my query to gather the username and password that rhe user enters
  $result = mysqli_query($connection, $query) or exit("Error in query: $query. " . mysqli_error());
  
  
  
  if ($row = mysqli_fetch_assoc($result)) {
  //this checks to see if any rows were returned and if they were it selects the session variables.
  $_SESSION["authenticatedUserEmail"] = $email;
  $_SESSION['ID'] = $row['ID'];
  $_SESSION["password"] = $row['password']; 
  $_SESSION["usertype"] = $row['usertype'];
  
  if ($_SESSION["usertype"] == '1'){
  header("Location: admin.php");
  } else {
  header("Location: profile.php");
  }
  
  } //End else
  
  ?&gt;
  </code></pre>