<?php //Controller include_once "model/user/login_user.php"; if (!isset($_SESSION["user"]) || !$_SESSION["user"]) { if (isset($_COOKIE["mem"])) { $data = explode("|", $_COOKIE["mem"]); $login = $data[0]; $password = $data[1]; login_user($login, $password); } } if (!isset($_GET["page"])) { $page = 1; } else { $page = $_GET["page"]; } if (!isset($_GET["cat"])) { $cat = 0; } else { $cat = $_GET["cat"]; } $offset = ($page - 1) * MAXART; include_once "model/blog/lire_articles.php"; $articles = lire_articles($cat, MAXART, $offset); include_once "model/blog/liste_categories.php"; $categories = liste_categories(); include_once "view/blog/index.php";
<?php // Controleur secondaire - blog/index // Afficher les bons articles en fonction de la page if (!isset($_GET["page"])) { $page = 1; } else { // Ajouter des tests $page = $_GET["page"]; } $offset = ($page - 1) * MAXART; include_once "modele/blog/lire_articles.php"; include_once "modele/blog/lire_categories.php"; $articles = lire_articles(); $categories = lire_categories(); //$articles = lire_articles($offset, MAXART); include_once "vue/blog/index.php";
<?php // Controleur secondaire - back-office/gestion_articles if (!isset($_SESSION["admin"])) { header('Location:?module=admin&action=login_admin'); } else { if (isset($_GET["id"])) { $id = $_GET["id"]; include "modele/blog/suppr_article.php"; if (suppr_article($id) == true) { header("Location:?module=blog&action=gestion_articles&del=ok"); } else { header("Location:?module=blog&action=gestion_articles&del=nok"); } } include_once "modele/blog/gestion_articles.php"; $retour_art = lire_articles(); include_once "vue/blog/gestion_articles.php"; }