From f3c318a34bfa3cbeafcd9bef32d119e01feed4d3 Mon Sep 17 00:00:00 2001 From: OscarRui <79144467+OscarRui@users.noreply.github.com> Date: Thu, 6 May 2021 18:11:12 +0200 Subject: [PATCH] Add files via upload --- assets/php/common/film_dao.php | 2 +- assets/php/common/session.php | 27 +++++++++++++++++++++++++++ assets/php/common/session_dao.php | 4 ++-- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/assets/php/common/film_dao.php b/assets/php/common/film_dao.php index da386fa..6a63d66 100644 --- a/assets/php/common/film_dao.php +++ b/assets/php/common/film_dao.php @@ -1,7 +1,7 @@ get_prefix(); + // $prefix = $template->get_prefix(); include_once($prefix.'assets/php/dao.php'); diff --git a/assets/php/common/session.php b/assets/php/common/session.php index ca8fc2b..93dede9 100644 --- a/assets/php/common/session.php +++ b/assets/php/common/session.php @@ -55,6 +55,33 @@ } else return "Error al conectarse a la base de datos"; } + + public static function edit_session($session){ + $bd = new SessionDAO('complucine'); + if($bd ){ + if($bd->searchSession($session['cinema'], $session['origin_hall'],$session['origin_start'],$session['origin_date'])){ + $origin = array("cinema" => $session['cinema'],"hall" => $session['origin_hall'],"start" => $session['origin_start'],"date" => $session['origin_date']); + $bd->editSession($session['film'], $session['hall'], $session['cinema'], $session['date'], + $session['start'], $session['price'], $session['format'],$origin); + return "Se ha editado la session con exito"; + } else + return "Esta session no existe"; + + } else return "Error al conectarse a la base de datos"; + } + + public static function delete_session($session){ + $bd = new SessionDAO('complucine'); + if($bd ){ + if($bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){ + $bd->deleteSession($session['hall'], $session['cinema'], $session['date'], $session['start']); + return "Se ha eliminado la session con exito"; + } else + return "Esta session no existe"; + + } else return "Error al conectarse a la base de datos"; + } + //Esto deberia estar en film.php? seguramente public static function getFilmTitle($idfilm){ $bd = new Film_DAO('complucine'); diff --git a/assets/php/common/session_dao.php b/assets/php/common/session_dao.php index 6330e5d..8d8abea 100644 --- a/assets/php/common/session_dao.php +++ b/assets/php/common/session_dao.php @@ -67,7 +67,7 @@ return $sessions; } - public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){ + public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin){ $format = $this->mysqli->real_escape_string($format); $date = date('Y-m-d', strtotime( $date ) ); $startTime = date('H:i:s', strtotime( $startTime ) ); @@ -77,7 +77,7 @@ `start_time` = '%s', `seat_price` = '%d', `format` = '%s' WHERE idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'", - $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]); + $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin["cinema"],$origin["hall"],$origin["date"],$origin["start"]); $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');