34 lines
781 B
PHP
34 lines
781 B
PHP
<?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>
|
|
|