Add files via upload

This commit is contained in:
OscarRui 2021-05-06 18:11:12 +02:00 committed by GitHub
parent 8139625507
commit f3c318a34b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 30 additions and 3 deletions

View File

@ -1,7 +1,7 @@
<?php
include_once('film.php');
$template = new Template();
$prefix = $template->get_prefix();
// $prefix = $template->get_prefix();
include_once($prefix.'assets/php/dao.php');

View File

@ -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');

View File

@ -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');