From 10e060d4c839cbaf33efad8d9b8b750d2d49cd67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20M=C3=A9ndez?= <45081533+FerMdez@users.noreply.github.com> Date: Tue, 1 Jun 2021 17:59:32 +0200 Subject: [PATCH] Add files via upload --- panel_user/panelUser.php | 11 ++++++----- purchase/includes/formPurchase.php | 15 +++++++++------ 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/panel_user/panelUser.php b/panel_user/panelUser.php index 7ef6a36..36eb812 100644 --- a/panel_user/panelUser.php +++ b/panel_user/panelUser.php @@ -126,13 +126,13 @@ $filmDAO = new Film_DAO("complucine"); $film = $filmDAO->FilmData($session->getIdfilm()); - if($i%2 === 0){ - if($i != 0) $purchasesHTML .= ' + if($i%3 === 0){ + if($i !== 0) $purchasesHTML .= ' '; - $purchasesHTML .= '
+ $purchasesHTML .= '
'; } else { - if($i != 0) $purchasesHTML .= '
+ if($i !== 0) $purchasesHTML .= '
'; $purchasesHTML .= '
'; @@ -149,7 +149,8 @@

SesiĆ³n: '.$sessions[$i].'

Asiento(Fila): '.$rows[$i].'

Asiento(Columna): '.$columns[$i].'

-
'; + + '; } } diff --git a/purchase/includes/formPurchase.php b/purchase/includes/formPurchase.php index 17063d5..73b0104 100644 --- a/purchase/includes/formPurchase.php +++ b/purchase/includes/formPurchase.php @@ -152,12 +152,15 @@ class FormPurchase extends Form { if (count($result) === 0) { if(isset($_SESSION["login"]) && $_SESSION["login"] == true){ $purchaseDAO = new PurchaseDAO("complucine"); - $purchaseDAO->createPurchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), date("Y-m-d H:i:s")); - $purchase = new Purchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), strftime("%A %e de %B de %Y a las %H:%M")); - - $_SESSION["purchase"] = serialize($purchase); - $_SESSION["film_purchase"] = serialize($this->film); - $result = "resume.php"; + if($purchaseDAO->createPurchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), date("Y-m-d H:i:s"))){ + $purchase = new Purchase(unserialize($_SESSION["user"])->getId(), $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), strftime("%A %e de %B de %Y a las %H:%M")); + + $_SESSION["purchase"] = serialize($purchase); + $_SESSION["film_purchase"] = serialize($this->film); + $result = "resume.php"; + } else { + $result[] = "Error al realizar la compra."; + } } else { $purchase = new Purchase("null", $this->session->getId(), $this->session->getIdhall(), $this->cinema->getId(), rand(1, $this->hall->getNumRows()), rand(1, $this->hall->getNumCol()), strftime("%A %e de %B de %Y a las %H:%M")); $_SESSION["purchase"] = serialize($purchase);