.env en moins normalement

This commit is contained in:
Yasder5 2026-03-03 20:41:35 +01:00
parent f1ef53c4ac
commit c8343faec7
4 changed files with 9 additions and 12 deletions

4
.env
View file

@ -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/

View file

@ -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é ---
<FilesMatch ".env">
Require all denied
</FilesMatch>
<FilesMatch "(composer\.json|composer\.lock|package\.json|package-lock\.json|\.git)">
<FilesMatch "(composer\.json|composer\.lock|package\.json|package-lock\.json|\.git|\.env|\.gitignore|env)">
Require all denied
</FilesMatch>

View file

@ -26,6 +26,6 @@
}
if ($boolError) {
header("Location: index.php?ctrl=error&action=error_404");
exit;
$error = new \Controllers\ErrorCtrl();
return $error->error_404();
}

View file

@ -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");