Current directory: /home/klas4s23/domains/585455.klas4s23.mid-ica.nl/public_html/Gastenboek/uploads
<?php
session_start();
include_once 'classes/database.php';
$errormsg = "";
if (isset($_GET['error'])) {
$errormsg = "<div style='color: red;'>" . htmlspecialchars($_GET['error']) . "</div>";
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$username = htmlspecialchars($_POST['username']);
$password = $_POST['password'];
if (database::login($username, $password)) {
$_SESSION['username'] = $username;
header('Location: index.php');
exit();
} else {
header("Location: " . $_SERVER['REQUEST_URI'] . "?error=" . htmlspecialchars(Database::$error), true, 303);
exit();
}
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Inloggen</title>
<link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="container">
<h2>Inloggen</h2>
<form method="post" action="login.php">
<label for="username">Gebruikersnaam:</label>
<input type="text" id="username" name="username" required>
<label for="password">Wachtwoord:</label>
<input type="password" id="password" name="password" required>
<input type="submit" value="Inloggen">
<div>Nog geen account? <a href="register.php">Maak een nieuwe account aan</a></div>
</form>
</div>
</body>
</html>