I have a PHP login form but it's not working, what's wrong with my code? It used to work perfectly fine, maybe I changed something but didn't notice it.
<?php
include 'functions.php';
if( !isset( $_SESSION ) )
{
session_start();
}
if( isset( $_SESSION['ingelogd'] ) )
{
redirect('index.php');
}
$msg='';
Database details
$conn = new mysqli( $dbhost, $dbuser, $dbpass, $dbname );
if ( $conn->connect_error ) die("Connection failed");
if( isset( $_POST['submit'] ) ) {
$uname = $_POST['username'];
$wwoord = $_POST['password'];
$query = "SELECT * FROM `Klanten` WHERE `klant_username`='$uname' and `klant_wachtwoord`='$wwoord' limit 1";
$result = $conn->query( $query );
if( $result->num_rows==1 )
{
$_SESSION['ingelogd'] = true;
$_SESSION['username'] = $result['klant_username'];
redirect('index.php');
}
else
{
redirect('/?p=i'); }
}
?>