From f947d4054398368e4f55dfb4f7660fac784c4435 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20M=C3=A9ndez?= <45081533+FerMdez@users.noreply.github.com> Date: Mon, 9 Aug 2021 11:12:27 +0200 Subject: [PATCH] Delete formPurchase-FER_SURFACE-2.php --- .../includes/formPurchase-FER_SURFACE-2.php | 187 ------------------ 1 file changed, 187 deletions(-) delete mode 100644 purchase/includes/formPurchase-FER_SURFACE-2.php diff --git a/purchase/includes/formPurchase-FER_SURFACE-2.php b/purchase/includes/formPurchase-FER_SURFACE-2.php deleted file mode 100644 index 25c69ef..0000000 --- a/purchase/includes/formPurchase-FER_SURFACE-2.php +++ /dev/null @@ -1,187 +0,0 @@ -session = $sessionDAO->sessionData($_POST["sessions"]); - - $filmDAO = new Film_DAO("complucine"); - $this->film = $filmDAO->FilmData($this->session->getIdfilm()); - - $cinemaDAO = new Cinema_DAO("complucine"); - $this->cinema = $cinemaDAO->cinemaData($this->session->getIdcinema()); - - $hallDAO = new HallDAO("complucine"); - $this->hall = $hallDAO->HallData($this->session->getIdhall()); - - - $rows = $this->hall->getNumRows(); - $cols = $this->hall->getNumCol(); - for($i = 0; $i <= $rows; $i++){ - for($j = 0; $j <= $cols; $j++){ - $seat = $i.$j; - if(isset($_POST["checkbox".$seat])){ $this->seat = $seat; } - } - } - - $TODAY = getdate(); - $year = "$TODAY[year]"; - - $this->_TODAY = "$TODAY[year]-$TODAY[month]-$TODAY[mday] $TODAY[hours]:$TODAY[minutes]:$TODAY[seconds]"; - - $this->years = array(); - for($i = $year; $i < $year+10; $i++) array_push($this->years, $i); - - $this->months = array(); - for($i = 1; $i <= 12; $i++) array_push($this->months, $i); - } - - protected function generaCamposFormulario($datos, $errores = array()){ - - // Se generan los mensajes de error si existen. - $htmlErroresGlobales = self::generaListaErroresGlobales($errores); - $errorNombre = self::createMensajeError($errores, 'card-holder', 'span', array('class' => 'error')); - $errorCardNumber = self::createMensajeError($errores, 'card-number-0', 'span', array('class' => 'error')); - $errorCVV = self::createMensajeError($errores, 'card-cvv', 'span', array('class' => 'error')); - $errorCardExpirationMonth = self::createMensajeError($errores, 'card-expiration-month', 'span', array('class' => 'error')); - $errorCardExpirationYear = self::createMensajeError($errores, 'card-expiration-year', 'span', array('class' => 'error')); - - $monthsHTML = ""; - foreach($this->months as $value){ - $monthsHTML .= ""; - } - - $yearsHTML = ""; - foreach($this->years as $value){ - $yearsHTML .= ""; - } - - if($this->session->getSeatsFull()){ - $html = "
-

La sesión está llena, no quedan asientos disponibles.


-

Vuelva atrás para selecionar otra sesión.

-
"; - } else { - $html = "
-
- Resumen de la Compra - ".$this->film->getTittle()." -

Película: ".str_replace('_', ' ', strtoupper($this->film->getTittle()))."

-

Cine: ".$this->cinema->getName()."

-

Sala: ".$this->session->getIdhall()."

-

Asiento: ".$this->seat."

-

Fecha: ".date_format(date_create($this->session->getDate()), 'd-m-Y')."

-

Hora: ".$this->session->getStartTime()."

-

Precio: ".$this->session->getSeatPrice()."€

-
-
".$htmlErroresGlobales."
- Datos Bancarios -
".$errorNombre."

- -
-
".$errorCardNumber."

- - - - - -
".$errorCVV."
-
-
".$errorCardExpirationMonth.$errorCardExpirationYear."

- - -
-
- - - -
-
"; - } - return $html; - } - - protected function procesaFormulario($datos){ - $result = array(); - - $nombre = $this->test_input($datos['card-holder']) ?? null; - $nombre = strtolower($nombre); - if ( empty($nombre) ) { - $result['card-holder'] = "El nombre no puede estar vacío."; - } - - for($i = 0; $i < 4; $i++){ - $card_numer = $this->test_input($datos['card-number-'.$i]) ?? null; - if ( empty($card_numer) || mb_strlen($card_numer) < 4 ) { - $result['card-number-0'] = "La tarjeta debe tener 16 dígitos."; - } - } - - $cvv = $this->test_input($datos['card-cvv']) ?? null; - if ( empty($cvv) || mb_strlen($cvv) < 3 ) { - $result['card-cvv'] = "El CVV debe tener 3 números."; - } - - $month = $this->test_input($datos['card-expiration-month']) ?? null; - if ( empty($month) ) { - $result['card-expiration-month'] = "El mes de expiración no es correcto."; - } - - $year = $this->test_input($datos['card-expiration-year']) ?? null; - if ( empty($year) ) { - $result['card-expiration-year'] = "El año de expiración no es correcto."; - } - - if (count($result) === 0) { - if(isset($_SESSION["login"]) && $_SESSION["login"] == true){ - $purchaseDAO = new PurchaseDAO("complucine"); - 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); - $_SESSION["film_purchase"] = serialize($this->film); - $result = "resume.php"; - } - } - - return $result; - } -} -?> \ No newline at end of file