From d075d04a2a413e444dfbf24b1aa104a00c32cb04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20M=C3=A9ndez?= <45081533+FerMdez@users.noreply.github.com> Date: Sun, 9 May 2021 20:31:54 +0200 Subject: [PATCH] Add files via upload --- assets/php/common/session_dao.php | 7 ++--- assets/php/config.php | 5 +++ assets/php/form.php | 16 +++++----- assets/php/template.php | 42 +------------------------ panel_user/includes/formChangeEmail.php | 34 ++++++++++---------- panel_user/includes/formChangeName.php | 40 ++++++++++++----------- panel_user/includes/formChangePass.php | 34 ++++++++++---------- panel_user/panelUser.php | 2 ++ 8 files changed, 74 insertions(+), 106 deletions(-) diff --git a/assets/php/common/session_dao.php b/assets/php/common/session_dao.php index d95226a..251e5e8 100644 --- a/assets/php/common/session_dao.php +++ b/assets/php/common/session_dao.php @@ -18,7 +18,7 @@ VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d')", $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, "0"); - $resul = mysqli_query($this->mysqli, $sql) or die ('Error createSession'); + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); return $sql; } @@ -35,7 +35,7 @@ public function filmTittle($idfilm){ $sql = sprintf("SELECT * FROM film JOIN session ON film.id = session.idfilm WHERE session.idfilm = '%d' ", $idfilm ); - $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database en filmTittle con idfilm= '. $idfilm); + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database en sessionData con la id '. $idfilm); $resul = mysqli_fetch_array($resul); @@ -50,8 +50,7 @@ $sql = sprintf( "SELECT * FROM session WHERE idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'", $cinema, $hall, $date, $startTime); - - $resul = mysqli_query($this->mysqli, $sql) or die ('Error searchSession'); + $resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database'); $session = mysqli_fetch_array($resul); diff --git a/assets/php/config.php b/assets/php/config.php index 2d8ef8e..894cc59 100644 --- a/assets/php/config.php +++ b/assets/php/config.php @@ -44,4 +44,9 @@ * @see http://php.net/manual/en/language.types.callable.php */ register_shutdown_function(array($app, 'shutdown')); + + //Depuración (BORRAR): + ini_set('display_errors', 1); + ini_set('display_startup_errors', 1); + error_reporting(E_ALL); ?> diff --git a/assets/php/form.php b/assets/php/form.php index fa09d49..f5a057a 100644 --- a/assets/php/form.php +++ b/assets/php/form.php @@ -18,7 +18,7 @@ abstract class Form { * envío del formulario. */ private $action; - + private $printed; /** * Crea un nuevo formulario. * @@ -52,7 +52,7 @@ abstract class Form { $opcionesPorDefecto = array( 'action' => null, ); $opciones = array_merge($opcionesPorDefecto, $opciones); - $this->action = $opciones['action']; + $this->action = $opciones['action']; if ( !$this->action ) { $this->action = htmlentities($_SERVER['PHP_SELF']); @@ -77,7 +77,7 @@ abstract class Form { * */ public function gestiona() - { + { if ( ! $this->formularioEnviado($_POST) ) { return $this->generaFormulario(); } else { @@ -88,7 +88,7 @@ abstract class Form { header('Location: '.$result); exit(); } - } + } } /** @@ -152,10 +152,10 @@ abstract class Form { /* <<< Permite definir cadena en múltiples líneas. * Revisa https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc */ - $htmlForm = '
- - '.$htmlCamposFormularios.' -
'; + $htmlForm = "
+ + ".$htmlCamposFormularios." +
"; return $htmlForm; } diff --git a/assets/php/template.php b/assets/php/template.php index bd394b7..74953e9 100644 --- a/assets/php/template.php +++ b/assets/php/template.php @@ -325,46 +325,6 @@ break; case "Panel de Gerente": - $html="
"; - for($i = 0; $i < count($films_array); $i++){ - $tittle = str_replace('_', ' ', $tittles[$i]); - if($i%2 === 0){ - if($i != 0) $html.= "
- "; - $html.= "
- "; - } - else{ - if($i != 0) $html.= "
- "; - $html.= "
- "; - } - $html.= "
-
-
-
".$tittles[$i]."
-

".$tittle."

-
-
- - - - - - - - - - -
-
-
-
- "; - } - $html.= "
\n"; - return $html; break; default: @@ -511,4 +471,4 @@ } } -?> +?> \ No newline at end of file diff --git a/panel_user/includes/formChangeEmail.php b/panel_user/includes/formChangeEmail.php index 0ee1c96..d2bb3f6 100644 --- a/panel_user/includes/formChangeEmail.php +++ b/panel_user/includes/formChangeEmail.php @@ -21,23 +21,23 @@ class FormChangeEmail extends Form { $errorPassword2 = self::createMensajeError($errores, 'repass', 'span', array('class' => 'error')); $html = '
'.$htmlErroresGlobales.' -
- Nuevo email de usuario -
- -
-
- -
-
- -
-
-
- - -
-
'; +
+ Nuevo email de usuario +
+ +
+
+ +
+
+ +
+
+
+ + +
+ '; return $html; } diff --git a/panel_user/includes/formChangeName.php b/panel_user/includes/formChangeName.php index d412084..e41c33f 100644 --- a/panel_user/includes/formChangeName.php +++ b/panel_user/includes/formChangeName.php @@ -1,6 +1,7 @@ 'error')); $html = '
'.$htmlErroresGlobales.' -
- Nuevo Nombre de usuario -
- -
-
- -
-
- -
-
-
- - -
-
'; +
+ Nuevo Nombre de usuario +
+ '.$errorNombre.' +
+
+ '.$errorPassword.' +
+
+ '.$errorPassword2.' +
+
+
+ + +
+ '; return $html; } @@ -44,6 +45,7 @@ class FormChangeName extends Form { $result = array(); $nombre = $datos['new_name'] ?? null; + $nombre = strtolower($nombre); if ( empty($nombre) || mb_strlen($nombre) < 4 ) { $result['new_name'] = "El nombre tiene que tener una longitud de al menos 4 caracteres."; } @@ -63,8 +65,8 @@ class FormChangeName extends Form { if (!$user) { $result[] = "El usuario no existe."; } else { - $bd->changeUserName(unserialize($_SESSION['user'])->getId(), $username); - $user = $bd->selectUser($username, $password); + $bd->changeUserName(unserialize($_SESSION['user'])->getId(), $nombre); + $user = $bd->selectUser($nombre, $password); if (!$user){ $result[] = "Ha ocurrido un probrema al actualizar el nombre de usuario."; }else{ diff --git a/panel_user/includes/formChangePass.php b/panel_user/includes/formChangePass.php index 0225822..b792679 100644 --- a/panel_user/includes/formChangePass.php +++ b/panel_user/includes/formChangePass.php @@ -19,23 +19,23 @@ class FormChangePass extends Form { $errorPassword2 = self::createMensajeError($errores, 'repass', 'span', array('class' => 'error')); $html = '
'.$htmlErroresGlobales.' -
- Contraseña Actual -
- -
-
- -
-
- -
-
-
- - -
-
'; +
+ Contraseña Actual +
+ +
+
+ +
+
+ +
+
+
+ + +
+ '; return $html; } diff --git a/panel_user/panelUser.php b/panel_user/panelUser.php index 15631ae..e649298 100644 --- a/panel_user/panelUser.php +++ b/panel_user/panelUser.php @@ -44,10 +44,12 @@

Cambiar nombre de usuario

'.$htmlFormChangeName.' +

Cambiar contraseña

'.$htmlFormChangePass.'
+

Cambiar email de usuario

'.$htmlFormChangeEmail.'