diff --git a/panel_admin/includes/film_dao.php b/panel_admin/includes/film_dao.php index badde38..aaa6d3a 100644 --- a/panel_admin/includes/film_dao.php +++ b/panel_admin/includes/film_dao.php @@ -13,17 +13,11 @@ //Create a new Session. public function createFilm($id, $tittle, $duration, $language,$description){ - $exist = sprintf( "SELECT * FROM film WHERE tittle = '%s'", $tittle ); - $film =mysqli_query($this->mysqli, $exist) ; - if($film.is_null() ||$film["language"]!=$language){ $sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`) VALUES ( '%d', '%s', '%d', '%s','%s')", $id, $tittle, $duration, $language,$description); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); - }else{ - die ('Error into query database film already exist'); - } return $sql; } diff --git a/panel_admin/includes/formFilm.php b/panel_admin/includes/formFilm.php index 68c4146..e3d89c7 100644 --- a/panel_admin/includes/formFilm.php +++ b/panel_admin/includes/formFilm.php @@ -55,6 +55,7 @@ class FormFilm extends Form { $bd = new Film_DAO('complucine'); if($bd ){ if($option == "new"){ + //Primero comprobar si existe una pelicula con el mismo titulo e idioma $bd->createFilm(null, $title,$duration,$languaje,$description); } else if ($option == "del"){ $bd->deleteFilm($id); diff --git a/panel_admin/index.php b/panel_admin/index.php index 7516ee7..3ad1eea 100644 --- a/panel_admin/index.php +++ b/panel_admin/index.php @@ -6,8 +6,6 @@ require_once('../panel_admin/panelAdmin.php'); $template = new Template(); - if(isset($_SESSION["login"]) && $_SESSION["rol"] == "admin") $login = true; - if(isset($_REQUEST['state'])) { $panel = new Panel($_REQUEST['state']); } diff --git a/panel_admin/manage_films.php b/panel_admin/manage_films.php index 2348ed8..9424a7a 100644 --- a/panel_admin/manage_films.php +++ b/panel_admin/manage_films.php @@ -35,7 +35,7 @@