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')",
$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);

View File

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

View File

@ -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 {
* </ul>
*/
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 = '<form method="POST" action="'.$this->action.'" id="'.$this->formId.'" >
<input type="hidden" name="action" value="$this->formId" />
'.$htmlCamposFormularios.'
</form>';
$htmlForm = "<form method='POST' action='{$this->action}' id='{$this->formId}' >
<input type='hidden' name='action' value='{$this->formId}' />
".$htmlCamposFormularios."
</form>";
return $htmlForm;
}

View File

@ -325,46 +325,6 @@
break;
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;
default:
@ -511,4 +471,4 @@
}
}
?>
?>

View File

@ -21,23 +21,23 @@ class FormChangeEmail extends Form {
$errorPassword2 = self::createMensajeError($errores, 'repass', 'span', array('class' => 'error'));
$html = '<div class="row">'.$htmlErroresGlobales.'
<fieldset id="email_usuario">
<legend>Nuevo email de usuario</legend>
<div class="_new_email">
<input type="text" name="new_email" id="new_email" value="" placeholder="Nuevo Email" required/>
</div>
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/>
</div>
<div class="_passwd">
<input type="password" name="repass" id="repass" value="" placeholder="Repita la contraseña" required/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Cambiar Nombre de Usuario" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>';
<fieldset id="email_usuario">
<legend>Nuevo email de usuario</legend>
<div class="_new_email">
<input type="text" name="new_email" id="new_email" value="" placeholder="Nuevo Email" required/>
</div>
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/>
</div>
<div class="_passwd">
<input type="password" name="repass" id="repass" value="" placeholder="Repita la contraseña" required/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Cambiar Nombre de Usuario" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>';
return $html;
}

View File

@ -1,6 +1,7 @@
<?php
require_once('../assets/php/form.php');
include_once('../assets/php/common/user.php');
include_once('../assets/php/common/user_dao.php');
class FormChangeName extends Form {
@ -19,23 +20,23 @@ class FormChangeName extends Form {
$errorPassword2 = self::createMensajeError($errores, 'repass', 'span', array('class' => 'error'));
$html = '<div class="row">'.$htmlErroresGlobales.'
<fieldset id="nombre_usuario">
<legend>Nuevo Nombre de usuario</legend>
<div class="_new_name">
<input type="text" name="new_name" id="new_name" value="" placeholder="Nuevo Nombre" required/>
</div>
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/>
</div>
<div class="_passwd">
<input type="password" name="repass" id="repass" value="" placeholder="Repita la contraseña" required/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Cambiar Nombre de Usuario" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>';
<fieldset id="nombre_usuario">
<legend>Nuevo Nombre de usuario</legend>
<div class="_new_name">
<input type="text" name="new_name" id="new_name" value="" placeholder="Nuevo Nombre" required/>'.$errorNombre.'
</div>
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/>'.$errorPassword.'
</div>
<div class="_passwd">
<input type="password" name="repass" id="repass" value="" placeholder="Repita la contraseña" required/>'.$errorPassword2.'
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Cambiar Nombre de Usuario" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>';
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{

View File

@ -19,23 +19,23 @@ class FormChangePass extends Form {
$errorPassword2 = self::createMensajeError($errores, 'repass', 'span', array('class' => 'error'));
$html = '<div class="row">'.$htmlErroresGlobales.'
<fieldset id="contraseña_usuario">
<legend>Contraseña Actual</legend>
<div class="_passwd">
<input type="password" name="old_pass" id="old_pass" value="" placeholder="Contraseña Actual" required/>
</div>
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Nueva Contraseña" required/>
</div>
<div class="_passwd">
<input type="password" name="repass" id="repass" value="" placeholder="Repita la nueva contraseña" required/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Cambiar Contraseña" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>';
<fieldset id="contraseña_usuario">
<legend>Contraseña Actual</legend>
<div class="_passwd">
<input type="password" name="old_pass" id="old_pass" value="" placeholder="Contraseña Actual" required/>
</div>
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Nueva Contraseña" required/>
</div>
<div class="_passwd">
<input type="password" name="repass" id="repass" value="" placeholder="Repita la nueva contraseña" required/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Cambiar Contraseña" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>';
return $html;
}

View File

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