Hoe kan ik hoofdlettergevoeligheid uitschakelen bij mijn login systeem? Hieronder staat mijn code, en alvast bedankt voor de hulp.
index.php
<?php
session_start(); // START SESSION \\
// INCLUDE SOME FILES \\
include_once 'paneel/include/init.php';
include_once 'paneel/include/functions.php';
if (loggedIn() == true) {
header('Location: paneel/dashboard');
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<title>
Inloggen
</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<script src="paneel/assets/js/index.js"></script>
<meta charset="UTF-8">
<title>Het inlog systeem</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="stylesheet prefetch" href="http://fonts.googleapis.com/css?family=Roboto:400,100,300,500,700,900|RobotoDraft:400,100,300,500,700,900">
<link rel="stylesheet prefetch" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="paneel/assets/css/index.css">
</head>
<body>
<div class="pen-title">
<h1>Novara Bank</h1><span>Het nieuwste community paneel</span>
</div>
<!-- Form Module-->
<div class="module form-module">
<div class="toggle"><i class="fa fa-times fa-pencil"></i>
<div class="tooltip">Click Me</div>
</div>
<div class="form">
<h2>Login op je account</h2>
<form action="./" method="POST">
<input type="text" name="username" id="name" placeholder="Gebruikersnaam" autofocus>
<input type="password" name="password" id="word" placeholder="Wachtwoord">
<input type="submit" id="login" value="Inloggen">
</form>
</div>
<div class="form">
<h2>Maak je account aan</h2>
<form action="./" method="POST">
<input type="text" name="regusername" id="regname" placeholder="Gebruikersnaam">
<input type="password" name="regword" id="regword" placeholder="Wachtwoord">
<input type="password" name="regwordher" id="regwordher" placeholder="Wachtwoord herhalen">
<input type="email" name="email" id="email" placeholder="Emailadres">
<input type="submit" id="register" value="Inloggen">
</form>
</div>
<div class="cta"><a href="./" onclick="showPassForget()">Wachtwoord vergeten?</a></div>
</div>
<script src="paneel/assets/js/index.js"></script>
<div onclick="closeWindow()" class="err" id="add_err"></div>
</body>
</html>
index.js
// Toggle Function
$('.toggle').click(function(){
// Switches the Icon
$(this).children('i').toggleClass('fa-pencil');
// Switches the forms
$('.form').animate({
height: "toggle",
'padding-top': 'toggle',
'padding-bottom': 'toggle',
opacity: "toggle"
}, "slow");
});
$(document).ready(function(){
$("#add_err").css('display', 'none', 'important');
$("#login").click(function(){
username=$("#name").val();
password=$("#word").val();
$.ajax({
type: "POST",
url: "paneel/include/login.php",
data: "name="+username+"&word="+password,
success: function(html){
if(html=='true') {
$("#add_err").css('display', 'inline', 'important');
$("#add_err").html('U bent met succes ingelogd.');
var x = document.getElementById("add_err")
$("#add_err").addClass("show");
setTimeout(function(){ x.className = x.className.replace("show", "");}, 2000);
window.setTimeout(function() {
window.location.href = 'paneel/dashboard';
}, 2000);
}
else if(html=='required') {
$("#add_err").css('display', 'inline', 'important');
$("#add_err").html('Gelieve alle velden in te vullen.');
var x = document.getElementById("add_err")
$("#add_err").addClass("show");
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 15000);
}
else {
$("#add_err").css('display', 'inline', 'important');
$("#add_err").html('Foutieve login gegevens.');
var x = document.getElementById("add_err")
$("#add_err").addClass("show");
setTimeout(function(){ x.className = x.className.replace("show", ""); }, 15000);
}
},
beforeSend:function()
{
$("#add_err").css('display', 'inline', 'important');
$("#add_err").html("Controleren...")
}
});
return false;
});
});
function closeWindow() {
$("#add_err").html("Sluiten...");
setTimeout(function() {
$("#add_err").removeClass("show");
}, 1000);
}
login.php
<?php
session_start();
include_once 'init.php';
$username = $conn->real_escape_string($_POST['name']);
$password = $_POST['word'];
if(!empty($username and $password)) {
$result = $conn->query("SELECT * FROM `users` WHERE `username`='$username'");
if (FALSE === $result) {
echo 'error';
exit();
}
$row = $result->fetch_assoc();
if ($username == $row['username']) {
if (password_verify($password, $row['password'])) {
echo 'true';
$result = $conn->query("SELECT * FROM `users` WHERE `username`='$username'");
if (FALSE === $result) { } else {
$_SESSION['id'] = $row['id'];
}
} else {
echo 'false';
}
} else {
echo 'false';
}
} else {
echo 'required';
}
?>