l108/PO/inloggen.php
<?php
include "db.php";
include "functions.php";
$ingelogd=false;
if ($_POST["gebruikersnaam"]) {
inloggen($_POST["gebruikersnaam"], $_POST["wachtwoord"]);
$ingelogd = true;
}
if ($_GET["uitloggen"]){
uitloggen();
header("Location: inloggen.php");
}
if (ingelogd()){
$ingelogd = true;
}
?>
<!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>
<link rel="stylesheet" type="text/css" href="style.css">
<?php
include "nav.php";
?>
<div class="content winkel">
<h1>Inloggen</h1>
<div class="producten login">
<?php
if(ingelogd() || $ingelogd) {
echo '<h2>Je bent al ingelogd!</h2>';
echo '<div><a href="inloggen.php?uitloggen=true">Uitloggen</a></div>';
}
else {
echo '<form action="" method="POST">
<div><input type="text" placeholder="Gebruikersnaam" name="gebruikersnaam" id="gebruikersnaam"></div>
<div><input type="password" name="wachtwoord" id="wachtwoord" placeholder="Wachtwoord"></div>
<div><input type="submit" name="submit" id="submit" value="Inloggen"></div>
</form>';
}?>
</div>
</div>
</body>
</html>
Resultaat
Made by Thijs Aarnoudse