I am trying to create a simple user login. I have the form set up on another page and I am posting the data to the following page. I know there's no security etc at the moment, I will add that later I am simply just trying to get the whole process to work for now.
Currently, when I submit the form, it takes me to the login.php page which the code for is below but gives me the WSOD! Can anyone point me in the right direction please? Thanks.
<?php
$con=mysqli_connect("localhost","tkernick96","Tylerkernick1996","users");
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$query = mysqli_query($con,"SELECT * FROM users WHERE 'email' = '$_POST[email]' AND 'password' = '$_POST[password]'");
$count = mysqli_num_rows($query);
if($count == 0) {
$output = '<p>Sorry, the information entered was not correct.</p>';
}
else {
$row = mysqli_fetch_array($query,MYSQLI_ASSOC);
$name = $row ['firstname'];
$acclink = $row ['link'];
session_start();
$_SESSION['id']=$_POST['email'];
$_SESSION['name']=$name;
$_SESSION['link']=$acclink;
header('location: index.php');
}
?>