1e versie
This commit is contained in:
33
public/login.php
Normal file
33
public/login.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once __DIR__ . '/../includes/ldap.php';
|
||||
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$user = $_POST['username'] ?? '';
|
||||
$pass = $_POST['password'] ?? '';
|
||||
|
||||
if (ldap_authenticate($user, $pass)) {
|
||||
$_SESSION['user'] = $user;
|
||||
header('Location: dashboard.php');
|
||||
exit;
|
||||
} else {
|
||||
$error = 'Ongeldige login.';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head><title>Login</title></head>
|
||||
<body>
|
||||
<h2>Login</h2>
|
||||
<form method="post">
|
||||
<label>Gebruikersnaam: <input type="text" name="username"></label><br>
|
||||
<label>Wachtwoord: <input type="password" name="password"></label><br>
|
||||
<button type="submit">Aanmelden</button>
|
||||
</form>
|
||||
<p style="color:red"><?= htmlspecialchars($error) ?></p>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user