123456/V5 PO PHP/Chahid en Camiel/project/inlogx.php
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" type="text/css" href="style.css?t <?php echo time();?>">
<?php
if(isset($_POST['username']) && isset($_POST['password'])){ // Controleert of 'username' en 'password' zijn ingesteld via POST
$username = $_POST['username']; // Haalt de waarde van 'username' op uit POST
$password = $_POST['password']; // Haalt de waarde van 'password' op uit POST
}
?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<!-- Formulier voor inloggen -->
<form method='post' action ='' class='inlog'>
<div>Naam <input type='text' name='username' value="" class='inlog_knoppen'></div> <!-- Invoerveld voor gebruikersnaam (Grimme) -->
<div>Wachtwoord <input type='password' name='password' value="" class='inlog_knoppen'></div> <!-- Invoerveld voor wachtwoord (Grimme) -->
<div><input type='submit' value='Aanmelden' class='inlog_knoppen'></div> <!-- Verzendknop -->
</form>
<?php
include('menubalkx.php'); // Inclusief menubalkx.php bestand
include('db.php'); // Inclusief database bestand
include('function.php'); // Inclusief function.php bestand
// Controleert of de ingevoerde gegevens correct zijn
if(isset($_POST['username']) && isset($_POST['password'])){
if($username == "Grimme" && $password == "Grimme"){
echo "<div class='inlog'>je bent ingelogd</div>"; // Bericht bij succesvolle login
setcookie('admin', true, time() +60*60*24); // Stelt een cookie in die 24 uur geldig is
}
else{
echo "<div class='inlog'>De inloggegevens zijn onjuist</div>"; // Bericht bij onjuiste login
}
}
?>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse