l102/11/11.9.php
<!DOCTYPE html>
<html lang="en">
<head>
<?php
$usernamecorrect = "ballenlikker";
$passwordcorrect = "admin";
if(isset($_POST['username']) && isset($_POST['password'])){
$username = $_POST['username'];
$password = $_POST['password'];
setcookie('username',$_POST['username'], 0);
setcookie('password',$_POST['password'], 0);
}
else{
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<form method='post' action =''>
<div>Username <input type='text' name='username' value="" required></div>
<div>Password <input type='password' name='password' value="" required></div>
<div><input type='submit' valuea='Aanmelden'></div>
</form>
<?php
if ($username == $usernamecorrect && $password == $passwordcorrect){
echo "Welkom $username";
}
elseif ($username == $usernamecorrect || $password == $passwordcorrect){
echo "de gebruikersnaam of wachtwoord is verkeerd ingevuld";
}
else{
echo "Sorry, geen toegang";
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse