Weitere Reviewänderungen

This commit is contained in:
2026-05-31 22:21:50 +02:00
parent f9ab3f8db2
commit 541d5b4c5e
7 changed files with 158 additions and 71 deletions
+5 -29
View File
@@ -1,33 +1,7 @@
<?php
require_once "includes/LocalUserDAO.php";
include_once 'php/controller/register-controller.php';
$dao = new LocalUserDAO();
$error = null;
/*
Verarbeitung des Registrierungs-Formulars
Funktion: Erstellt neuen Benutzer und speichert ihn im DAO + Session
*/
if ($_SERVER["REQUEST_METHOD"] === "POST") {
$email = $_POST["email"];
$vorname = $_POST["vorname"];
$nachname = $_POST["nachname"];
$password = password_hash($_POST["password"], PASSWORD_DEFAULT);
if ($dao->findUser($email)) {
$error = "Diese E-Mail-Adresse ist bereits registriert.";
} else {
$dao->addUser($email, $vorname . " " . $nachname, $password);
$_SESSION["user"] = $vorname . " " . $nachname;
$_SESSION["user_email"] = $email;
header("Location: index.php");
exit();
}
}
$error = $error ?? null;
?>
<!--
@@ -40,7 +14,9 @@ if ($_SERVER["REQUEST_METHOD"] === "POST") {
<h1>Jetzt Registrieren!</h1>
<?php if ($error): ?>
<p style="color:red;"><?php echo $error; ?></p>
<p style="color:red;">
<?php echo htmlspecialchars($error); ?>
</p>
<?php endif; ?>
<form method="post" action="index.php?pfad=register">