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 @@
print_msg(); $panel->showPanel(); ?>
diff --git a/panel_admin/manage_films.php b/panel_admin/manage_films.php index 9424a7a..7b8340d 100644 --- a/panel_admin/manage_films.php +++ b/panel_admin/manage_films.php @@ -87,15 +87,6 @@ '; } - function showmessage() { - if(isset($_SESSION['message'])){ - echo '
-

'.$_SESSION["message"].'

-
'; - unset($_SESSION['message']); - } - } - showmessage(); drawFilms($film->getReply()); addFilm(); diff --git a/panel_admin/updateFilm.php b/panel_admin/updateFilm.php index eb08afd..e3e24f1 100644 --- a/panel_admin/updateFilm.php +++ b/panel_admin/updateFilm.php @@ -2,25 +2,25 @@ include_once('./includes/film_dto.php'); include_once('./includes/formFilm.php'); - if(isset($_REQUEST['edit_film'])) { + if(isset($_POST['edit_film'])) { echo'

Editar pelicula

Datos de pelicula - +
- +
- +
- +
- +
@@ -32,19 +32,19 @@
'; } - else if(isset($_REQUEST['delete_film'])) { + else if(isset($_POST['delete_film'])) { echo'

Editar pelicula

¿Estás seguro de que quieres eliminar esta pelicula? - -

Id: '.$_REQUEST['id'].'

-

Título: '.$_REQUEST['tittle'].'

-

Duración: '.$_REQUEST['duration'].'

-

Idioma: '.$_REQUEST['language'].'

-

Descripción: '.$_REQUEST['description'].'

+ +

Id: '.$_POST['id'].'

+

Título: '.$_POST['tittle'].'

+

Duración: '.$_POST['duration'].'

+

Idioma: '.$_POST['language'].'

+

Descripción: '.$_POST['description'].'

diff --git a/panel_admin/update_film.php b/panel_admin/update_film.php index 41b7b5c..9590ad0 100644 --- a/panel_admin/update_film.php +++ b/panel_admin/update_film.php @@ -3,21 +3,21 @@ include_once('./includes/film_dto.php'); include_once('./includes/formFilm.php'); - if(isset($_REQUEST['add_film'])) { + if(isset($_POST['add_film'])) { $film = new FormFilm(); - $film->processesForm(null, $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "new"); + $film->processesForm(null, $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], "new"); $_SESSION['message'] = $film->getReply(); } - else if(isset($_REQUEST['confirm_delete_film'])) { + else if(isset($_POST['confirm_delete_film'])) { $film = new FormFilm(); - $film->processesForm($_REQUEST['id'],null,null,null,null,"del"); + $film->processesForm($_POST['id'],null,null,null,null,"del"); $_SESSION['message'] = $film->getReply(); } - else if(isset($_REQUEST['confirm_edit_film'])) { + else if(isset($_POST['confirm_edit_film'])) { $film = new FormFilm(); - $film->processesForm($_REQUEST['id'], $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "edit"); - $_SESSION['message'] = $film->getReply(); + $film->processesForm($_POST['id'], $_POST['tittle'], $_POST['duration'], $_POST['language'], $_POST['description'], "edit"); + $_SESSION['message']= $film->getReply(); } - header("Location: ../panel_admin/index.php?state=mf"); + header('Location: ../panel_admin/index.php?state=mf'); ?> \ No newline at end of file diff --git a/panel_admin/validade.php b/panel_admin/validade.php new file mode 100644 index 0000000..7120e49 --- /dev/null +++ b/panel_admin/validade.php @@ -0,0 +1,66 @@ +processesForm($id, $_POST["title"], $_POST["duration"], $_POST["languaje"],$_POST["description"], $action); + $reply = $session->getReply(); +?> + + + + + print_head(); + ?> + + + print_header(); + ?> + + +
+
+
+ + +
+
+
+
+
+ +
+
+
+
+
+ + + print_footer(); + ?> + + + + \ No newline at end of file