erste Version Login Fenster und Mock-Login.php
This commit is contained in:
30
webseite/login.php
Normal file
30
webseite/login.php
Normal 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.";
|
||||
}
|
||||
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user