Copie propre du code final de Folliow (projet d'équipe DWWM)
This commit is contained in:
commit
eed64cfeb6
67 changed files with 17897 additions and 0 deletions
32
index.php
Normal file
32
index.php
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
<?php
|
||||
session_start();
|
||||
require(__DIR__ . "/vendor/autoload.php");
|
||||
|
||||
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
|
||||
$dotenv->safeLoad();
|
||||
|
||||
$strCtrl = preg_replace('/[^a-zA-Z]/', '', $_GET['ctrl'] ?? 'project');
|
||||
$strMethod = preg_replace('/[^a-zA-Z_]/', '', $_GET['action'] ?? 'home');
|
||||
|
||||
$strClassName = "Controllers\\" . ucfirst($strCtrl) . "Ctrl";
|
||||
|
||||
$boolError = false;
|
||||
|
||||
if (class_exists($strClassName)) {
|
||||
$objController = new $strClassName();
|
||||
|
||||
if (method_exists($objController, $strMethod)) {
|
||||
$objController->$strMethod();
|
||||
} else {
|
||||
$boolError = true;
|
||||
}
|
||||
} else {
|
||||
$boolError = true;
|
||||
}
|
||||
|
||||
if ($boolError) {
|
||||
http_response_code(404); // ← important pour le SEO et les navigateurs
|
||||
$error = new \Controllers\ErrorCtrl();
|
||||
$error->error_404(); // ← pas de "return", juste l'appel
|
||||
exit; // ← stoppe l'exécution après l'affichage
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue