From c8343faec74942c5e46f08d8836c758811498cf1 Mon Sep 17 00:00:00 2001
From: Yasder5 <102179445+Yasder5@users.noreply.github.com>
Date: Tue, 3 Mar 2026 20:41:35 +0100
Subject: [PATCH] .env en moins normalement
---
.env | 4 ++--
.htaccess | 7 ++-----
index.php | 4 ++--
models/MotherModel.php | 6 +++---
4 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/.env b/.env
index 224a3e6..618baab 100644
--- a/.env
+++ b/.env
@@ -1,9 +1,9 @@
# config BDD
DB_CONNECTION=mysql
-DB_HOSTNAME=boulayoune.com
+DB_HOSTNAME=localhost
DB_DATABASE=projet_folliow
-DB_USERNAME=
+DB_USERNAME=root
DB_PASSWORD=
IMG_PROJECT_PATH = uploads/projects/
diff --git a/.htaccess b/.htaccess
index b0d792e..697ae9f 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,14 +1,11 @@
Options -Indexes
-# Rediriger les erreurs serveur vers ton contrôleur
-# On force le passage par index.php pour que ton routeur reçoive les paramètres
-ErrorDocument 404 /index.php?ctrl=error&action=error_404
-ErrorDocument 403 /index.php?ctrl=error&action=error_403
+
# --- Sécurité ---
Require all denied
-
+
Require all denied
diff --git a/index.php b/index.php
index 0b6c7b0..0302ebf 100644
--- a/index.php
+++ b/index.php
@@ -26,6 +26,6 @@
}
if ($boolError) {
- header("Location: index.php?ctrl=error&action=error_404");
- exit;
+ $error = new \Controllers\ErrorCtrl();
+ return $error->error_404();
}
\ No newline at end of file
diff --git a/models/MotherModel.php b/models/MotherModel.php
index df9f2f7..079d791 100644
--- a/models/MotherModel.php
+++ b/models/MotherModel.php
@@ -10,9 +10,9 @@
public function __construct(){
try{
$this->_db = new PDO(
- "mysql:host=localhost;dbname=projet_folliow",
- "projet_user",
- "F0lliowRules!",
+ "mysql:host=".$_ENV['DB_HOSTNAME'].";dbname=".$_ENV['DB_DATABASE'],
+ $_ENV['DB_USERNAME'],
+ $_ENV['DB_PASSWORD'],
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC)
);
$this->_db->exec("SET CHARACTER SET utf8");