31 lines
911 B
PHP
31 lines
911 B
PHP
<?php
|
|
|
|
// Mock credentials for the login
|
|
$validUsername = 'admin';
|
|
$validPassword = 'password';
|
|
|
|
// Check if the form was submitted
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
// Get the submitted username and password
|
|
$username = isset($_POST['username']) ? $_POST['username'] : '';
|
|
$password = isset($_POST['password']) ? $_POST['password'] : '';
|
|
|
|
// Validate credentials
|
|
if ($username === $validUsername && $password === $validPassword) {
|
|
echo "Login erfolgreich";
|
|
// Redirect to dashboard or any other page
|
|
header("Location: index.php");
|
|
exit;
|
|
} else {
|
|
// Set an error message in the session to show on the login page
|
|
$_SESSION['errorMessage'] = "Login fehlgeschlagen: Falscher Benutzername oder Passwort.";
|
|
header("Location: index.php");
|
|
exit;
|
|
}
|
|
} else {
|
|
echo "Bitte benutzen Sie das Login-Formular.";
|
|
}
|
|
|
|
|
|
?>
|