erste Version Login Fenster und Mock-Login.php

This commit is contained in:
2024-12-02 10:20:46 +01:00
parent dbc166ea0a
commit 8c3dda36c1
2 changed files with 68 additions and 0 deletions

30
webseite/login.php Normal file
View File

@@ -0,0 +1,30 @@
<?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.";
}
?>