The latest little 'challenge' I've made for myself is trying to code a good login screen on a site I'm making for some friends. However, when I input my email and password as they are displayed in my SQL database, the file I use to check it with does not send out anything at all. My code looks as follows:
<?php
session_start();
if (isset($_SESSION['user'])) {
header('Location: mainpage.php');
}
require_once 'config.php';
$error_message = '';
if (isset($_POST['submit'])) {
$db = "epiz_31045019_TCDB";
$response = $db->check_credentials($_POST['email'], $_POST['password']);
if ($response['status'] == 'success') {
$_SESSION['user'] = array('id' => $response['id'], 'nickname' => $response['nickname']);
header('Location: mainpage.php');
}
}
?>
If that might prove to be useful, here are my login form and the config code I'm including as well:
<?php
$hostnaam = "host.com";
$gebruikersnaam = "username";
$wachtwoord = "password";
$db = "database";
$verbinding = mysqli_connect($hostnaam, $gebruikersnaam, $wachtwoord,
$db) or die ("Er kan geen verbinding tot stand worden gebracht:" .
mysqli_connect_error());
?>
<form action="datacheck.php" method="POST">
<div class="form-field">
<input type="email" name="email" id="email" placeholder="E-mailadres" required />
</div> <br>
<div class="form-field">
<input type="password" name="password" id="password" placeholder="Wachtwoord" required />
</div> <br>
<div class="form-field">
<button class="btn" type="submit">Log in</button>
</div>
</form>