From b413e49ef2f0ba3e93e1c56ecff6d37131b04b22 Mon Sep 17 00:00:00 2001 From: MalnuxStarck Date: Mon, 24 Jul 2017 19:17:06 +0200 Subject: [PATCH] Corrections bugs sur les GET --- blog/lire.php | 8 ++++++++ class/ManagerTopicView.class.php | 2 +- forum/voirforum.php | 23 ++++++++++++++++------- forum/voirtopic.php | 16 +++++++++++++++- tutoriels/lire.php | 8 ++++++++ 5 files changed, 48 insertions(+), 9 deletions(-) diff --git a/blog/lire.php b/blog/lire.php index b673d5f..43caa36 100644 --- a/blog/lire.php +++ b/blog/lire.php @@ -12,6 +12,14 @@ $managerContenu = new ManagerContenu($bdd); $infosArticle = $managerContenu->donneLeContenu($idArticle); +if(empty($infosArticle)) +{ + $_SESSION['flash']['success'] = "L' Article n'existe pas "; + header('Location:./index.php'); + exit(); +} + + $article = new Contenu($infosArticle); echo '
diff --git a/class/ManagerTopicView.class.php b/class/ManagerTopicView.class.php index b6f22a1..7c23cfe 100644 --- a/class/ManagerTopicView.class.php +++ b/class/ManagerTopicView.class.php @@ -29,7 +29,7 @@ public function nouvellevu(TopicView $topic_view) $query->bindValue(':post',$topic_view->tv_post_id(),PDO::PARAM_INT); $query->bindValue(':poste',$topic_view->tv_poste(),PDO::PARAM_STR); $query->execute(); - $query->CloseCursor(); + $query->closeCursor(); } public function miseAjoursVu(TopicView $topic_view) diff --git a/forum/voirforum.php b/forum/voirforum.php index 6c0862e..61c807f 100644 --- a/forum/voirforum.php +++ b/forum/voirforum.php @@ -1,19 +1,28 @@ infosForum($forumId); - $forum = new Forum($donnees); + if(empty($donnees)) + { + $forumId = 1; + $donnees = $managerForum->infosForum($forumId); + $_SESSION['flash']['success'] = "Le forum n'existe pas , vous avez été redirigé "; + } - /*On verifie si l'utilisateur a le droit le forum */ + $forum = new Forum($donnees); + $titre = $forum->name(); + + include("../includes/debut.php"); + include("../includes/menu.php"); + /*On verifie si l'utilisateur a le droit le forum */ if (!Membre::verif_auth($forum->auth_view())) { diff --git a/forum/voirtopic.php b/forum/voirtopic.php index bf3e9d6..ce8adf4 100644 --- a/forum/voirtopic.php +++ b/forum/voirtopic.php @@ -13,6 +13,20 @@ $managerTopic = new ManagerTopic($bdd); $donneesTopic = $managerTopic->infosTopic($idTopic); + +if(empty($donneesTopic)) // si on ne trouve rien on redirige sur le premier topic :D +{ + /* A activer apres la premier creation de topic + $idTopic = 1 ; + $donneesTopic = $managerTopic->infosTopic($idTopic); + */ + + $_SESSION["flash"]["success"] = "Le topic n'existe pas ou a été supprimer "; + header('Location:./index.php'); + exit(); +} + + $topic = new Topic($donneesTopic); //A partir d'ici, on va compter le nombre de messages pourn'afficher que les 15 premiers @@ -34,7 +48,7 @@ $nombreDePages = ceil($totalDesMessages / $nombreDeMessagesParPage); $managerTopicView = new ManagerTopicView($bdd); -if($id!=0) +if($id != 0 AND $topic->id() != NULL) { $nbr_vu = $managerTopicView->nombreVusTopicDuMembre($id , $topic->id()); diff --git a/tutoriels/lire.php b/tutoriels/lire.php index 4af9493..4440c72 100644 --- a/tutoriels/lire.php +++ b/tutoriels/lire.php @@ -12,6 +12,14 @@ $managerContenu = new ManagerContenu($bdd); $infosTuto = $managerContenu->donneLeContenu($idTuto); + +if(empty($infosTuto)) +{ + $_SESSION['flash']['success'] = "Le tuto n'existe pas "; + header('Location:./index.php'); + exit(); +} + $tuto = new Contenu($infosTuto); echo '