Compare commits

...

7 Commits

Author SHA1 Message Date
niklas.ortmann 35d4425086 Update index-controller.php 2026-07-18 16:19:48 +02:00
niklas.ortmann d3435d4cde Update index.php 2026-07-18 16:14:09 +02:00
niklas.ortmann f61c548b9e Update index.php 2026-07-18 16:11:53 +02:00
niklas.ortmann 101a2a247b Update index-controller.php 2026-07-18 16:08:05 +02:00
niklas.ortmann 423941e7ed Update index-controller.php 2026-07-18 16:06:35 +02:00
niklas.ortmann a8e76c782d Update index-controller.php 2026-07-18 15:53:33 +02:00
niklas.ortmann 3f9c048493 Update index.php 2026-07-18 15:53:31 +02:00
2 changed files with 24 additions and 25 deletions
+2 -4
View File
@@ -2,9 +2,7 @@
if (session_status() === PHP_SESSION_NONE) {
session_start();
}
include_once("php/controller/index-controller.php");
include_once "php/controller/index-controller.php";
?>
<!DOCTYPE html>
<html lang="de">
@@ -38,7 +36,7 @@ include_once("php/controller/index-controller.php");
<?php
include_once 'includes/navbar.php';
// Dynamischer Inhalt (Absolut sicher durch die obige Prüfung)
// Dynamischer Inhalt
if (isset($pfad) && $pfad !== "404" && file_exists('content/' . $pfad . '.php')) {
include_once 'content/' . $pfad . '.php';
} else {
+22 -21
View File
@@ -1,7 +1,28 @@
<?php
// Standardpfad
$pfad = $_GET["pfad"] ?? "home";
// Allowlist für Content
if ($pfad === "logout") {
include_once "php/controller/logout-controller.php";
exit();
} elseif ($pfad === "deleteAccount") {
include_once "php/controller/deleteAccount-controller.php";
exit();
}
if ($pfad === "login") {
include_once "php/controller/login-controller.php";
} elseif ($pfad === "register") {
include_once "php/controller/register-controller.php";
} elseif ($pfad === "password-forgotten") {
include_once "php/controller/password-forgotten-controller.php";
} elseif ($pfad === "confirm-register") {
include_once "php/controller/confirm-register-controller.php";
} elseif ($pfad === "confirm-password") {
include_once "php/controller/confirm-password-controller.php";
}
// Whitelist
$erlaubte_content_seiten = [
"accessibility", "confirm-password", "confirm-register", "createArticle",
"datenschutz", "home", "impressum", "login", "nutzungsbedingungen",
@@ -9,26 +30,6 @@ $erlaubte_content_seiten = [
"show-mail", "showArticle", "showCategory", "updateArticle"
];
// Allowlist für Controller
$erlaubte_controller = [
"confirm-password", "confirm-register", "createArticle", "deleteAccount",
"deleteArticle", "home", "index", "like", "login", "logout",
"password-forgotten", "profile", "profileArticles", "register",
"search-results", "showArticle", "showCategory", "updateArticle"
];
// Validierung der Content-Seite
if (!in_array($pfad, $erlaubte_content_seiten)) {
$pfad = "404";
}
// Automatisch den passenden Controller laden, falls erlaubt
if ($pfad !== "404" && in_array($pfad, $erlaubte_controller)) {
include_once "../php/controller/" . $pfad . "-controller.php";
// Nach Logout oder Account-Löschung das Skript sofort beenden
if ($pfad === "logout" || $pfad === "deleteAccount") {
exit();
}
}
?>