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...

Here is my php and form for the registration page 'register.php'

```
<div id='form'>
<form method ="post" action="register.php">
<fieldsetclass="fieldset-width">
<legend>
Enter New Details
</legend>
<input type="hidden" name="ID"/>    
<label for="email">Email: </label>
<input type = "text" name="email" />
<br/>
<label for ="password"> Password: </label>
<input type = "password" name="password" />
</fieldset>
<input type="submit" value="submit" name="submit" />
<input type="reset" value="clear" />
</form>
<?php 
if(isset($_POST['submit'])){
$errorString = ""; // This creates a string to collect  any errors 

$email = trim($_POST["email"]); 

if (empty($email)) { 

$errorString = $errorString."<br><font color=red>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."<br><font color=red>Invalid Email."; 
}

$password = trim($_POST["password"]); 

if (empty($password)) { 
print $errorString = $errorString."<br><font color=red>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 "<br/>Thankyou for registering $email <br /> 
Your password is encrypted as: $password <br/>
please login with this and supply a new password"; 
print "<br/><a href=\"homepage.php\">Login</a>"; 
}// End else - there where no errors 
}//End 'if submit'
?>
</div>
</body>
</html>

```

This is the homepage which has the login form - 'homepage.php

```
<?php 
session_start(); 

// Check if we have already created a authenticated session 

?><!doctype html>
<html lang="en">
<head>
<link href='http://fonts.googleapis.com/css?family=PT+Sans' rel='stylesheet' type='text/css'>
<title>Style Boutique</title>
<link rel="stylesheet" href="gumby/css/gumby.css">
<link rel="stylesheet" href="custom.css">
</head>
<body>
<header>
    <p><IMG class="displayed" src="logo.png" alt="Logo">

    <div id="nav">
<ul>
<li><a href="homepage.php">HOME</a></li>
<li><a href="clothes.php">CLOTHES</a>
<li><a href="shoes.php">SHOES</a>
<li><a href="accessories.php">ACCESSORIES</a></li>
<li><a href="register.php">REGISTER</a></li>
                    </ul>
                </li>
<br class="clearboth"/>
</div>
<div id= "form">
<h2>Login</h2> 
<?php 
if (isset($_SESSION["authenticatedUserEmail"])) {
echo 'Welcome back <br/>'.$_SESSION["authenticatedUserEmail"]. '<br/>';
echo '<a href="logout.php">logout</a> | <a href="account.php">my account</a>';
} else {
if(isset($_GET['form']) && $_GET['form']=='invalid') {
    echo "<font color=red>Must enter Username <br/> and Password</font>"; 
}
if(isset($_GET['user']) && $_GET['user']=='invalid') {
    echo "<font color=red>Invalid User</font>"; 
}
if(isset($_GET['email']) && $_GET['email']=='invalid') {
    echo "<font color=red>Invalid email</font>"; 
}
?> 
<form method="post" action="loginaction.php"> 
    Email: 
    <input type="text" size=10 maxlength=40 name="email"></br>
    Password:
    <input type="password" size=10 maxlength=15 name="password"><br/> 
    <input name="submit" type="submit" value="Log in"> 
    <input name="reset" type="reset" value="Clear"> 
</form>
<?php
if(isset($_GET['logout']) && $_GET['logout']=='success') {
    echo "<font color=blue>Logout success</font>"; 
}
} 
?>
</div>
<div id="content">

<a href="womens_shoes.php"><img src="boots1.jpg" style="float:left;" /></a>
<img src="girl.png" style="float:left;" />

<a href="womens_shoes.php"><img src="home.png" style="float:right;" /></a>
<a href="register.php"><img src="signup.png" style="float:left;" /></a>

<div id="bottom"> 
</div>
</div>
</body> 
</html>

```

And finally my loginaction.php, this connects to the form and seems to be the problem here

```
<?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

?>

```