From 1b64bce9116e74d6a4abf1d6b1c39cb0188526be Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fernando=20M=C3=A9ndez?=
<45081533+FerMdez@users.noreply.github.com>
Date: Wed, 12 May 2021 10:40:22 +0200
Subject: [PATCH] Add files via upload
---
assets/css/highContrast.css | 11 +-
assets/css/main.css | 7 +-
assets/php/common/session.php | 35 ++---
assets/php/config.php | 5 +
assets/php/form.php | 5 +
login/includes/formLogin.php | 10 +-
login/index.php | 2 +-
panel_manager/includes/formSession.php | 165 ++++++++--------------
panel_manager/index.php | 4 +
panel_manager/panel_manager.php | 44 +++++-
panel_user/includes/formChangeEmail.php | 6 +-
panel_user/includes/formChangeName.php | 10 +-
panel_user/includes/formChangePass.php | 10 +-
panel_user/includes/formDeleteAccount.php | 12 +-
register/includes/formRegister.php | 18 +--
register/register.php | 4 +-
16 files changed, 170 insertions(+), 178 deletions(-)
diff --git a/assets/css/highContrast.css b/assets/css/highContrast.css
index d1a8290..dca13ed 100644
--- a/assets/css/highContrast.css
+++ b/assets/css/highContrast.css
@@ -328,6 +328,13 @@
text-align: center;
height: 250px;
}
+ .code.info #register{
+ border: 1px solid#d3ebff;
+ }
+ .code.info #register:hover {
+ color: #1f2c3d;
+ background-color: #d3ebff;
+ }
.code.showtimes{
height: 600px;
}
@@ -532,7 +539,7 @@
color: rgb(138, 150, 32);
}
- #submit {
+ #submit, #register {
width: 100%;
height: 35px;
border: 1px solid #dadada;
@@ -544,7 +551,7 @@
filter: brightness(105%);
cursor: pointer;
}
- #submit:hover {
+ #submit:hover, #register:hover {
color: #dadada;
background-color: #1f2c3d;
}
diff --git a/assets/css/main.css b/assets/css/main.css
index a1744f6..4b8f778 100644
--- a/assets/css/main.css
+++ b/assets/css/main.css
@@ -327,6 +327,9 @@ main img {
text-align: center;
height: 250px;
}
+.code.info #register{
+ border: 1px solid#d3ebff;
+}
.code.showtimes{
height: 600px;
}
@@ -526,7 +529,7 @@ textarea {
color: rgb(138, 150, 32);
}
-#submit {
+#submit, #register {
width: 100%;
height: 35px;
border: 1px solid #000000;
@@ -538,7 +541,7 @@ textarea {
filter: brightness(105%);
cursor: pointer;
}
-#submit:hover {
+#submit:hover, #register:hover {
background-color: #d3ebff;
}
diff --git a/assets/php/common/session.php b/assets/php/common/session.php
index 404ca60..7ffc0d3 100644
--- a/assets/php/common/session.php
+++ b/assets/php/common/session.php
@@ -33,17 +33,18 @@
return "";
}
- public static function create_session($cinema, $hall, $start, $date, $film, $price, $format,$repeat){
+ public static function create_session($session){
$bd = new SessionDAO('complucine');
if($bd ){
- if(!$bd->searchSession($cinema, $hall, $start, $date)){
- $bd->createSession(null,$film, $hall, $cinema, $date, $start, $price, $format);
-
- if($repeat > "0") {
- $repeats = $repeat;
- $repeat = $repeat - 1;
- $date = date('Y-m-d', strtotime( $date . ' +1 day') );
- self::create_session($cinema, $hall, $start, $date, $film, $price, $format,$repeat);
+ if(!$bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){
+ $bd->createSession(null,$session['film'], $session['hall'], $session['cinema'], $session['date'],
+ $session['start'], $session['price'], $session['format']);
+
+ if($session['repeat'] > "0") {
+ $repeat = $session['repeat'];
+ $session['repeat'] = $session['repeat'] - 1;
+ $session['date'] = date('Y-m-d', strtotime( $session['date'] . ' +1 day') );
+ self::create_session($session);
return "Se han creado las ".$repeat ." sesiones con exito";
}
@@ -55,13 +56,13 @@
} else return "Error al conectarse a la base de datos";
}
- public static function edit_session($cinema, $or_hall, $or_date, $or_start, $hall, $start, $date, $film, $price, $format){
+ public static function edit_session($session){
$bd = new SessionDAO('complucine');
if($bd ){
- if($bd->searchSession($cinema, $or_hall, $or_start, $or_date)){
- $origin = array("cinema" => $cinema,"hall" => $or_hall,"start" => $or_start,"date" => $or_date);
- $bd->editSession($film, $hall, $cinema, $date,
- $start, $price, $format,$origin);
+ if($bd->searchSession($session['cinema'], $session['origin_hall'],$session['origin_start'],$session['origin_date'])){
+ $origin = array("cinema" => $session['cinema'],"hall" => $session['origin_hall'],"start" => $session['origin_start'],"date" => $session['origin_date']);
+ $bd->editSession($session['film'], $session['hall'], $session['cinema'], $session['date'],
+ $session['start'], $session['price'], $session['format'],$origin);
return "Se ha editado la session con exito";
} else
return "Esta session no existe";
@@ -69,11 +70,11 @@
} else return "Error al conectarse a la base de datos";
}
- public static function delete_session($cinema, $hall, $start, $date){
+ public static function delete_session($session){
$bd = new SessionDAO('complucine');
if($bd ){
- if($bd->searchSession($cinema, $hall, $start, $date)){
- $bd->deleteSession($hall, $cinema, $date, $start);
+ if($bd->searchSession($session['cinema'], $session['hall'],$session['start'],$session['date'])){
+ $bd->deleteSession($session['hall'], $session['cinema'], $session['date'], $session['start']);
return "Se ha eliminado la session con exito";
} else
return "Esta session no existe";
diff --git a/assets/php/config.php b/assets/php/config.php
index d52c211..f03a4fb 100644
--- a/assets/php/config.php
+++ b/assets/php/config.php
@@ -46,4 +46,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 42e1c5a..e0d7b01 100644
--- a/assets/php/form.php
+++ b/assets/php/form.php
@@ -335,4 +335,9 @@ abstract class Form {
return $result;
}
+ //Test some form input.
+ protected function test_input($input){
+ return htmlspecialchars(trim(strip_tags($input)));
+ }
+
}
diff --git a/login/includes/formLogin.php b/login/includes/formLogin.php
index 2f7d5b8..ddcb8b5 100644
--- a/login/includes/formLogin.php
+++ b/login/includes/formLogin.php
@@ -24,12 +24,12 @@ class FormLogin extends Form {
$html = "
";
@@ -65,7 +65,7 @@ class FormLogin extends Form {
$_SESSION["login"] = true;
$result = 'validate.php';
} else {
- $result[] = "El usuario o el password no coinciden.";
+ $result[] = "El usuario o el password\nno coinciden.";
}
} else {
$result[] = "Error al conectar con la BD.";
@@ -75,10 +75,6 @@ class FormLogin extends Form {
return $result;
}
- protected function test_input($input){
- return htmlspecialchars(trim(strip_tags($input)));
- }
-
//Returns validation response:
static public function getReply() {
diff --git a/login/index.php b/login/index.php
index aadd949..0a6f1dd 100644
--- a/login/index.php
+++ b/login/index.php
@@ -17,7 +17,7 @@
$isLogin = $view->getIsLogin();
//Forms:
require('includes/formLogin.php');
- require('../register/includes/formRegister.php');
+ require($prefix.'register/includes/formRegister.php');
$formLogin = new FormLogin();
$htmlFormLogin = $formLogin->gestiona();
$formRegister = new FormRegister();
diff --git a/panel_manager/includes/formSession.php b/panel_manager/includes/formSession.php
index fb9e9ef..a9bbc5b 100644
--- a/panel_manager/includes/formSession.php
+++ b/panel_manager/includes/formSession.php
@@ -1,148 +1,107 @@
option = $option;
- $options = array("action" => "./?state=".$option);
- parent::__construct('formSession',$options);
+ public function __construct() {
+ parent::__construct('formSession');
}
//TODO Edit session no funciona correctamente con el seleccionar una pelicula distinta, hay que guardar la id de la sesion de alguna forma y usarla o guardar en la sesion
- protected function generaCamposFormulario($data, $errores = array()){
-
- $filmList = new Film_DAO('complucine');
- $films = $filmList->allFilmData();
+ public static function generaCampoFormulario($data, $errores = array()){
- if($this->option == "new_session") {
- $cinema = $data['cinema'] ?? $_SESSION["cinema"];
- $film = $data['film'] ?? 1;
- $hall = $data['hall'] ?? '';
- $date = $data['date'] ?? '';
- $start = $data['start'] ?? '';
- $price = $data['price'] ?? '';
- $format = $data['format'] ?? '';
- }
- else {
- $cinema = $data['cinema'] ?? $_SESSION["cinema"];
- $film = $data['film'] ?? $_POST["film"];
- $hall = $data['hall'] ?? $_POST["hall"];
- $date = $data['date'] ?? $_POST["date"];
- $start = $data['start'] ?? $_POST["start"];
- $price = $data['price'] ?? $_POST["price"];
- $format = $data['format'] ?? $_POST["format"];
- }
- $or_hall = $data["or_hall"] ?? $hall;
- $or_date = $data["or_date"] ?? $date;
- $or_start = $data["or_start"] ?? $start;
-
- $htmlErroresGlobales = self::generaListaErroresGlobales($errores);
-
- $html .= '
- '.$htmlErroresGlobales.'
+ $cinema = $data['cinema'] ?? '';
+ $film = $data['film'] ?? '';
+ $hall = $data['hall'] ?? '';
+ $date = $data['date'] ?? '';
+ $start = $data['start'] ?? '';
+ $price = $data['price'] ?? '';
+ $format = $data['format'] ?? '';
+
+ $htmlform .= '
+
-
-
-
+
";
@@ -85,11 +84,11 @@ class FormRegister extends Form {
$_SESSION["nombre"] = $this->user->getName();
$_SESSION["rol"] = $this->user->getRol();
$_SESSION["login"] = true;
- $result = '../register/register.php';
+ $result = "../register/register.php";
}
}
else{
- $result[] = "El nombre de usuario ya existe.";
+ $result[] = "El usuario ya existe.";
}
} else {
$result[] = "Error al conectar con la BD.";
@@ -111,9 +110,8 @@ class FormRegister extends Form {
\n";
}
else if(!isset($_SESSION["login"])){
- $reply = "ERROR
".
- "Ha ocurrido un problema y no hemos podido completar el registro.
- Puede que el nombre de usuario ya esté registrado.
+ $reply = "ERROR
+ Ha ocurrido un problema y no hemos podido completar el registro
Vuelve a intetarlo o inicia sesión si tienes una cuenta de usuario.
\n";
@@ -122,9 +120,5 @@ class FormRegister extends Form {
return $reply;
}
- protected function test_input($input){
- return htmlspecialchars(trim(strip_tags($input)));
- }
-
}
?>
\ No newline at end of file
diff --git a/register/register.php b/register/register.php
index 0dcb747..3d98c36 100644
--- a/register/register.php
+++ b/register/register.php
@@ -4,8 +4,6 @@
//Login form validate:
require_once('./includes/formRegister.php');
- //$register = new FormRegister();
- //$register->processesForm($_POST["name"], $_POST["email"], $_POST["pass"], $_POST["repass"]);
$reply = FormRegister::getReply();
?>
@@ -38,6 +36,8 @@
gestiona();
?>