Add files via upload

This commit is contained in:
Fernando Méndez 2021-05-09 20:31:54 +02:00 committed by GitHub
parent 99e298e1eb
commit d075d04a2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 74 additions and 106 deletions

View File

@ -18,7 +18,7 @@
VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d')", VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d')",
$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, "0"); $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; return $sql;
} }
@ -35,7 +35,7 @@
public function filmTittle($idfilm){ public function filmTittle($idfilm){
$sql = sprintf("SELECT * FROM film JOIN session ON film.id = session.idfilm WHERE session.idfilm = '%d' ", $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); $resul = mysqli_fetch_array($resul);
@ -50,8 +50,7 @@
$sql = sprintf( "SELECT * FROM session WHERE $sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'", idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$cinema, $hall, $date, $startTime); $cinema, $hall, $date, $startTime);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$resul = mysqli_query($this->mysqli, $sql) or die ('Error searchSession');
$session = mysqli_fetch_array($resul); $session = mysqli_fetch_array($resul);

View File

@ -44,4 +44,9 @@
* @see http://php.net/manual/en/language.types.callable.php * @see http://php.net/manual/en/language.types.callable.php
*/ */
register_shutdown_function(array($app, 'shutdown')); register_shutdown_function(array($app, 'shutdown'));
//Depuración (BORRAR):
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
?> ?>

View File

@ -18,7 +18,7 @@ abstract class Form {
* envío del formulario. * envío del formulario.
*/ */
private $action; private $action;
private $printed;
/** /**
* Crea un nuevo formulario. * Crea un nuevo formulario.
* *
@ -152,10 +152,10 @@ abstract class Form {
/* <<< Permite definir cadena en múltiples líneas. /* <<< Permite definir cadena en múltiples líneas.
* Revisa https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc * Revisa https://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
*/ */
$htmlForm = '<form method="POST" action="'.$this->action.'" id="'.$this->formId.'" > $htmlForm = "<form method='POST' action='{$this->action}' id='{$this->formId}' >
<input type="hidden" name="action" value="$this->formId" /> <input type='hidden' name='action' value='{$this->formId}' />
'.$htmlCamposFormularios.' ".$htmlCamposFormularios."
</form>'; </form>";
return $htmlForm; return $htmlForm;
} }

View File

@ -325,46 +325,6 @@
break; break;
case "Panel de Gerente": case "Panel de Gerente":
$html="<div class='column'>";
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
if($i != 0) $html.= "</div>
";
$html.= "<div class='column side'>
";
}
else{
if($i != 0) $html.= "</div>
";
$html.= "<div class='column middle'>
";
}
$html.= "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<form method='post' action='./?state=".$_SESSION['option']."'>
<input name='id' type='hidden' value='".$ids[$i]."'>
<input name='tittle' type='hidden' value='".$tittles[$i]."'>
<input name='duration' type='hidden' value='".$times[$i]."'>
<input name='language' type='hidden' value='".$languages[$i]."'>
<input name='description' type='hidden' value='".$descriptions[$i]."'>
<input name='price' type='hidden' value='".$_POST["price"]."'>
<input name='format' type='hidden' value='".$_POST["format"]."'>
<input name='start' type='hidden' value='".$_POST["start"]."'>
<input name='date' type='hidden' value='".$_POST["date"]."'>
<input name='hall' type='hidden' value='".$_POST["hall"]."'>
</form>
</div>
</div>
</section>
";
}
$html.= "</div>\n";
return $html;
break; break;
default: default:

View File

@ -1,6 +1,7 @@
<?php <?php
require_once('../assets/php/form.php'); require_once('../assets/php/form.php');
include_once('../assets/php/common/user.php'); include_once('../assets/php/common/user.php');
include_once('../assets/php/common/user_dao.php');
class FormChangeName extends Form { class FormChangeName extends Form {
@ -22,13 +23,13 @@ class FormChangeName extends Form {
<fieldset id="nombre_usuario"> <fieldset id="nombre_usuario">
<legend>Nuevo Nombre de usuario</legend> <legend>Nuevo Nombre de usuario</legend>
<div class="_new_name"> <div class="_new_name">
<input type="text" name="new_name" id="new_name" value="" placeholder="Nuevo Nombre" required/> <input type="text" name="new_name" id="new_name" value="" placeholder="Nuevo Nombre" required/>'.$errorNombre.'
</div> </div>
<div class="_passwd"> <div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/> <input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/>'.$errorPassword.'
</div> </div>
<div class="_passwd"> <div class="_passwd">
<input type="password" name="repass" id="repass" value="" placeholder="Repita la contraseña" required/> <input type="password" name="repass" id="repass" value="" placeholder="Repita la contraseña" required/>'.$errorPassword2.'
</div> </div>
</fieldset> </fieldset>
<div class="actions"> <div class="actions">
@ -44,6 +45,7 @@ class FormChangeName extends Form {
$result = array(); $result = array();
$nombre = $datos['new_name'] ?? null; $nombre = $datos['new_name'] ?? null;
$nombre = strtolower($nombre);
if ( empty($nombre) || mb_strlen($nombre) < 4 ) { if ( empty($nombre) || mb_strlen($nombre) < 4 ) {
$result['new_name'] = "El nombre tiene que tener una longitud de al menos 4 caracteres."; $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) { if (!$user) {
$result[] = "El usuario no existe."; $result[] = "El usuario no existe.";
} else { } else {
$bd->changeUserName(unserialize($_SESSION['user'])->getId(), $username); $bd->changeUserName(unserialize($_SESSION['user'])->getId(), $nombre);
$user = $bd->selectUser($username, $password); $user = $bd->selectUser($nombre, $password);
if (!$user){ if (!$user){
$result[] = "Ha ocurrido un probrema al actualizar el nombre de usuario."; $result[] = "Ha ocurrido un probrema al actualizar el nombre de usuario.";
}else{ }else{

View File

@ -44,10 +44,12 @@
<h2>Cambiar nombre de usuario</h2> <h2>Cambiar nombre de usuario</h2>
'.$htmlFormChangeName.' '.$htmlFormChangeName.'
</div> </div>
<!-- Change User Password -->
<div class="column middle"> <div class="column middle">
<h2>Cambiar contraseña</h2> <h2>Cambiar contraseña</h2>
'.$htmlFormChangePass.' '.$htmlFormChangePass.'
</div> </div>
<!-- Change User Email -->
<div class="column side"> <div class="column side">
<h2>Cambiar email de usuario</h2> <h2>Cambiar email de usuario</h2>
'.$htmlFormChangeEmail.' '.$htmlFormChangeEmail.'