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