From 4968bc8e2598f735aa9f15a9f33ef834b43bf791 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Mu=C3=B1oz=20Garcia?= <73303506+danimu03@users.noreply.github.com> Date: Wed, 14 Apr 2021 11:38:51 +0200 Subject: [PATCH] different changes - change from $ _REQUEST to $ _POST / $ _ GET - Session messages are managed globally by template --- panel_admin/includes/film_dao.php | 10 +---- panel_admin/includes/formFilm.php | 26 ++---------- panel_admin/index.php | 5 ++- panel_admin/manage_films.php | 9 ----- panel_admin/updateFilm.php | 26 ++++++------ panel_admin/update_film.php | 16 ++++---- panel_admin/validade.php | 66 +++++++++++++++++++++++++++++++ 7 files changed, 95 insertions(+), 63 deletions(-) create mode 100644 panel_admin/validade.php diff --git a/panel_admin/includes/film_dao.php b/panel_admin/includes/film_dao.php index 605f448..aaa6d3a 100644 --- a/panel_admin/includes/film_dao.php +++ b/panel_admin/includes/film_dao.php @@ -18,13 +18,7 @@ $id, $tittle, $duration, $language,$description); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); - return $resul; - } - //Returns - public function GetFilm($tittle,$language){ - $sql = sprintf( "SELECT * FROM film WHERE film.tittle = '%s'AND film.language='%s'", $tittle,$language ); - $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); - return $resul; + return $sql; } //Returns a query to get the film's data. @@ -34,8 +28,6 @@ return $resul; } - - //Returns a query to get All the films. public function allFilmData(){ diff --git a/panel_admin/includes/formFilm.php b/panel_admin/includes/formFilm.php index 23e3979..e3d89c7 100644 --- a/panel_admin/includes/formFilm.php +++ b/panel_admin/includes/formFilm.php @@ -46,7 +46,7 @@ class FormFilm extends Form { } //Process form: - public function processesForm($id,$tittle,$duration,$language,$description, $option) { + public function processesForm($id,$title,$duration,$languaje,$description, $option) { $this->correct = true; $this->option = $option; @@ -56,29 +56,11 @@ class FormFilm extends Form { if($bd ){ if($option == "new"){ //Primero comprobar si existe una pelicula con el mismo titulo e idioma - $exist = $bd-> GetFilm($tittle,$language); - if( mysqli_num_rows($exist) != 0){ - $this->correct =false; - } - else{ - $bd->createFilm(null, $tittle,$duration,$language,$description); - } + $bd->createFilm(null, $title,$duration,$languaje,$description); } else if ($option == "del"){ - $exist = $bd-> FilmData($id); - if( mysqli_num_rows($exist) != 0){ - $bd->deleteFilm($id); - } - else{ - $this->correct =false; - } + $bd->deleteFilm($id); } else if ($option == "edit"){ - $exist = $bd-> FilmData($id); - if( mysqli_num_rows($exist) != 0){ - $bd->editFilm($id,$tittle,$duration,$language,$description); - } - else{ - $this->correct =false; - } + $bd->editFilm($id,$title,$duration,$languaje,$description); } else if($this->option == "show") { $this->array = $bd->allFilmData(); } diff --git a/panel_admin/index.php b/panel_admin/index.php index 3ad1eea..5e79460 100644 --- a/panel_admin/index.php +++ b/panel_admin/index.php @@ -6,8 +6,8 @@ require_once('../panel_admin/panelAdmin.php'); $template = new Template(); - if(isset($_REQUEST['state'])) { - $panel = new Panel($_REQUEST['state']); + if(isset($_GET['state'])) { + $panel = new Panel($_GET['state']); } else { $panel = new Panel(''); @@ -66,6 +66,7 @@