I am having an issue having the page redirect to MyJournal.php. I hope that you guys can understand what the issue is because I am hitting a stump. Thanks in advance!
<?php
session_start();
//Connect to Database
include('mysqli.php');
//If Login Button is pressed, check credentials
if (isset($_POST['btnLogin']))
{
$email = mysqli_real_escape_string($connect,$_POST['email']);
$password = mysqli_real_escape_string($connect,$_POST['password']);
//$sql = 'SELECT * FROM User WHERE Email='.'$email';
$sql = "SELECT * FROM User WHERE Email = '$email' and Password = '$password'";
$result = mysqli_query($connect,$sql);
$row = mysqli_fetch_array($result,MYSQLI_ASSOC);
$active = $row['active'];
$count = mysqli_num_rows($result);
// If result matched $myusername and $mypassword, table row must be 1 row
if($count == 1)
{
$_SESSION['login_user'] = $email;
//echo 'reached redirect';
header("Location: MyJournal.php");
exit();
}
else {
echo '<div class="alert alert-danger fade in">
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
<strong>Error!</strong> Invalid Username and Password Combination.
</div>';
}
mysqli_close($connect);
?>