htaccess c'est vraiment de la merde
This commit is contained in:
parent
5638c0712d
commit
04d7d564f1
5 changed files with 15 additions and 14 deletions
|
|
@ -1,9 +1,8 @@
|
|||
Options -Indexes
|
||||
|
||||
# 1. On définit des URLs propres pour les erreurs
|
||||
ErrorDocument 403 /error/error_403
|
||||
ErrorDocument 404 /error/error_404
|
||||
|
||||
# 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
|
||||
|
|
|
|||
|
|
@ -21,8 +21,8 @@
|
|||
public function admin(){
|
||||
|
||||
if (!isset($_SESSION['user']) && ($_SESSION['user']['user_status'] != 1 )){
|
||||
header("Location:index.php?ctrl=error&action=error_403");
|
||||
exit;
|
||||
$error = new \Controllers\ErrorCtrl();
|
||||
return $error->error_403();
|
||||
}
|
||||
|
||||
$objCategoryModel = new CategoryModel;
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@
|
|||
public function error_404(){
|
||||
http_response_code(404);
|
||||
$this->_display("error_404");
|
||||
exit;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -21,6 +22,7 @@
|
|||
public function error_403(){
|
||||
http_response_code(403);
|
||||
$this->_display("error_403");
|
||||
exit;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -124,8 +124,8 @@
|
|||
*/
|
||||
public function addedit_project() {
|
||||
if (!isset($_SESSION['user'])){
|
||||
header("Location:index.php?ctrl=error&action=error_403");
|
||||
exit;
|
||||
$error = new \Controllers\ErrorCtrl();
|
||||
return $error->error_403();
|
||||
}
|
||||
|
||||
$objProject = new Project;
|
||||
|
|
@ -135,8 +135,8 @@
|
|||
if (isset($_GET['id'])){
|
||||
$arrProject = $objProjectModel->findOne($_GET['id']);
|
||||
if($_SESSION['user']['user_id'] != $arrProject['project_user_id']){
|
||||
header("Location:index.php?ctrl=error&action=error_403");
|
||||
exit;
|
||||
$error = new \Controllers\ErrorCtrl();
|
||||
return $error->error_403();
|
||||
}
|
||||
$objProject->hydrate($arrProject);
|
||||
$this->_arrData['arrImages'] = $objProjectModel->getImagesByProjectId($objProject->getId());
|
||||
|
|
|
|||
|
|
@ -11,8 +11,8 @@
|
|||
try{
|
||||
$this->_db = new PDO(
|
||||
"mysql:host=localhost;dbname=projet_folliow",
|
||||
"projet_user",
|
||||
"F0lliowRules!",
|
||||
"root",
|
||||
"",
|
||||
array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC)
|
||||
);
|
||||
$this->_db->exec("SET CHARACTER SET utf8");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue