diff --git a/controllers/admin_controller.php b/controllers/admin_controller.php index ea4ee7b..9b38286 100644 --- a/controllers/admin_controller.php +++ b/controllers/admin_controller.php @@ -18,31 +18,28 @@ class AdminCtrl extends MotherCtrl{ public function admin(){ - /*accès à la page admin + if (!isset($_SESSION['user']) && ($_SESSION['user']['user_status'] != 1 )){ header("Location:index.php?ctrl=error&action=error_403"); exit; - }*/ + } $objCategoryModel = new CategoryModel; if (!empty($_POST['new_category'])) { - $objNewCategory = new Category; - if (!empty($objNewCategory->getName())) { - $objNewCategory = $_POST['new_category']; - $objCategoryModel->insertCategory($objNewCategory); - header("Location:index.php?ctrl=admin&action=admin"); - exit; - } + $newCat = new Category(); + $newCat->setName($_POST['new_category']); + $objCategoryModel->insertCategory($newCat); + header('Location: index.php?ctrl=admin&action=admin'); + exit; } - if (!empty($_POST['edit_category'])) { - $objEditCategory = new Category; - if ($objEditCategory->getId() > 0) { - $objEditCategory = $_POST['edit_category']; - $objCategoryModel->editCategory($objEditCategory); - header("Location:index.php?ctrl=admin&action=admin"); - exit; - } + if (!empty($_POST['id_to_edit']) && !empty($_POST['new_name'])) { + $editCat = new Category(); + $editCat->setId($_POST['id_to_edit']); + $editCat->setName($_POST['new_name']); + $objCategoryModel->editCategory($editCat); + header('Location: index.php?ctrl=admin&action=admin'); + exit; } $arrCategory = $objCategoryModel->findAllCategory(); @@ -54,8 +51,8 @@ $arrCategoryToDisplay[] = $objCategory; } + //gérer l'affichage $this->_arrData['arrCategoryToDisplay'] = $arrCategoryToDisplay; - //$this->_arrData['intCategory'] = $objCategoryModel->; $this->_display("admin"); } } diff --git a/models/mother_model.php b/models/mother_model.php index c259719..d43d0fa 100644 --- a/models/mother_model.php +++ b/models/mother_model.php @@ -7,9 +7,9 @@ try{ // Connexion à la base de données $this->_db = new PDO( - "mysql:host=boulayoune.com;dbname=projet_folliow", // Serveur et BDD - "projet_user", //Nom d'utilisateur de la base de données - "F0lliowRules!",// Mot de passe de la base de données + "mysql:host=localhost;dbname=projet_folliow", // Serveur et BDD mysql:host=boulayoune.com;dbname=projet_folliow + "root", //Nom d'utilisateur de la base de données projet_user + "",// Mot de passe de la base de données F0lliowRules! array(PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC) // Mode de renvoi ); // Pour résoudre les problèmes d’encodage diff --git a/templates_c/5375cd75c92fd8c801b429efee0d6437582d377e_0.file_login.tpl.php b/templates_c/5375cd75c92fd8c801b429efee0d6437582d377e_0.file_login.tpl.php new file mode 100644 index 0000000..c008541 --- /dev/null +++ b/templates_c/5375cd75c92fd8c801b429efee0d6437582d377e_0.file_login.tpl.php @@ -0,0 +1,164 @@ +getCompiled()->isFresh($_smarty_tpl, array ( + 'version' => '5.7.0', + 'unifunc' => 'content_6989df814ecac5_82975272', + 'has_nocache_code' => false, + 'file_dependency' => + array ( + '5375cd75c92fd8c801b429efee0d6437582d377e' => + array ( + 0 => 'views/login.tpl', + 1 => 1770634036, + 2 => 'file', + ), + ), + 'includes' => + array ( + ), +))) { +function content_6989df814ecac5_82975272 (\Smarty\Template $_smarty_tpl) { +$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; +$_smarty_tpl->getInheritance()->init($_smarty_tpl, true); +?> + + +getInheritance()->instanceBlock($_smarty_tpl, 'Block_10819558166989df814817a5_66837906', "content"); +$_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); +} +/* {block "content"} */ +class Block_10819558166989df814817a5_66837906 extends \Smarty\Runtime\Block +{ +public function callBlock(\Smarty\Template $_smarty_tpl) { +$_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; +?> + +
+ getSmarty()->getModifierCallback('count')($_smarty_tpl->getValue('arrError')) > 0) {?> +
+ getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrError'), 'strError'); +$foreach0DoElse = true; +foreach ($_from ?? [] as $_smarty_tpl->getVariable('strError')->value) { +$foreach0DoElse = false; +?> +

getValue('strError');?> +

+ getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?> +
+ + +
+ + +
+ +
+ + +
+
+ + +
+ + +

Connexion

+ + +

+ Connectez-vous à votre compte. +

+ + + +
+ +
+ + +
+ + +
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ + Pas encore de compte ? + Créer un compte + +
+ + + + +
+
+ +
+ +
+
+
+
+getCompiled()->isFresh($_smarty_tpl, array ( 'version' => '5.7.0', - 'unifunc' => 'content_6989d31d7d28c9_01506908', + 'unifunc' => 'content_6989e0891f99a9_84268185', 'has_nocache_code' => false, 'file_dependency' => array ( @@ -22,21 +22,21 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( 'file:views/_partial/footer.tpl' => 1, ), ))) { -function content_6989d31d7d28c9_01506908 (\Smarty\Template $_smarty_tpl) { +function content_6989e0891f99a9_84268185 (\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_tpl->getInheritance()->init($_smarty_tpl, false); $_smarty_tpl->renderSubTemplate("file:views/_partial/header.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir); ?> getInheritance()->instanceBlock($_smarty_tpl, 'Block_8131712286989d31d7cfb58_06071603', "content"); +$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_1226719426989e0891f66b5_10703637', "content"); ?> renderSubTemplate("file:views/_partial/footer.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, $_smarty_tpl->cache_lifetime, array(), (int) 0, $_smarty_current_dir); } /* {block "content"} */ -class Block_8131712286989d31d7cfb58_06071603 extends \Smarty\Runtime\Block +class Block_1226719426989e0891f66b5_10703637 extends \Smarty\Runtime\Block { public function callBlock(\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; diff --git a/templates_c/ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb_0.file_admin.tpl.php b/templates_c/ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb_0.file_admin.tpl.php index f674aeb..d200d8c 100644 --- a/templates_c/ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb_0.file_admin.tpl.php +++ b/templates_c/ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb_0.file_admin.tpl.php @@ -1,18 +1,18 @@ getCompiled()->isFresh($_smarty_tpl, array ( 'version' => '5.7.0', - 'unifunc' => 'content_6989d31d65c3a2_79771570', + 'unifunc' => 'content_6989e088f38338_64666135', 'has_nocache_code' => false, 'file_dependency' => array ( 'ac77f39f91cdf26a0eb3f0963ead4008a7bda8fb' => array ( 0 => 'views/admin.tpl', - 1 => 1770640156, + 1 => 1770643565, 2 => 'file', ), ), @@ -20,18 +20,18 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( array ( ), ))) { -function content_6989d31d65c3a2_79771570 (\Smarty\Template $_smarty_tpl) { +function content_6989e088f38338_64666135 (\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; $_smarty_tpl->getInheritance()->init($_smarty_tpl, true); ?> getInheritance()->instanceBlock($_smarty_tpl, 'Block_20302301596989d31d64f310_54306383', "content"); +$_smarty_tpl->getInheritance()->instanceBlock($_smarty_tpl, 'Block_19184882506989e088f2e080_15773704', "content"); $_smarty_tpl->getInheritance()->endChild($_smarty_tpl, "views/layout.tpl", $_smarty_current_dir); } /* {block "content"} */ -class Block_20302301596989d31d64f310_54306383 extends \Smarty\Runtime\Block +class Block_19184882506989e088f2e080_15773704 extends \Smarty\Runtime\Block { public function callBlock(\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; @@ -108,9 +108,9 @@ $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views'; @@ -152,52 +152,30 @@ $_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
-
- + + getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategoryToDisplay'), 'category'); $foreach1DoElse = true; -foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetCategory')->value) { +foreach ($_from ?? [] as $_smarty_tpl->getVariable('category')->value) { $foreach1DoElse = false; ?> - - + getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?> - - getSmarty()->getRuntime('Foreach')->init($_smarty_tpl, $_smarty_tpl->getValue('arrCategoryToDisplay'), 'arrDetCategory'); -$foreach2DoElse = true; -foreach ($_from ?? [] as $_smarty_tpl->getVariable('arrDetCategory')->value) { -$foreach2DoElse = false; -?> - - getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?> - -
- -
-
+ +
+ -
-
- -
+ +


@@ -205,14 +183,16 @@ $_smarty_tpl->getSmarty()->getRuntime('Foreach')->restore($_smarty_tpl, 1);?>
- -
- - -
-
-
- +
+ +
+ + +
+
+ +
+
diff --git a/templates_c/b1b065356827f03a32a2809f87f59bd19d86da99_0.file_footer.tpl.php b/templates_c/b1b065356827f03a32a2809f87f59bd19d86da99_0.file_footer.tpl.php index bde3315..7788209 100644 --- a/templates_c/b1b065356827f03a32a2809f87f59bd19d86da99_0.file_footer.tpl.php +++ b/templates_c/b1b065356827f03a32a2809f87f59bd19d86da99_0.file_footer.tpl.php @@ -1,11 +1,11 @@ getCompiled()->isFresh($_smarty_tpl, array ( 'version' => '5.7.0', - 'unifunc' => 'content_6989d1dc7c08f9_74223007', + 'unifunc' => 'content_6989e0893afd86_56926620', 'has_nocache_code' => false, 'file_dependency' => array ( @@ -20,7 +20,7 @@ if ($_smarty_tpl->getCompiled()->isFresh($_smarty_tpl, array ( array ( ), ))) { -function content_6989d1dc7c08f9_74223007 (\Smarty\Template $_smarty_tpl) { +function content_6989e0893afd86_56926620 (\Smarty\Template $_smarty_tpl) { $_smarty_current_dir = 'C:\\wamp64\\www\\DWWM_2025\\projet2\\views\\_partial'; ?>
@@ -106,34 +105,21 @@
-
- + + {foreach from=$arrCategoryToDisplay item=category} + {/foreach} - - {foreach from=$arrCategoryToDisplay item=arrDetCategory} - - {/foreach} - -
- -
-
+ +
+ -
-
- -
+ +


@@ -141,14 +127,16 @@
- -
- - -
-
-
- +
+ +
+ + +
+
+ +
+