182 Commits
v3.0 ... v2.0

Author SHA1 Message Date
b14dc0dedb Update dao.php 2021-07-02 18:02:53 +02:00
c99b403369 Delete _Memoria directory 2021-07-02 18:02:31 +02:00
536f194dd3 Delete _BD directory 2021-07-02 18:02:20 +02:00
1d26f267e5 Rename README.txt to README.md 2021-04-16 12:58:18 +02:00
c0a43216fa Add files via upload 2021-04-16 12:57:37 +02:00
1c41cdb32f Add files via upload 2021-04-16 12:57:10 +02:00
e0ed6b8216 Add files via upload 2021-04-16 12:55:48 +02:00
a01ee7e513 Add files via upload 2021-04-16 12:55:30 +02:00
7593adda47 Add files via upload 2021-04-16 12:54:21 +02:00
6e168e6682 Add files via upload 2021-04-15 23:47:16 +02:00
2a09ad18b9 Deberia estar todo hecho 2021-04-15 22:34:33 +02:00
a3bc2311e5 Add files via upload 2021-04-15 21:43:06 +02:00
653d24a8ca Update index.php 2021-04-15 21:30:06 +02:00
852893606c Update edit_sessions.php 2021-04-15 21:27:49 +02:00
b364c69dc8 Comprobado toda la logica/seguridad.
En teoria falta actualizar la estructura a como me dijo oscar esta mañana? algo asi
2021-04-15 20:53:01 +02:00
1af724f0a1 Delete listFilms.php 2021-04-15 20:39:45 +02:00
71bb846804 Delete user_unregistered_view.php 2021-04-15 20:39:35 +02:00
e2fda53f09 Delete user_registered_view.php 2021-04-15 20:39:29 +02:00
83541a8be7 Delete no_permision_panel.php 2021-04-15 20:39:23 +02:00
e9eb1f63aa Update register.php 2021-04-15 20:10:25 +02:00
ad1afdbe4d Update register.php 2021-04-15 20:09:31 +02:00
b988c94618 Update update_film.php 2021-04-15 19:00:22 +02:00
c3b783663b Update index.php 2021-04-15 18:46:36 +02:00
0d276ac0c1 Por si se introduce un dato separado por espacios 2021-04-15 18:42:50 +02:00
30547569f1 Arreglado 2021-04-15 18:40:22 +02:00
4a916e7a8a Update film_dao.php 2021-04-15 18:14:00 +02:00
b2c723f5da Update formLogin.php 2021-04-15 18:01:13 +02:00
7b11c5ea53 Update config.php 2021-04-15 14:59:05 +02:00
ea1c39ac97 Create config.php 2021-04-15 14:49:52 +02:00
861430e017 functional 2021-04-15 11:02:38 +02:00
79ae1b24db Add files via upload 2021-04-15 10:18:50 +02:00
3e7378d9d9 Add files via upload 2021-04-14 19:59:52 +02:00
1c43a649c9 Comprobacion de los datos del formulario 2021-04-14 19:47:57 +02:00
087037f142 Revert "Update formFilm.php"
This reverts commit 834df1cd17.
2021-04-14 19:07:59 +02:00
834df1cd17 Update formFilm.php 2021-04-14 19:07:47 +02:00
8062eb4c83 Update formFilm.php 2021-04-14 18:32:12 +02:00
1c283b6326 Lo vuelvo a subir 2021-04-14 12:39:32 +02:00
8ae58acce4 Delete validade.php
Not used
2021-04-14 11:41:29 +02:00
4968bc8e25 different changes
- change from $ _REQUEST to $ _POST / $ _ GET
- Session messages are managed globally by template
2021-04-14 11:38:51 +02:00
5ad88e6e35 added new method
//Print session MSG:
2021-04-14 11:36:40 +02:00
9113a9821a Delete validade.php 2021-04-14 10:45:17 +02:00
53238f6ef2 Comprobacion de si exite la pelicula en la base de datos 2021-04-14 10:29:27 +02:00
ab215853b9 Delete template_index.php 2021-04-13 22:31:01 +02:00
fee694ee6c Delete edit_film.php 2021-04-13 22:30:17 +02:00
729145d7ac Delete editFilm.php 2021-04-13 22:30:11 +02:00
9f5281771a Delete delete_film.php 2021-04-13 22:30:03 +02:00
85f92e4da6 Delete deleteFilm.php 2021-04-13 22:29:56 +02:00
4f55fbe75d Delete add_film.php 2021-04-13 22:29:43 +02:00
ce6c3a92e2 unified code 2021-04-13 22:29:25 +02:00
45d0570e62 Update index.php 2021-04-13 21:58:32 +02:00
a5f9863f22 Update formFilm.php 2021-04-13 21:49:29 +02:00
11ab79854f Update film_dao.php 2021-04-13 21:45:30 +02:00
e716de272f Cambios a la estructura del índex y sus vistas 2021-04-13 21:16:07 +02:00
b0cf43c313 Add files via upload 2021-04-13 21:15:28 +02:00
987476b585 Delete validate.php 2021-04-13 21:14:50 +02:00
002b59b664 Delete listSessions.php 2021-04-13 21:11:05 +02:00
63d4659584 Delete room_dto_interface.php 2021-04-13 21:10:06 +02:00
83541292f4 Delete room_dto.php 2021-04-13 21:09:56 +02:00
2c2ab7e990 Delete room_dao.php 2021-04-13 21:09:50 +02:00
2fef99d5d5 Update film_dao.php 2021-04-13 20:48:35 +02:00
e5b5f411be Update editFilm.php 2021-04-13 20:35:05 +02:00
6d7795563e Revert "."
This reverts commit 997209ecf3.
2021-04-13 20:28:33 +02:00
75e56e378f Merge branch 'v2.0' of https://github.com/FerMdez/SW into v2.0 2021-04-13 20:26:27 +02:00
997209ecf3 . 2021-04-13 20:21:27 +02:00
99f3c33e52 Update film_dao.php 2021-04-13 19:27:26 +02:00
9f93a4de17 Update film_dao.php 2021-04-13 19:22:20 +02:00
39ac587a60 Update film_dao.php 2021-04-13 18:41:44 +02:00
04305d2c79 Add files via upload 2021-04-13 17:37:15 +02:00
44fe6593ec Add files via upload 2021-04-13 17:22:07 +02:00
909f896acf Add files via upload 2021-04-13 17:22:00 +02:00
7e1eb2b977 Add files via upload 2021-04-13 17:21:54 +02:00
dee2d4ed9c Add files via upload 2021-04-13 17:21:48 +02:00
1479de26cc Add files via upload 2021-04-13 17:21:39 +02:00
712f3ba5ce Add files via upload 2021-04-13 17:21:10 +02:00
76f5b6bcf7 Add files via upload 2021-04-13 17:20:54 +02:00
76627d27de Add files via upload 2021-04-13 17:20:46 +02:00
081e7ed85e Delete login directory 2021-04-13 17:20:34 +02:00
0f63873d33 Add files via upload 2021-04-13 17:20:23 +02:00
fca8e6a96b Add files via upload 2021-04-13 17:19:43 +02:00
1d64623e70 Add files via upload 2021-04-13 17:19:24 +02:00
9fa33c648d Add files via upload 2021-04-13 17:19:12 +02:00
9e9661e4f9 update function tittleFilmData()
added DISTINCT clause to avoid duplicates in the query
2021-04-13 15:45:57 +02:00
5a5a99ad80 Complete functionality
Missing elements of design and security
2021-04-13 14:57:25 +02:00
cbbf66d128 Delete panel_admin/manage_films directory 2021-04-13 13:51:05 +02:00
19168d2f8d Add files via upload 2021-04-13 13:50:23 +02:00
a5f92c9bb0 Add files via upload 2021-04-13 13:00:57 +02:00
50de669747 😧 2021-04-12 23:23:55 +02:00
d216398b3a Add files via upload 2021-04-12 17:57:32 +02:00
b47eb7d516 Add files via upload 2021-04-12 17:57:15 +02:00
e2682476f9 Add files via upload 2021-04-12 17:25:15 +02:00
cc841917df Add files via upload 2021-04-12 17:21:59 +02:00
e0ff3aed42 Update user_dao.php 2021-04-12 16:31:41 +02:00
62fe03a7a1 Add files via upload 2021-04-12 12:26:12 +02:00
1e91584f47 Delete manage_films.php 2021-04-12 12:25:37 +02:00
de8ab2ad8e Add files via upload 2021-04-12 12:25:17 +02:00
dc8c00e751 allFilmData added
Añadida una funcion para seleccionar todas las peliculas de la base de datos
2021-04-11 19:57:31 +02:00
94c7940cc0 Add files via upload 2021-04-11 19:55:21 +02:00
68860539da Add files via upload 2021-04-11 19:54:18 +02:00
42d084ec5a Update session_dao.php 2021-04-11 19:11:16 +02:00
da43c0a16a Add files via upload 2021-04-11 19:08:22 +02:00
b072147e03 Add files via upload 2021-04-11 17:58:01 +02:00
d04592392d Update dto and dto_interfacce 2021-04-11 09:16:07 +02:00
16d921f1a1 Update edit_sessions.php 2021-04-10 21:08:48 +02:00
a7575ba942 Muchas conexiones con la base de datos.
Ahora se pueden añadir sesiones (para una sala, cine y fecha predeterminada en el codigo). El "escoger" la pelicula es simplemente meter el id de la pelicula en cuestion.
La lista de sesiones en la vista de las sesiones hace recibe un array desde la base de datos (para una sala,cine y fecha predeterminada en el codigo). Lo que muestra la tabla tambien es solo la id de la pelicula.
2021-04-10 20:54:56 +02:00
d8184c40b3 move 2021-04-10 01:16:35 +02:00
35e1cc7405 Creando film_dao basado en los dao ya existentes 2021-04-10 01:13:59 +02:00
7bb31aac8e Create manage_films.php 2021-04-10 00:57:10 +02:00
154692a64d cambio de nombre para que no sea el mismo 2021-04-10 00:56:00 +02:00
ced44955d5 Update edit_sessions.php 2021-04-08 18:02:25 +02:00
1654e1cc6e Update manage_rooms.php 2021-04-08 18:02:00 +02:00
46915a54a0 Update manage_sessions.php 2021-04-08 18:01:35 +02:00
30f7321b2d Delete session_dto.php 2021-04-08 18:00:47 +02:00
450e03e3e6 Delete room_dto.php 2021-04-08 18:00:34 +02:00
2f4d5234ba Add files via upload 2021-04-08 18:00:08 +02:00
31c54a5a0c Add files via upload 2021-04-08 17:42:28 +02:00
a912e5806e Add new folder includes 2021-04-08 14:57:40 +02:00
a54662295a Update user_dto.php 2021-04-08 11:03:53 +02:00
eb3563bc37 Update users_dto_interface.php 2021-04-08 11:03:17 +02:00
66271ea4ef Update user_dto.php 2021-04-08 11:02:53 +02:00
7d2c3593da Confirmado el sistema de (cambio de vistas)
Ahora tambien funciona el cambio a la vista de añadir sesion
2021-04-08 10:59:22 +02:00
4bdb409ebb pequeños cambios de la estructura de los columns 2021-04-08 09:59:11 +02:00
17abb71522 Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-08 09:21:52 +02:00
cdc19d1829 Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-08 09:21:15 +02:00
2d34dc531f Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-08 09:20:33 +02:00
e24fdeeebe Delete login directory 2021-04-08 09:20:13 +02:00
54b0907f04 Reestructuración de clases y directorios 2021-04-08 09:20:02 +02:00
93bbd2a900 Delete assets/php directory 2021-04-08 09:19:31 +02:00
b93960edcf Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-08 09:18:56 +02:00
8844ee74a9 Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-07 20:19:01 +02:00
fad708b963 Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-07 20:17:46 +02:00
7e2ef23349 Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-07 19:56:06 +02:00
0e27827b5d Añadida LOGIN a través de BASE DE DATOS
Se ha creado la base de datos de usuarios y toda la lógica para iniciar sesión mediante ella.
2021-04-07 19:54:57 +02:00
fa7acdf3e8 Update user_dao.php 2021-04-07 14:59:26 +02:00
7fc1008c71 Add files via upload 2021-04-06 23:01:41 +02:00
40ecd8bd0f Add files via upload 2021-04-06 23:01:09 +02:00
8325f71704 Update validate.php 2021-04-06 21:19:50 +02:00
52d7f630b2 Update validate.php 2021-04-06 21:17:34 +02:00
8cd44a126d Add files via upload 2021-04-06 21:17:07 +02:00
69d2893e66 Add files via upload 2021-04-06 21:16:04 +02:00
bc2f1cb89b Add files via upload 2021-04-06 21:14:59 +02:00
73ac7f9de1 Add files via upload 2021-04-06 12:00:31 +02:00
2cbd312ea2 Add files via upload 2021-03-31 11:55:32 +02:00
825f64e736 Add files via upload 2021-03-30 16:16:56 +02:00
f196283ca1 Add files via upload 2021-03-29 01:04:48 +02:00
ec5bbc8d4c Delete css directory 2021-03-29 01:04:39 +02:00
a8dc24794e Add files via upload 2021-03-29 01:04:21 +02:00
f1189a74df Eliminado table_container :) 2021-03-26 15:49:41 +01:00
61d4515ca7 Cambiada la estructura de todo el panel
Cambiada la estructura de index, añadidos archivos php con cada vista del panel principal
2021-03-26 15:45:16 +01:00
e70bfdff7a New index and panelAdmin class 2021-03-26 15:08:47 +01:00
6f4ec68a14 Actualizado con los "consejos" de fer
Actualizado la tabla, como se crean sus objetos y como formatean los echo.
Añadida el selector de sala y fecha.
Añadido funcionalidad basica de prueba a los botones para poder cambiar entre los paneles de gestion.
2021-03-26 14:05:05 +01:00
2d24fe23f5 Add files via upload 2021-03-26 13:46:21 +01:00
4c4528c499 Update index.php 2021-03-25 23:46:22 +01:00
e43faa3f65 Create manage_cinemas.php 2021-03-25 15:22:11 +01:00
76f8babf9f Update index.php 2021-03-25 15:20:49 +01:00
4574e2d3a9 Añadido .table_container
Un estilo para que las tablas de sesiones aparezcan con un scroll vertical y tengan una altura fija igual a 5 filas. (lo que estimo que ocupara la parte de calendario y selector de salas del menu
2021-03-25 12:11:57 +01:00
5046eb242b Update index.php 2021-03-25 12:09:32 +01:00
c381432d32 Introducida una preview de la tabla de sesiones 2021-03-25 10:58:20 +01:00
a65664c9d1 Add files via upload 2021-03-25 10:33:01 +01:00
6638722c8b Update template.php 2021-03-25 10:02:08 +01:00
981e4fdbd3 Update template.php 2021-03-25 09:46:28 +01:00
c46efc73da Create validate.php 2021-03-25 09:40:38 +01:00
f3d90a9ca1 Create register.php 2021-03-25 09:40:16 +01:00
5e4934a9a2 Add files via upload 2021-03-25 09:40:00 +01:00
f4e239b384 Add files via upload 2021-03-25 09:37:55 +01:00
64103b020c Cambios estructurales para adaptar la P1 a la P2 2021-03-24 21:44:07 +01:00
3c843d56c4 Cambios estructurales para adaptar la P1 a la P2 2021-03-24 21:43:42 +01:00
efb1349c6a Cambios estructurales para adaptar la P1 a la P2 2021-03-24 21:43:20 +01:00
bff23cda62 Cambios estructurales para adaptar la P1 a la P2 2021-03-24 21:42:58 +01:00
6bbdca8383 Cambios estructurales para adaptar la P1 a la P2 2021-03-24 21:42:13 +01:00
a234cfe97a Cambios estructurales para adaptar la P1 a la P2 2021-03-24 21:35:59 +01:00
328c08d5d6 Delete img directory 2021-03-19 20:42:34 +01:00
17df95d349 Delete miembros directory 2021-03-19 20:42:24 +01:00
6a0c807140 Delete detalles directory 2021-03-19 20:42:19 +01:00
06f1b090d2 Delete contacto directory 2021-03-19 20:42:13 +01:00
20735a1b81 Delete planificacion directory 2021-03-19 20:42:06 +01:00
98cb3074af Delete index.php 2021-03-19 20:41:54 +01:00
1fd56558c2 Delete bocetos directory 2021-03-19 20:41:45 +01:00
e57e75fae5 Delete assets directory 2021-03-19 20:41:38 +01:00
efc6713953 Mejoras en el menú 2021-03-19 17:47:59 +01:00
6a38623819 Cambios básicos
Header y Footer generalizados con PHP.
Todos los "index.html" transformados a "index.php".
2021-03-19 17:02:07 +01:00
7eca59c8cc Add files via upload 2021-03-19 14:37:33 +01:00
0c18871508 Update README.md 2021-02-16 16:36:12 +01:00
158 changed files with 3950 additions and 6774 deletions

BIN
BDfdicines.pdf Normal file

Binary file not shown.

BIN
Practica2-Enunciado.pdf Normal file

Binary file not shown.

Binary file not shown.

View File

@ -1,7 +1,7 @@
# SW 💻
Repositorio para la asignatura de Sistemas Web de Ingeniería de Computadores
***
## Versión 3.0 (Tercera entrega)
## Versión 2.0 (Segunda entrega)
***
## Licencia 📄
Educational Community License v2.0 (ECL-2.0).

View File

@ -1,613 +0,0 @@
/* Basic */
* {
box-sizing: border-box;
margin: 0px;
}
/* Headers */
h1, h2, h3, h4 {
color: #d3ebff;
text-transform: uppercase;
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
vertical-align: baseline;
text-align: center;
}
h2 {
font-size: 95%;
}
h3 {
font-size: 85%;
}
h4 {
font-size: 75%;
}
/* Buttons */
button, .button.large {
display: inline-block;
margin: 10px;
width: 150px;
height: 30px;
padding: 5px 10px;
background-color :#1f2c3d;
border: 1px solid #dadada;
text-align: center;
color :#dadada;
font-weight: bold;
position: relative;
}
.button.large {
width: 95%;
}
button:hover, .button:hover {
cursor: pointer;
background-color:#dadada;
color:#1f2c3d;
border-color: #1f2c3d;
}
/* Header */
.header {
background-color: #1f2c3d;
color: #dadada;
padding: 15px;
text-align: left;
font-size: 18px;
}
.header img {
width: 13px;
}
/* Header Menu */
.menu {
margin-top: 10px;
text-align: right;
font-size: 15px;
}
.menu nav a{
text-decoration: none;
color: inherit;
font-size: 15px;
}
.menu nav li{
display: inline-block;
width: 150px;
height: 30px;
padding: 5px 10px;
background-color :#1f2c3d;
border: 1px solid #dadada;
text-align: center;
color :#dadada;
position: relative;
}
.menu nav li:hover{
background-color:#dadada;
color:#1f2c3d;
border-color: #1f2c3d;
}
.menu nav li>ul{
display: none;
}
.menu nav li:hover>ul{
display: block;
position: absolute;
top: 29px;
right: -1px;
}
/* Sub Header */
.header.sub {
margin-bottom: 20px;
padding: 5px;
display: flex;
flex-direction: row;
text-align: center;
justify-content: center;
font-size: 20px;
}
.header.sub .menu {
margin-top: 0px;
text-align: center;
font-size: 15px;
}
/* Responsive layout */
@media (max-width: 850px) {
.header.sub .menu nav li:hover>ul{
display: block;
position: relative;
top: 5px;
left: -51px;
}
}
/* Paragraphs */
p {
padding: 0;
border: 0;
}
a {
color: #dadada;
text-decoration: none;
}
a:hover{
color:rgb(138, 150, 32);
}
/* Body */
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #00020f;
color: #dadada;
}
/* Table */
table {
border-collapse: collapse;
border-spacing: 0;
margin: 0 0 2em 0;
width: 100%;
text-align: left;
font-size: 15px;
}
table a{
color: #dadada;
}
table tbody tr {
color: #dadada;
border: solid 1px #dadada;
border-left: 0;
border-right: 0;
}
table tbody tr:nth-child(2n + 1) {
background-color: rgba(255, 255, 255, 0.25);
}
table td {
padding: 0.75em 0.75em;
}
table th {
color: #dadada;
font-size: 0.9em;
font-weight: 600;
padding: 0.85em 0.85em 0.85em 0.85em;
}
table thead, table tfoot {
border-bottom: solid 2px #dadada;
}
table.alt {
border-collapse: separate;
}
table.alt tbody tr td {
border: solid 1px #dadada;
border-left-width: 0;
border-top-width: 0;
}
table.alt tbody tr td:first-child {
border-left-width: 1px;
}
table.alt tbody tr:first-child td {
border-top-width: 1px;
}
table.alt thead, table.alt tfoot {
border-top: 0;
}
/* Main */
main {
padding: 30px;
text-align: center;
font-size: 35px;
}
main h1, h2, h3, h4 {
color: #dadada;
}
main img {
width: 40%;
}
/* Create three unequal columns that floats next to each other */
.column {
float: left;
padding: 10px;
}
/* Left and right column */
.column.side {
width: 33.33%;
}
/* Middle column */
.column.middle {
width: 33.33%;
}
.column.middle .image img, .column.side .image img{
border-radius: 4px;
border: 0;
position: relative;
border-radius: 4px;
display: block;
margin: 0 0 3rem 0;
width: 100%;
}
/* Left column */
.column.left {
width: 50%;
}
/* Right column */
.column.right {
float: right;
width: 50%;
}
/* Clear floats after the columns */
.row:after {
content: "";
display: table;
clear: both;
}
/* Responsive layout: makes the three columns stack on top of each other instead of next to each other */
@media (max-width: 1000px) {
.column.side, .column.middle, .column.left, .column.right{
width: 100%;
}
}
/* Zoom */
.zoom {
transition: transform .2s;
}
.zoom:hover {
transform: scale(1.05);
}
/* Code & Blockquote */
.code {
background: #1f2c3d;
border-radius: 3px;
font-size: 0.9em;
margin: 10px;
display: block;
line-height: 1.75em;
padding: 1em 1.5em;
overflow-x: auto;
overflow-y: auto;
}
.code h1, .code h2{
color: #dadada;
}
.code h3, .code h4 {
color: #d3ebff;
}
.code p {
color: #dadada;
}
.code a {
text-decoration: underline;
}
.code ul, .code ol, .code li{
color: #dadada;
}
.code img{
/* width: 80px; height: 80px; */
width: 25%;
}
.code fieldset{
margin: 1px;
border-color: #dadada;
border-style: groove;
}
.code fieldset legend {
text-transform: uppercase;
font-weight: bold;
font-size: 90%;
color: #d3ebff;
}
.code label{
color: #d3ebff;
}
.code.details{
height: 750px;
}
.code.plan {
height: 1150px;
}
.code.info{
text-align: center;
height: 250px;
}
.code.showtimes{
height: 600px;
}
/* BlockQuotes */
.blockquote {
border-left: solid 4px #dadada;
margin: 0 0 2em 0;
margin-top: 10px;
padding: 0.5em 0 0.5em 2em;
}
.blockquote.bio {
height: 250px;
}
/* Sketches */
.sketches {
text-align: center;
display: block;
line-height: 1.25em;
padding: 1em 1em;
overflow-x: auto;
background: #1f2c3d;
border-radius: 3px;
height: 680px;
}
.sketches h1, .sketches h2, .sketches h3, .sketches h4, .sketches p {
color: #dadada;
}
.sketches img {
width: 550px;
height: 550px;
}
.sketches .description {
color: #00020f;
}
/* Responsive layout */
@media (max-width: 1500px) {
.column.side .sketches, .column.middle .sketches {
width: 100%;
height: 500px;
}
.column.side .sketches img, .column.middle .sketches img {
width: 100%;
height: 75%;
}
}
@media (max-width: 1150px) {
.sketches img {
width: 100%;
height: 75%;
}
}
/* Text Box */
.textbox {
color: #d3ebff;
padding: 15px 15px 10px 15px;
margin: 10px 0 10px;
overflow: hidden;
border-radius: 25px 0px 25px 0px;
border: 2px solid #d3ebff;
}
.textbox h1, .textbox h2, .textbox h3 {
color: #d3ebff;
text-align: left;
}
/* Galery */
.galery {
box-sizing: border-box;
}
.galery .columna {
margin-top: 10px;
float: left;
width: 50%;
padding-right: 10px;
}
.galery .fila::after {
content: "";
clear: both;
display: table;
}
.galery .image img {
width: 100%;
}
.galery .image.main img {
width: 100%;
}
/* Percentage bar */
.bar {
height: 15px;
line-height: 15px;
font-size: 13px;
font-weight: bold;
width: 100%;
color: #dadada;
background-color: #00020f;
text-align: right;
}
.bar.seventyfive {
width: 75%;
}
.bar.fifty {
width: 50%;
}
.bar.twentyfive {
width: 25%;
}
/* Timeline Image */
.timeline h2 {
padding-top: 50px;
}
.timeline img{
width: 100%;
text-align: center;
padding-bottom: 50px;
padding-left: 15px;
padding-right: 15px;
}
/* Sidebars */
.sidebar.left {
padding: 5px;
margin-top: 10px;
margin-bottom: 10px;
float: left;
width: 300px;
height: 370PX;
color: #00020f;
background-color: #1f2c3d;
}
.sidebar.left a {
color: #00020f;
font-weight: bold;
text-decoration: none;
}
.sidebar.left a:hover {
color: #00020f;
text-decoration: underline;
}
/* Responsibe sidebar */
@media (max-width: 1000px) {
.sidebar.left {
width: 100%;
height: 100%;
}
}
/* Form */
form {
margin: auto;
width: 65%;
}
form h1, h2, h3, h4 {
color: #dadada;
}
label {
color: #dadada;
text-align: center;
font-weight: bold;
}
input, textarea {
width: 100%;
height: 27px;
border: 1px solid #dadada;
padding: 10px;
margin-top: 5px;
font-size: 15px;
}
textarea {
width: 100%;
height: 150px;
}
legend {
color: #dadada;
}
#radio, #checkbox {
width: auto;
height: 15px;
cursor: pointer;
}
.verify {
font-size: 11px;
}
.verify a {
color: #dadada;
}
.verify a:hover {
color: rgb(138, 150, 32);
}
#submit, #register {
width: 100%;
height: 35px;
border: 1px solid #dadada;
padding: 5px;
margin-top: 5px;
font-size: 15px;
font-weight: bold;
box-shadow: 2px 2px #1f2c3d;
filter: brightness(105%);
cursor: pointer;
}
#submit:hover, #register:hover {
color: #dadada;
background-color: #1f2c3d;
}
#reset {
width: 100%;
height: 30px;
border: 1px solid #dadada;
background-color: #00020f;
color: #dadada;
padding: 5px;
margin-top: 5px;
font-size: 12px;
font-weight: bold;
box-shadow: 2px 2px #1f2c3d;
cursor: pointer;
}
#reset:hover {
border:#000000;
background-color: #791515;
}
.file{
margin-top: 10px;
}
.file input{
height: 110%;
}
/* Preformatted Text */
pre {
font-weight: bold;
}
fieldset pre {
color: red;
}
/* Footer */
footer {
text-align: left;
background-color: #1f2c3d;
color: #dadada;
padding: 20px;
margin-top: 100px;
width: 100%;
height: 80px;
}
.footer {
text-align: right;
}
footer button {
display: inline-block;
margin: 1px;
width: 115px;
height: 25px;
padding: 0px 0px;
text-align: center;
font-weight: bold;
position: relative;
}
@media (max-width: 500px) {
footer {
width: 100%;
height: 100%;
}
}

View File

@ -61,7 +61,7 @@ button:hover, .button:hover {
font-size: 18px;
}
.header img {
width: 13px;
width: 11px;
}
/* Header Menu */
.menu {
@ -114,15 +114,6 @@ button:hover, .button:hover {
text-align: center;
font-size: 15px;
}
/* Responsive layout */
@media (max-width: 850px) {
.header.sub .menu nav li:hover>ul{
display: block;
position: relative;
top: 5px;
left: -51px;
}
}
/* Paragraphs */
@ -143,7 +134,7 @@ a:hover{
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #d3ebff;
color: #000000;
color: #000000
}
/* Table */
@ -173,7 +164,7 @@ table a{
color: #1f2c3d;
font-size: 0.9em;
font-weight: 600;
padding: 0.85em 0.85em 0.85em 0.85em;
padding: 0 0.85em 0.85em 0.85em;
}
table thead, table tfoot {
border-bottom: solid 2px #1f2c3d;
@ -201,16 +192,16 @@ table a{
/* Main */
main {
.main {
padding: 30px;
text-align: center;
font-size: 35px;
}
main h1, h2, h3, h4 {
.main h1, h2, h3, h4 {
color: #363636;
}
main img {
width: 40%;
.main img {
width: 50%;
}
/* Create three unequal columns that floats next to each other */
@ -296,7 +287,7 @@ main img {
.code a {
text-decoration: underline;
}
.code ul, .code ol, .code li {
.code ul, .code ol {
color: #dadada;
}
.code img{
@ -314,9 +305,6 @@ main img {
font-size: 90%;
color: #d3ebff;
}
.code label{
color: #d3ebff;
}
.code.details{
height: 750px;
}
@ -526,7 +514,7 @@ textarea {
color: rgb(138, 150, 32);
}
#submit, #register {
#submit {
width: 100%;
height: 35px;
border: 1px solid #000000;
@ -538,7 +526,7 @@ textarea {
filter: brightness(105%);
cursor: pointer;
}
#submit:hover, #register:hover {
#submit:hover {
background-color: #d3ebff;
}
@ -559,21 +547,7 @@ textarea {
border:#000000;
background-color: #791515;
}
.file{
margin-top: 10px;
}
.file input{
height: 110%;
}
/* Preformatted Text */
pre {
font-weight: bold;
}
fieldset pre {
color: red;
}
/* Footer */
footer {
@ -588,16 +562,6 @@ footer {
.footer {
text-align: right;
}
footer button {
display: inline-block;
margin: 1px;
width: 115px;
height: 25px;
padding: 0px 0px;
text-align: center;
font-weight: bold;
position: relative;
}
@media (max-width: 500px) {
footer {
width: 100%;

View File

@ -1,68 +0,0 @@
h3.table_title{
text-align: center;
margin-bottom: 1em;
}
table.seat {
border: solid 10px #1f2c3d;
text-align: center;
background-color: rgba(215, 215, 215, 1);
}
table.seat tbody tr:nth-child(2n + 1) {
background-color: rgba(204, 255, 204, 0);
}
table.seat th{
font-size: 0.9em;
padding: 0.30em 0.30em 0.30em 0.30em;
border-bottom: solid 2px #1f2c3d;
}
table.seat th:first-child {
border-right: solid 2px #1f2c3d;
}
table.seat td {
padding: 0.35em 0.35em;
}
table.seat td:first-child {
font-size: 0.9em;
padding: 0.30em 0.30em 0.30em 0.30em;
font-weight: 600;
border-right: solid 2px #1f2c3d;
}
.check_box {
display:none;
}
.check_box+label{
background:url('../../img/seat_red.png') no-repeat;
height: 16px;
width: 16px;
display:inline-block;
}
.check_box:checked+label{
background:url('../../img/seat_green.png') no-repeat;
}
.black.button {
width: 100%;
height: 30px;
border: 1px solid #dadada;
background-color: #00020f;
color: #dadada;
padding: 5px;
margin-top: 5px;
font-size: 12px;
font-weight: bold;
box-shadow: 2px 2px #1f2c3d;
cursor: pointer;
}
.black.button:hover {
border:#000000;
background-color: #791515;
}

View File

@ -1,3 +1,3 @@
<?php
header("Location: ../");
header('Location: ../');
?>

View File

@ -1,3 +0,0 @@
function cambiarCSS(nuevo){
document.getElementById('estilo').setAttribute('href', nuevo);
}

View File

@ -1,598 +0,0 @@
-- phpMyAdmin SQL Dump
-- version 4.6.6deb5
-- https://www.phpmyadmin.net/
--
-- Servidor: localhost:3306
-- Tiempo de generación: 14-05-2021 a las 11:28:23
-- Versión del servidor: 10.0.28-MariaDB-2+b1
-- Versión de PHP: 7.3.27-1~deb10u1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Base de datos: `complucine`
--
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `admin`
--
CREATE TABLE `admin` (
`id` int(15) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `cinema`
--
CREATE TABLE `cinema` (
`id` int(15) UNSIGNED NOT NULL,
`name` varchar(10) NOT NULL,
`direction` varchar(120) NOT NULL,
`phone` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `cinema`
--
INSERT INTO `cinema` (`id`, `name`, `direction`, `phone`) VALUES
(1, 'Cinema 1st', 'Calle de ejemplo 111', '77777777'),
(3, 'Cinema 2st', 'Calle falsa 123', '123456789');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `film`
--
CREATE TABLE `film` (
`id` int(15) UNSIGNED NOT NULL,
`tittle` varchar(60) NOT NULL,
`duration` int(3) UNSIGNED NOT NULL,
`language` varchar(30) NOT NULL,
`description` text NOT NULL,
`img` varchar(60) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `film`
--
INSERT INTO `film` (`id`, `tittle`, `duration`, `language`, `description`, `img`) VALUES
(1, 'iron_man', 120, 'spanish', 'Un empresario millonario construye un traje blindado y lo usa para combatir el crimen y el terrorismo.', ''),
(2, 'iron_man_2', 120, 'spanish', 'Con el mundo ahora consciente de que él es Iron Man, el millonario inventor Tony Stark debe forjar nuevas alianzas y confrontar a un enemigo nuevo y poderoso.', ''),
(3, 'iron_man_3', 120, 'spanish', 'El descarado y brillante Tony Stark, tras ver destruido todo su universo personal, debe encontrar y enfrentarse a un enemigo cuyo poder no conoce límites. Este viaje pondrá a prueba su entereza una y otra vez, y le obligará a confiar en su ingenio.', ''),
(4, 'capitan_america_el_primer_vengador', 120, 'spanish', 'Tras tres meses de someterse a un programa de entrenamiento físico y táctico, encomiendan a Steve Rogers su primera misión como Capitán América. Armado con un escudo indestructible, emprende la guerra contra la perversa organización HYDRA.', ''),
(5, 'capitan_america_el_soldado_de_invierno', 120, 'spanish', 'Capitán América, Viuda Negra y un nuevo aliado, Falcon, se enfrentan a un enemigo inesperado mientras intentan exponer una conspiración que pone en riesgo al mundo.', ''),
(6, 'capitan_america_civil_war', 180, 'spanish', 'Después de que otro incidente internacional, en el que se ven envueltos los Vengadores, produzca daños colaterales, la presión política obliga a poner en marcha un sistema para depurar responsabilidades.', ''),
(7, 'marvel_avengers', 120, 'spanish', 'El director de la Agencia SHIELD decide reclutar a un equipo para salvar al mundo de un desastre casi seguro cuando un enemigo inesperado surge como una gran amenaza para la seguridad mundial.', ''),
(8, 'avengers_age_of_ultron', 120, 'spanish', 'Los Vengadores se reúnen de nuevo y juntan sus fuerzas con las de los recién llegados Quicksilver y Bruja Escarlata para luchar contra un robot maquiavélico llamado Ultrón, el cual Tony Stark creó con el fin de defender la paz, pero resultó defectuoso y ahora pretende exterminar a toda la humanidad.', ''),
(9, 'avengers_inifinity_war', 180, 'spanish', 'Los superhéroes se alían para vencer al poderoso Thanos, el peor enemigo al que se han enfrentado. Si Thanos logra reunir las seis gemas del infinito: poder, tiempo, alma, realidad, mente y espacio, nadie podrá detenerlo.', ''),
(10, 'avengers_end_game', 180, 'spanish', 'Los Vengadores restantes deben encontrar una manera de recuperar a sus aliados para un enfrentamiento épico con Thanos, el malvado que diezmó el planeta y el universo.', '');
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `hall`
--
CREATE TABLE `hall` (
`number` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`numrows` int(3) NOT NULL,
`numcolumns` int(3) NOT NULL,
`total_seats` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `hall`
--
INSERT INTO `hall` (`number`, `idcinema`, `numrows`, `numcolumns`, `total_seats`) VALUES
(1, 1, 12, 8, 60),
(2, 1, 14, 8, 97);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `manager`
--
CREATE TABLE `manager` (
`id` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `manager`
--
INSERT INTO `manager` (`id`, `idcinema`) VALUES
(1, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `promotion`
--
CREATE TABLE `promotion` (
`id` int(15) UNSIGNED NOT NULL,
`tittle` varchar(30) NOT NULL,
`description` text NOT NULL,
`code` varchar(15) NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `promotion`
--
INSERT INTO `promotion` (`id`, `tittle`, `description`, `code`, `active`) VALUES
(1, '3x2', 'en entradas', '000001A', 0),
(2, 'Promocion de ejemplo', 'Esto es un ejemplo', '1234', 0);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `purchase`
--
CREATE TABLE `purchase` (
`iduser` int(15) UNSIGNED NOT NULL,
`idsession` int(15) UNSIGNED NOT NULL,
`idhall` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`numrow` int(3) UNSIGNED NOT NULL,
`numcolum` int(3) UNSIGNED NOT NULL,
`time_purchase` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `seat`
--
CREATE TABLE `seat` (
`idhall` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`numrow` int(3) UNSIGNED NOT NULL,
`numcolum` int(3) UNSIGNED NOT NULL,
`active` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `seat`
--
INSERT INTO `seat` (`idhall`, `idcinema`, `numrow`, `numcolum`, `active`) VALUES
(1, 1, 1, 1, 0),
(1, 1, 1, 2, 0),
(1, 1, 1, 3, 0),
(1, 1, 1, 4, -1),
(1, 1, 1, 5, -1),
(1, 1, 1, 6, 0),
(1, 1, 1, 7, 0),
(1, 1, 1, 8, 0),
(1, 1, 2, 1, 0),
(1, 1, 2, 2, 0),
(1, 1, 2, 3, 0),
(1, 1, 2, 4, -1),
(1, 1, 2, 5, -1),
(1, 1, 2, 6, 0),
(1, 1, 2, 7, 0),
(1, 1, 2, 8, 0),
(1, 1, 3, 1, 0),
(1, 1, 3, 2, 0),
(1, 1, 3, 3, 0),
(1, 1, 3, 4, -1),
(1, 1, 3, 5, -1),
(1, 1, 3, 6, 0),
(1, 1, 3, 7, 0),
(1, 1, 3, 8, 0),
(1, 1, 4, 1, -1),
(1, 1, 4, 2, -1),
(1, 1, 4, 3, -1),
(1, 1, 4, 4, -1),
(1, 1, 4, 5, -1),
(1, 1, 4, 6, -1),
(1, 1, 4, 7, -1),
(1, 1, 4, 8, -1),
(1, 1, 5, 1, -1),
(1, 1, 5, 2, -1),
(1, 1, 5, 3, -1),
(1, 1, 5, 4, -1),
(1, 1, 5, 5, -1),
(1, 1, 5, 6, -1),
(1, 1, 5, 7, -1),
(1, 1, 5, 8, -1),
(1, 1, 6, 1, 0),
(1, 1, 6, 2, 0),
(1, 1, 6, 3, 0),
(1, 1, 6, 4, -1),
(1, 1, 6, 5, -1),
(1, 1, 6, 6, 0),
(1, 1, 6, 7, 0),
(1, 1, 6, 8, 0),
(1, 1, 7, 1, 0),
(1, 1, 7, 2, 0),
(1, 1, 7, 3, 0),
(1, 1, 7, 4, -1),
(1, 1, 7, 5, -1),
(1, 1, 7, 6, 0),
(1, 1, 7, 7, 0),
(1, 1, 7, 8, 0),
(1, 1, 8, 1, 0),
(1, 1, 8, 2, 0),
(1, 1, 8, 3, 0),
(1, 1, 8, 4, -1),
(1, 1, 8, 5, -1),
(1, 1, 8, 6, 0),
(1, 1, 8, 7, 0),
(1, 1, 8, 8, 0),
(1, 1, 9, 1, 0),
(1, 1, 9, 2, 0),
(1, 1, 9, 3, 0),
(1, 1, 9, 4, -1),
(1, 1, 9, 5, -1),
(1, 1, 9, 6, 0),
(1, 1, 9, 7, 0),
(1, 1, 9, 8, 0),
(1, 1, 10, 1, 0),
(1, 1, 10, 2, 0),
(1, 1, 10, 3, 0),
(1, 1, 10, 4, -1),
(1, 1, 10, 5, -1),
(1, 1, 10, 6, 0),
(1, 1, 10, 7, 0),
(1, 1, 10, 8, 0),
(1, 1, 11, 1, 0),
(1, 1, 11, 2, 0),
(1, 1, 11, 3, 0),
(1, 1, 11, 4, -1),
(1, 1, 11, 5, -1),
(1, 1, 11, 6, 0),
(1, 1, 11, 7, 0),
(1, 1, 11, 8, 0),
(1, 1, 12, 1, 0),
(1, 1, 12, 2, 0),
(1, 1, 12, 3, 0),
(1, 1, 12, 4, -1),
(1, 1, 12, 5, -1),
(1, 1, 12, 6, 0),
(1, 1, 12, 7, 0),
(1, 1, 12, 8, 0),
(2, 1, 1, 1, 1),
(2, 1, 1, 2, 1),
(2, 1, 1, 3, 1),
(2, 1, 1, 4, 1),
(2, 1, 1, 5, 1),
(2, 1, 1, 6, 1),
(2, 1, 1, 7, 1),
(2, 1, 1, 8, 1),
(2, 1, 2, 1, 1),
(2, 1, 2, 2, 1),
(2, 1, 2, 3, 1),
(2, 1, 2, 4, 1),
(2, 1, 2, 5, 1),
(2, 1, 2, 6, 1),
(2, 1, 2, 7, 1),
(2, 1, 2, 8, 1),
(2, 1, 3, 1, 1),
(2, 1, 3, 2, -1),
(2, 1, 3, 3, -1),
(2, 1, 3, 4, -1),
(2, 1, 3, 5, 1),
(2, 1, 3, 6, 1),
(2, 1, 3, 7, 1),
(2, 1, 3, 8, 1),
(2, 1, 4, 1, 1),
(2, 1, 4, 2, -1),
(2, 1, 4, 3, -1),
(2, 1, 4, 4, -1),
(2, 1, 4, 5, 1),
(2, 1, 4, 6, 1),
(2, 1, 4, 7, 1),
(2, 1, 4, 8, 1),
(2, 1, 5, 1, 1),
(2, 1, 5, 2, -1),
(2, 1, 5, 3, -1),
(2, 1, 5, 4, -1),
(2, 1, 5, 5, 1),
(2, 1, 5, 6, 1),
(2, 1, 5, 7, 1),
(2, 1, 5, 8, 1),
(2, 1, 6, 1, 1),
(2, 1, 6, 2, 1),
(2, 1, 6, 3, 1),
(2, 1, 6, 4, 1),
(2, 1, 6, 5, 1),
(2, 1, 6, 6, 1),
(2, 1, 6, 7, 1),
(2, 1, 6, 8, 1),
(2, 1, 7, 1, 1),
(2, 1, 7, 2, 1),
(2, 1, 7, 3, 1),
(2, 1, 7, 4, 1),
(2, 1, 7, 5, -1),
(2, 1, 7, 6, -1),
(2, 1, 7, 7, 1),
(2, 1, 7, 8, 1),
(2, 1, 8, 1, 1),
(2, 1, 8, 2, 1),
(2, 1, 8, 3, 1),
(2, 1, 8, 4, 1),
(2, 1, 8, 5, -1),
(2, 1, 8, 6, -1),
(2, 1, 8, 7, 1),
(2, 1, 8, 8, 1),
(2, 1, 9, 1, 1),
(2, 1, 9, 2, 1),
(2, 1, 9, 3, 1),
(2, 1, 9, 4, 1),
(2, 1, 9, 5, -1),
(2, 1, 9, 6, -1),
(2, 1, 9, 7, 1),
(2, 1, 9, 8, 1),
(2, 1, 10, 1, 1),
(2, 1, 10, 2, 1),
(2, 1, 10, 3, 1),
(2, 1, 10, 4, 1),
(2, 1, 10, 5, 1),
(2, 1, 10, 6, 1),
(2, 1, 10, 7, 1),
(2, 1, 10, 8, 1),
(2, 1, 11, 1, 1),
(2, 1, 11, 2, 1),
(2, 1, 11, 3, 1),
(2, 1, 11, 4, 1),
(2, 1, 11, 5, 1),
(2, 1, 11, 6, 1),
(2, 1, 11, 7, 1),
(2, 1, 11, 8, 1),
(2, 1, 12, 1, 1),
(2, 1, 12, 2, 1),
(2, 1, 12, 3, 1),
(2, 1, 12, 4, 1),
(2, 1, 12, 5, 1),
(2, 1, 12, 6, 1),
(2, 1, 12, 7, 1),
(2, 1, 12, 8, 1),
(2, 1, 13, 1, 1),
(2, 1, 13, 2, 1),
(2, 1, 13, 3, 1),
(2, 1, 13, 4, 1),
(2, 1, 13, 5, 1),
(2, 1, 13, 6, 1),
(2, 1, 13, 7, 1),
(2, 1, 13, 8, 1),
(2, 1, 14, 1, 1),
(2, 1, 14, 2, 1),
(2, 1, 14, 3, 1),
(2, 1, 14, 4, 1),
(2, 1, 14, 5, 1),
(2, 1, 14, 6, 1),
(2, 1, 14, 7, 1),
(2, 1, 14, 8, 1);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `session`
--
CREATE TABLE `session` (
`id` int(15) UNSIGNED NOT NULL,
`idfilm` int(15) UNSIGNED NOT NULL,
`idhall` int(15) UNSIGNED NOT NULL,
`idcinema` int(15) UNSIGNED NOT NULL,
`date` date NOT NULL,
`start_time` time NOT NULL,
`seat_price` float NOT NULL,
`format` varchar(20) NOT NULL,
`seats_full` int(3) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Volcado de datos para la tabla `session`
--
INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`, `seats_full`) VALUES
(19, 1, 2, 1, '2021-05-14', '19:00:00', 12, '2d', 0),
(20, 1, 2, 1, '2021-05-15', '19:00:00', 12, '2d', 0);
-- --------------------------------------------------------
--
-- Estructura de tabla para la tabla `users`
--
CREATE TABLE `users` (
`id` int(15) UNSIGNED NOT NULL,
`username` varchar(10) NOT NULL,
`email` varchar(30) NOT NULL,
`passwd` varchar(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
`rol` varchar(7) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Usuarios';
--
-- Volcado de datos para la tabla `users`
--
INSERT INTO `users` (`id`, `username`, `email`, `passwd`, `rol`) VALUES
(0, 'admin', 'admin@complucine.sytes.net', 'shDBCKnEbWZFc', 'admin'),
(1, 'manager', 'manager@complucine.sytes.net', 'shTS9RK/eJPoQ', 'manager'),
(2, 'user', 'user@complucine.sytes.net', 'shO5etd.DYKWg', 'user'),
(7, 'fernando', 'fer@complucine.sytes.net', '$2y$10$/3yjEh4d7AOY3RyNjXIIkO5H2hg7/kiHiToJa92tCBPd7s3UPtB.G', 'user'),
(63, 'user2', 'user2@ucm.es', '$2y$10$Alopov4Z1HPW9i9PqQ/APedPoU.N/zc3XlRfIfSkwPCQCKI.qTp5u', 'user');
--
-- Índices para tablas volcadas
--
--
-- Indices de la tabla `admin`
--
ALTER TABLE `admin`
ADD KEY `PK_A_USER` (`id`);
--
-- Indices de la tabla `cinema`
--
ALTER TABLE `cinema`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `film`
--
ALTER TABLE `film`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `U_TITTLE_LANGUAGE` (`tittle`,`language`);
--
-- Indices de la tabla `hall`
--
ALTER TABLE `hall`
ADD PRIMARY KEY (`number`,`idcinema`),
ADD KEY `FK_CINEMA` (`idcinema`);
--
-- Indices de la tabla `manager`
--
ALTER TABLE `manager`
ADD KEY `PK_M_USER` (`id`),
ADD KEY `PK_M_CINEMA` (`idcinema`);
--
-- Indices de la tabla `promotion`
--
ALTER TABLE `promotion`
ADD PRIMARY KEY (`id`);
--
-- Indices de la tabla `purchase`
--
ALTER TABLE `purchase`
ADD KEY `PK_P_SEAT` (`idhall`,`numrow`,`numcolum`),
ADD KEY `FK_P_SESSION` (`idsession`),
ADD KEY `FK_P_USER` (`iduser`),
ADD KEY `FK_P_SEAT` (`idhall`,`idcinema`,`numrow`,`numcolum`);
--
-- Indices de la tabla `seat`
--
ALTER TABLE `seat`
ADD PRIMARY KEY (`idhall`,`numrow`,`numcolum`),
ADD KEY `FK_HALL` (`idhall`,`idcinema`);
--
-- Indices de la tabla `session`
--
ALTER TABLE `session`
ADD PRIMARY KEY (`id`),
ADD KEY `FK_FILM` (`idfilm`),
ADD KEY `FK_HALL_` (`idhall`,`idcinema`);
--
-- Indices de la tabla `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `email` (`email`),
ADD UNIQUE KEY `username_2` (`username`),
ADD KEY `username` (`username`);
--
-- AUTO_INCREMENT de las tablas volcadas
--
--
-- AUTO_INCREMENT de la tabla `cinema`
--
ALTER TABLE `cinema`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de la tabla `film`
--
ALTER TABLE `film`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=15;
--
-- AUTO_INCREMENT de la tabla `hall`
--
ALTER TABLE `hall`
MODIFY `number` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=6;
--
-- AUTO_INCREMENT de la tabla `promotion`
--
ALTER TABLE `promotion`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de la tabla `session`
--
ALTER TABLE `session`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=21;
--
-- AUTO_INCREMENT de la tabla `users`
--
ALTER TABLE `users`
MODIFY `id` int(15) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=65;
--
-- Restricciones para tablas volcadas
--
--
-- Filtros para la tabla `admin`
--
ALTER TABLE `admin`
ADD CONSTRAINT `PK_A_USER` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `hall`
--
ALTER TABLE `hall`
ADD CONSTRAINT `FK_CINEMA` FOREIGN KEY (`idcinema`) REFERENCES `cinema` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `manager`
--
ALTER TABLE `manager`
ADD CONSTRAINT `PK_M_CINEMA` FOREIGN KEY (`idcinema`) REFERENCES `cinema` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `PK_M_USER` FOREIGN KEY (`id`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `purchase`
--
ALTER TABLE `purchase`
ADD CONSTRAINT `FK_P_SEAT` FOREIGN KEY (`idhall`,`idcinema`,`numrow`,`numcolum`) REFERENCES `seat` (`idhall`, `idcinema`, `numrow`, `numcolum`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_P_SESSION` FOREIGN KEY (`idsession`) REFERENCES `session` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_P_USER` FOREIGN KEY (`iduser`) REFERENCES `users` (`id`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `seat`
--
ALTER TABLE `seat`
ADD CONSTRAINT `FK_HALL` FOREIGN KEY (`idhall`,`idcinema`) REFERENCES `hall` (`number`, `idcinema`) ON DELETE CASCADE ON UPDATE CASCADE;
--
-- Filtros para la tabla `session`
--
ALTER TABLE `session`
ADD CONSTRAINT `FK_FILM` FOREIGN KEY (`idfilm`) REFERENCES `film` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `FK_HALL_` FOREIGN KEY (`idhall`,`idcinema`) REFERENCES `hall` (`number`, `idcinema`) ON DELETE CASCADE ON UPDATE CASCADE;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

View File

@ -1,34 +0,0 @@
<!--
Práctica - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<!DOCTYPE HTML>
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<?php
if(!isset($content)) $content = "";
$template->print_main($content);
?>
<!-- Section -->
<?php
$template->print_section($section);
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -1,138 +0,0 @@
<?php
require_once('config.php');
/**
* Clase que mantiene el estado global de la aplicación.
*/
class Aplicacion {
private static $instancia;
/**
* Permite obtener una instancia de <code>Aplicacion</code>.
*
* @return Applicacion Obtiene la única instancia de la <code>Aplicacion</code>
*/
public static function getSingleton() {
if ( !self::$instancia instanceof self) {
self::$instancia = new self;
}
return self::$instancia;
}
/**
* @var array Almacena los datos de configuración de la BD
*/
private $bdDatosConexion;
/**
* Almacena si la Aplicacion ya ha sido inicializada.
*
* @var boolean
*/
private $inicializada = false;
/**
* @var \mysqli Conexión de BD.
*/
private $conn;
/**
* Evita que se pueda instanciar la clase directamente.
*/
private function __construct() {}
/**
* Evita que se pueda utilizar el operador clone.
*/
public function __clone() {
throw new \Exception('No tiene sentido el clonado.');
}
/**
* Evita que se pueda utilizar serialize().
*/
public function __sleep() {
throw new \Exception('No tiene sentido el serializar el objeto.');
}
/**
* Evita que se pueda utilizar unserialize().
*/
public function __wakeup() {
throw new \Exception('No tiene sentido el deserializar el objeto.');
}
/**
* Inicializa la aplicación.
*
* @param array $bdDatosConexion datos de configuración de la BD
*/
public function init($bdDatosConexion) {
if ( ! $this->inicializada ) {
$this->bdDatosConexion = $bdDatosConexion;
if ( $this->is_session_started() === FALSE ) session_start();
$this->inicializada = true;
}
}
/**
* Inicia la sesión, si esta no se había iniciado.
*/
protected function is_session_started(){
if ( php_sapi_name() !== 'cli' ) {
if ( version_compare(phpversion(), '5.4.0', '>=') ) {
return session_status() === PHP_SESSION_ACTIVE ? TRUE : FALSE;
} else {
return session_id() === '' ? FALSE : TRUE;
}
}
return FALSE;
}
/**
* Cierre de la aplicación.
*/
public function shutdown() {
$this->compruebaInstanciaInicializada();
if ($this->conn !== null) {
$this->conn->close();
}
}
/**
* Comprueba si la aplicación está inicializada. Si no lo está muestra un mensaje y termina la ejecución.
*/
private function compruebaInstanciaInicializada() {
if (! $this->inicializada ) {
echo "ERROR 403: app_not_configured.";
exit();
}
}
/**
* Devuelve una conexión a la BD. Se encarga de que exista como mucho una conexión a la BD por petición.
*
* @return \mysqli Conexión a MySQL.
*/
public function conexionBd() {
$this->compruebaInstanciaInicializada();
if (! $this->conn ) {
$bdHost = $this->bdDatosConexion['host'];
$bdUser = $this->bdDatosConexion['user'];
$bdPass = $this->bdDatosConexion['pass'];
$bd = $this->bdDatosConexion['bd'];
$this->conn = new \mysqli($bdHost, $bdUser, $bdPass, $bd);
if ( $this->conn->connect_errno ) {
echo "Error de conexión a la BD: (" . $this->conn->connect_errno . ") " . utf8_encode($this->conn->connect_error);
exit();
}
if ( ! $this->conn->set_charset("utf8mb4")) {
echo "Error al configurar la codificación de la BD: (" . $this->conn->errno . ") " . utf8_encode($this->conn->error);
exit();
}
}
return $this->conn;
}
}

View File

@ -1,32 +0,0 @@
<?php
class Cinema{
//Attributes:
private $_id; //Cinema ID.
private $_name; //Cinema name.
private $_direction; //Cinema direction.
private $_phone; //Cinema phone.
//Constructor:
function __construct($id, $name, $direction, $phone){
$this->_id = $id;
$this->_name = $name;
$this->_direction = $direction;
$this->_phone = $phone;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setName($name){ $this->_name = $name; }
public function getName(){ return $this->_name; }
public function setDirection($direction){ $this->_direction = $direction; }
public function getDirection(){ return $this->_direction; }
public function setPhone($phone){$this->_phone = $phone; }
public function getPhone(){ return $this->_phone; }
}
?>

View File

@ -1,77 +0,0 @@
<?php
include_once('cinema.php');
class Cinema_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Session.
public function createCinema($id, $name, $direction, $phone){
$sql = sprintf( "INSERT INTO `cinema`( `id`, `name`, `direction`, `phone`)
VALUES ( '%d', '%s', '%s', '%s')",
$id, $name, $direction, $phone);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to get All the films.
public function allCinemaData(){
$sql = sprintf( "SELECT * FROM cinema ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$films[] = $this->loadCinema($fila["id"], $fila["name"], $fila["direction"], $fila["phone"]);
}
$resul->free();
return $films;
}
//Returns a film data .
public function GetCinema($name,$direction){
$sql = sprintf( "SELECT * FROM cinema WHERE cinema.name = '%s'AND cinema.direction='%s'", $name,$direction );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a film data .
public function cinemaData($id){
$sql = sprintf( "SELECT * FROM cinema WHERE cinema.id = '%d'", $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Deleted film by "id".
public function deleteCinema($id){
$sql = sprintf( "DELETE FROM cinema WHERE cinema.id = '%d' ;",$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit a film.
public function editCinema($id, $name, $direction, $phone){
$sql = sprintf( "UPDATE cinema SET name = '%s' , direction = '%s', phone ='%s'
WHERE cinema.id = '%d';",
$name, $direction, $phone, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new film Data Transfer Object.
public function loadCinema($id, $name, $direction, $phone){
return new Cinema($id, $name, $direction, $phone);
}
}
?>

View File

@ -1,103 +0,0 @@
<?php
include_once($prefix.'assets/php/common/hall_dao.php');
include_once('seat_dao.php');
class Hall{
//Attributes:
private $_number; //Room number.
private $_idcinema; //Cinema Id
private $_numRows; //Num rows.
private $_numCol; //Num columns.
private $_total_seats;
private $_seats_map;
//Constructor:
function __construct($number, $idcinema, $numRows, $numCol, $total_seats, $seats_map){
$this->_number = $number;
$this->_idcinema = $idcinema;
$this->_numRows = $numRows;
$this->_numCol = $numCol;
$this->_total_seats = $total_seats;
$_seats_map = array();
$_seats_map = $seats_map;
}
//Methods:
public static function getListHalls($cinema){
$bd = new HallDAO('complucine');
if($bd )
return $bd->getAllHalls($cinema);
}
public static function create_hall($number, $cinema, $rows, $cols, $seats, $seats_map){
$bd = new HallDAO('complucine');
if($bd ){
if(!$bd->searchHall($number, $cinema)){
$bd->createHall($number, $cinema, $rows, $cols, $seats, $seats_map);
Seat::createSeats($number, $cinema, $rows, $cols, $seats_map);
return "Se ha creado la sala con exito";
} else {
return "Esta sala ya existe";
}
} else { return "Error al conectarse a la base de datos"; }
}
public static function edit_hall($number, $cinema, $rows, $cols, $seats, $seats_map, $og_number){
$bd = new HallDAO('complucine');
if($bd ){
if($bd->searchHall($og_number, $cinema)){
if($og_number == $number){
Seat::deleteAllSeats($number, $cinema);
$bd->editHall($number, $cinema, $rows, $cols, $seats, $og_number);
Seat::createSeats($number, $cinema, $rows, $cols, $seats_map);
return "Se ha editado la sala con exito";
}else{
if(!$bd->searchHall($number, $cinema)){
Seat::deleteAllSeats($og_number, $cinema);
$bd->editHall($number, $cinema, $rows, $cols, $seats, $og_number);
Seat::createSeats($number, $cinema, $rows, $cols, $seats_map);
return "Se ha editado la sala con exito";
}else
return "El nuevo numero de sala ya existe en otra sala";
}
} else {
return "La sala a editar no existe";
}
} else { return "Error al conectarse a la base de datos"; }
}
public static function delete_hall($number, $cinema, $rows, $cols, $seats, $seats_map, $og_number){
$bd = new HallDAO('complucine');
if($bd ){
if($bd->searchHall($og_number, $cinema)){
$bd->deleteHall($og_number, $cinema);
Seat::deleteAllSeats($og_number, $cinema);
return "La sala se ha eliminado correctamente";
} else {
return "La sala a borrar no existe";
}
} else { return "Error al conectarse a la base de datos"; }
}
//Getters && Setters:
public function setNumber($number){ $this->_number = $number; }
public function getNumber(){ return $this->_number; }
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setNumRows($numRows){ $this->_numRows = $numRows; }
public function getNumRows(){ return $this->_numRows; }
public function setNumCol($numCol){ $this->_numCol = $numCol; }
public function getNumCol(){ return $this->_numCol; }
public function setTotalSeats($totalSeat){ $this->_total_seats = $totalSeat; }
public function getTotalSeats(){ return $this->_total_seats; }
public function setSeatsmap($seats_map){ $this->_seats_map = $seats_map; }
public function getSeatsmap(){ return $this->_seats_map; }
}
?>

View File

@ -1,96 +0,0 @@
<?php
include_once('hall.php');
class HallDAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Hall.
public function createHall($number, $cinema, $rows, $cols, $seats, $seats_map){
$sql = sprintf( "INSERT INTO `hall`( `number`, `idcinema`, `numrows`, `numcolumns`, `total_seats`)
VALUES ( '%d', '%d', '%d', '%d', '%d')",
$number, $cinema, $rows, $cols, $seats );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createhall');
return $sql;
}
//Returns a query to get the halls data.
public function getAllHalls($cinema){
$sql = sprintf( "SELECT * FROM hall WHERE
idcinema = '%s'",
$cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$hall = null;
while($fila=mysqli_fetch_array($resul)){
$hall[] = $this->loadHall($fila["number"], $fila["idcinema"], $fila["numrows"], $fila["numcolumns"], $fila["total_seats"], null);
}
mysqli_free_result($resul);
return $hall;
}
public function searchHall($number, $cinema){
$sql = sprintf( "SELECT * FROM hall WHERE
number = '%s' AND idcinema = '%s'",
$number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$hall = false;
if($resul){
if($resul->num_rows == 1){
$fila = $resul->fetch_assoc();
$hall = $this->loadHall($fila["number"], $fila["idcinema"], $fila["numrows"], $fila["numcolumns"], $fila["total_seats"], null);
}
$resul->free();
}
return $hall;
}
//Create a new Hall Data Transfer Object.
public function loadHall($number, $idcinema, $numrows, $numcolumns, $total_seats, $seats_map){
return new Hall($number, $idcinema, $numrows, $numcolumns, $total_seats, $seats_map);
}
//Edit Hall.
public function editHall($number, $cinema, $rows, $cols, $seats, $og_number){
$sql = sprintf( "UPDATE `hall`
SET `number` = '%d' ,`numrows` = '%d' , `numcolumns` = '%d' , `total_seats` = %d
WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",
$number, $rows, $cols, $seats, $og_number, $cinema );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Delete Hall.
public function deleteHall($number, $cinema){
$sql = sprintf( "DELETE FROM `hall` WHERE `hall`.`number` = '%d' AND `hall`.`idcinema` = '%d';",$number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
}
?>

View File

@ -1,35 +0,0 @@
<?php
class Manager{
//Attributes:
private $_id; //Manager ID.
private $_username; //Manager username.
private $_email; //Email.
private $_roll; //Roll
//Constructor:
function __construct($id, $idcinema, $username, $email, $roll){
$this->_id = $id;
$this->_idcinema = $idcinema;
$this->_username = $username;
$this->_email = $email;
$this->_roll = $roll;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setUsername($username){$this->_username = $username; }
public function getUsername(){ return $this->_username;}
public function setEmail($email){$this->_email = $email;}
public function getEmail(){return $this->_email;}
public function setRoll($roll){$this->_roll = $roll;}
public function getRoll(){return $this->_roll;}
}
?>

View File

@ -1,77 +0,0 @@
<?php
include_once('manager.php');
class Manager_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Returns a query to get All the managers.
public function allManagersData(){
$sql = sprintf( "SELECT * FROM `users` JOIN `manager` ON manager.id = users.id");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$managers[] = $this->loadManager($fila["id"], $fila["idcinema"], $fila["username"], $fila["email"], $fila["rol"]);
}
$resul->free();
return $managers;
}
//Returns a manager data .
public function GetManager($id){
$sql = sprintf( "SELECT * FROM `manager` WHERE manager.id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a manager data .
public function GetManagerCinema($id, $idcinema){
$sql = sprintf( "SELECT * FROM `manager` WHERE manager.id = '%d' AND manager.idcinema ='%d'", $id, $idcinema );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new Session.
public function createManager($id, $idcinema){
$sql = sprintf( "INSERT INTO `manager`( `id`, `idcinema`)
VALUES ( '%d', '%d')",
$id, $idcinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Deleted manager by "id".
public function deleteManager($id){
$sql = sprintf( "DELETE FROM `manager` WHERE manager.id = '%d' ;",$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit manager.
public function editManager($id, $idcinema){
$sql = sprintf( "UPDATE `manager` SET manager.idcinema = '%d'
WHERE manager.id = '%d';",
$idcinema, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new Manager Data Transfer Object.
public function loadManager($id, $idcinema, $username, $email, $rol){
return new Manager($id, $idcinema, $username, $email, $rol);
}
}
?>

View File

@ -1,36 +0,0 @@
<?php
class Promotion{
//Attributes:
private $_id; //Cinema ID.
private $_tittle; //Cinema name.
private $_description; //Cinema direction.
private $_code; //Cinema phone.
private $_active;
//Constructor:
function __construct($id, $tittle, $description, $code, $active){
$this->_id = $id;
$this->_tittle = $tittle;
$this->_description = $description;
$this->_code = $code;
$this->_active = $active;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setTittle($tittle){ $this->_tittle = $tittle; }
public function getTittle(){ return $this->_tittle; }
public function setDescription($description){ $this->_description = $description;}
public function getDescription(){return $this->_description;}
public function setCode($code){ $this->_code = $code;}
public function getCode(){return $this->_code;}
public function setActive($active){ $this->_active = $active;}
public function getActive(){return $this->_active;}
}
?>

View File

@ -1,77 +0,0 @@
<?php
include_once('promotion.php');
class Promotion_DAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Session.
public function createPromotion($id, $tittle, $description, $code, $active){
$sql = sprintf( "INSERT INTO `promotion`( `id`, `tittle`, `description`, `code`, `active`)
VALUES ( '%d', '%s', '%s', '%s', '%s')",
$id, $tittle, $description, $code, $active);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to get All the films.
public function allPromotionData(){
$sql = sprintf( "SELECT * FROM promotion ");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$promotions[] = $this->loadPromotion($fila["id"], $fila["tittle"], $fila["description"], $fila["code"], $fila["active"]);
}
$resul->free();
return $promotions;
}
//Returns a film data .
public function GetPromotion($code){
$sql = sprintf( "SELECT * FROM promotion WHERE promotion.code = '%s'", $code );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a film data .
public function promotionData($id){
$sql = sprintf( "SELECT * FROM promotion WHERE promotion.id = '%d'", $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Deleted film by "id".
public function deletePromotion($id){
$sql = sprintf( "DELETE FROM promotion WHERE promotion.id = '%d' ;",$id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Edit a film.
public function editPromotion($id, $tittle, $description, $code, $active){
$sql = sprintf( "UPDATE promotion SET tittle = '%s' , description = '%s', code ='%s' , active ='%s'
WHERE promotion.id = '%d';",
$tittle, $description, $code, $active, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new film Data Transfer Object.
public function loadPromotion($id, $tittle, $description, $code, $active){
return new Promotion($id, $tittle, $description, $code, $active);
}
}
?>

View File

@ -1,63 +0,0 @@
<?php
include_once($prefix.'assets/php/common/seat_dao.php');
class Seat{
//Attributes:
private $_idhall;
private $_idcinema;
private $_numRow;
private $_numCol;
private $_state;
//Constructor:
function __construct($idhall, $idcinema, $numRow, $numCol, $state){
$this->_number = $idhall;
$this->_idcinema = $idcinema;
$this->_numRow = $numRow;
$this->_numCol = $numCol;
$this->_state = $state;
}
static public function createSeats($hall, $cinema, $rows, $cols, $seats_map){
$bd = new SeatDAO('complucine');
for($i = 1;$i <= $rows;$i++){
for($j = 1; $j <= $cols;$j++){
$bd->createSeat($hall, $cinema, $i, $j, $seats_map[$i][$j]);
}
}
}
static public function getSeatsMap($number, $cinema){
$bd = new SeatDAO('complucine');
if($bd )
return $bd->getAllSeats($number, $cinema);
}
static public function deleteAllSeats($number, $cinema){
$bd = new SeatDAO('complucine');
if($bd)
return $bd->deletemapSeats($number, $cinema);
}
//Getters && Setters:
public function setNumber($number){ $this->_number = $number; }
public function getNumber(){ return $this->_number; }
public function setIdcinema($idcinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setNumRows($numRow){ $this->_numRow = $numRow; }
public function getNumRows(){ return $this->_numRow; }
public function setNumCol($numCol){ $this->_numCol = $numCol; }
public function getNumCol(){ return $this->_numCol; }
public function setState($state){ $this->_state = $state; }
public function getState(){ return $this->_state; }
}
?>

View File

@ -1,58 +0,0 @@
<?php
include_once('seat.php');
class SeatDAO extends DAO {
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Create a new Hall.
public function createSeat($hall, $cinema, $row, $col, $state){
$sql = sprintf( "INSERT INTO `seat`( `idhall`, `idcinema`, `numrow`, `numcolum`, `active`)
VALUES ( '%d', '%d', '%d', '%d', '%d')",
$hall, $cinema, $row, $col, $state);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error BD createSeat');
return $sql;
}
public function getAllSeats($number, $cinema){
$sql = sprintf( "SELECT * FROM seat WHERE
idhall = '%s' AND idcinema = '%s'",
$number, $cinema);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$seat_map = null;
while($fila=mysqli_fetch_array($resul)){
$seat_map[] = $this->loadSeat($fila["idhall"], $fila["idcinema"], $fila["numrow"], $fila["numcolum"], $fila["active"]);
}
mysqli_free_result($resul);
return $seat_map;
}
public function deletemapSeats($hall, $cinema){
$sql = sprintf( "DELETE FROM `seat` WHERE
idcinema = '%s' AND idhall = '%s'",
$cinema, $hall);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
public function loadSeat($idhall, $idcinema, $numRow, $numCol, $state){
return new Seat($idhall, $idcinema, $numRow, $numCol, $state);
}
}
?>

View File

@ -1,118 +0,0 @@
<?php
include_once($prefix.'assets/php/common/session_dao.php');
class Session{
private $_id;
private $_idfilm;
private $_idhall;
private $_idcinema;
private $_date;
private $_startTime;
private $_seatPrice;
private $_format;
private $_seats_full;
function __construct($id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full){
$this->_id = $id;
$this->_idfilm = $idfilm;
$this->_idhall = $idhall;
$this->_idcinema = $idcinema;
$this->_date = $date;
$this->_startTime = $startTime;
$this->_seatPrice = $seatPrice;
$this->_format = $format;
$this->_seats_full = $seats_full;
}
public static function getListSessions($hall,$cinema,$date){
$bd = new SessionDAO('complucine');
if($bd ) {
return $bd->getAllSessions($hall, $cinema, $date);
}
}
public static function create_session($cinema, $hall, $start, $date, $film, $price, $format,$repeat){
$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);
return "Se han creado las ".$repeat ." sesiones con exito";
}
else
return "Se ha creado la session con exito";
} else
return "Esta session ya existe";
} 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){
$bd = new SessionDAO('complucine');
if($bd ){
if($bd->searchSession($cinema, $or_hall, $or_start, $or_date)){
if(!$bd->searchSession($cinema,$hall,$start,$date)){
$origin = array("cinema" => $cinema,"hall" => $or_hall,"start" => $or_start,"date" => $or_date);
$bd->editSession($film, $hall, $cinema, $date, $start, $price, $format,$origin);
return "Se ha editado la session con exito";
}else
return "Ya existe una sesion con los parametros nuevos";
} else
return "Esta session no existe";
} else return "Error al conectarse a la base de datos";
}
public static function delete_session($cinema, $hall, $start, $date){
$bd = new SessionDAO('complucine');
if($bd ){
if($bd->searchSession($cinema, $hall, $start, $date)){
$bd->deleteSession($hall, $cinema, $date, $start);
return "Se ha eliminado la session con exito";
} else
return "Esta session no existe";
} else return "Error al conectarse a la base de datos";
}
//Esto deberia estar en film.php? seguramente
public static function getThisSessionFilm($idfilm){
$bd = new SessionDAO('complucine');
if($bd ) {
return $bd->filmTittle($idfilm);
}
}
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setIdfilm($idfilm){ $this->_idfilm = $idfilm; }
public function getIdfilm(){ return $this->_idfilm; }
public function setIdhall($idhall){ $this->_idhall = $idhall; }
public function getIdhall(){ return $this->_idhall; }
public function setIdcinema($cinema){ $this->_idcinema = $idcinema; }
public function getIdcinema(){ return $this->_idcinema; }
public function setDate($date){ $this->_date = $date; }
public function getDate(){ return $this->_date; }
public function setStartTime($startTime){ $this->_startTime = $startTime; }
public function getStartTime(){ return $this->_startTime; }
public function setSeatPrice($seatPrice){ $this->_seatPrice = $seatPrice; }
public function getSeatPrice(){ return $this->_seatPrice; }
public function setFormat($format){ $this->_format = $format; }
public function getFormat(){ return $this->_format; }
}
?>

View File

@ -1,31 +1,4 @@
<?php
/**
* Connection parameters to the DB.
*/
define('BD_HOST', '');
define('BD_NAME', '');
define('BD_USER', '');
define('BD_PASS', '');
/*
* Configuration parameters used to generate URLs and file paths in the application
*/
define('ROUTE_APP', '/'); //Change if it´s necessary.
define('RAIZ_APP', __DIR__);
/**
* Image files directory.
*/
define('FILMS_DIR', dirname(RAIZ_APP).'img/films/tmp');
define('FILMS_DIR_PROTECTED', RAIZ_APP.'img/films/tmp');
/**
* Utf-8 support settings, location (language and country) and time zone.
*/
ini_set('default_charset', 'UTF-8');
setLocale(LC_ALL, 'es_ES.UTF.8');
date_default_timezone_set('Europe/Madrid');
//Start session:
session_start();
@ -33,23 +6,4 @@
require_once('template.php');
$template = new Template();
$prefix = $template->get_prefix();
/**
* Initialize the application:
*/
include_once($prefix.'assets/php/dao.php');
require_once('aplication.php');
$app = Aplicacion::getSingleton();
$app->init(array('host'=>BD_HOST, 'bd'=>BD_NAME, 'user'=>BD_USER, 'pass'=>BD_PASS));
/**
* @see http://php.net/manual/en/function.register-shutdown-function.php
* @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

@ -1,24 +1,37 @@
<?php
// TO-DO: Completar
class DAO {
//Constants:
private const _SERVERNAME = "";
private const _USERNAME = "";
private const _PASSWORD = "";
private const _BD = "";
//Atributes:
public $mysqli;
//Constructor:
public function __construct($bd_name){
if($bd_name != BD_NAME) {
echo "Está intentando acceder a una base de datos que no existe, puede que la aplicación no funcione correctamente";
if($bd_name == null) $bd_name = self::_BD;
try{
if (!$this->mysqli) {
$this->mysqli = new mysqli(self::_SERVERNAME, self::_USERNAME,
self::_PASSWORD, $bd_name);
}
$app = Aplicacion::getSingleton();
$this->mysqli = $app->conexionBd();
// echo "Conexión a la BD, satisfactoria.";
} catch (Exception $e){
echo "Error de conexión a la BD: ". mysqli_connect_error();
exit();
}
//Destructor (Ya no es necesdario):
/*
/* ... */
}
//Destructor:
public function __destruct(){
$this->mysqli->close();
}
*/
//Methods:
}
?>

View File

@ -1,297 +1,171 @@
<?php
class Form {
/**
* Clase base para la gestión de formularios.
*
* Gestión de token CSRF está basada en: https://www.owasp.org/index.php/PHP_CSRF_Guard
*/
abstract class Form {
/**
* @var string Sufijo para el nombre del parámetro de la sesión del usuario donde se almacena el token CSRF.
* Sufijo para el nombre del parámetro de la sesión del usuario donde se almacena el token CSRF.
*/
const CSRF_PARAM = 'csrf';
/**
* @var string Identificador utilizado para construir el atributo "id" de la etiqueta &lt;form&gt; como <code>$tipoFormulario.$formId</code>.
* Cadena utilizada como valor del atributo "id" de la etiqueta &lt;form&gt; asociada al formulario y como parámetro a comprobar para verificar que el usuario ha enviado el formulario.
*/
private $formId;
/**
* @var string Valor del parámetro enctype del formulario.
*/
private $enctype;
private $ajax;
/**
* @var string Valor del atributo "class" de la etiqueta &lt;form&gt; asociada al formulario. Si este parámetro incluye la cadena "nocsrf" no se generá el token CSRF para este formulario.
* URL asociada al atributo "action" de la etiqueta &lt;form&gt; del fomrulario y que procesará el envío del formulario.
*/
private $action;
/**
* Valor del atributo "class" de la etiqueta &lt;form&gt; asociada al formulario. Si este parámetro incluye la cadena "nocsrf" no se generá el token CSRF para este formulario.
*/
private $classAtt;
/**
* @var string Parámetro de la petición utilizado para comprobar que el usuario ha enviado el formulario..
* Valor del parámetro enctype del formulario.
*/
private $tipoFormulario;
private $enctype;
/**
* @var string URL asociada al atributo "action" de la etiqueta &lt;form&gt; del fomrulario y que procesará el
* envío del formulario.
*/
private $action;
private $printed;
/**
* Crea un nuevo formulario.
* Se encarga de orquestar todo el proceso de creación y procesamiento de un formulario web.
*
* Posibles opciones:
* <table>
* <thead>
* <tr>
* <th>Opción</th>
* <th>Valor por defecto</th>
* <th>Descripción</th>
* </tr>
* </thead>
* <tbody>
* <tr>
* <td>action</td>
* <td><code>$_SERVER['PHP_SELF']</code></td>
* <td>URL asociada al atributo "action" de la etiqueta &lt;form&gt; del fomrulario y que procesará el envío del formulario.</td>
* </tr>
* <tr>
* <td>class</td>
* <td>""</td>
* <td>Valor del atributo "class" de la etiqueta &lt;form&gt; asociada al formulario. Si este parámetro incluye la cadena
* "nocsrf" no se generá el token CSRF para este formulario.</td>
* </tr>
* <tr>
* <td>enctype</td>
* <td>""</td>
* <td>Valor del parámetro enctype del formulario.</td>
* </tr>
* </tbody>
* </table>
* @param string $tipoFormulario Parámetro de la petición utilizado para comprobar que el usuario ha enviado el formulario.
* @param string $formId (opcional) Identificador utilizado para construir el atributo "id" de la etiqueta &lt;form&gt; como <code>$tipoFormulario.$formId</code>.
* @param string $formId Cadena utilizada como valor del atributo "id" de la etiqueta &lt;form&gt; asociada al formulario y como parámetro a comprobar para verificar que el usuario ha enviado el formulario.
*
* @param array $opciones (ver más arriba).
* @param string $action (opcional) URL asociada al atributo "action" de la etiqueta &lt;form&gt; del fomrulario y que procesará el envío del formulario. Por defecto la URL es $_SERVER['PHP_SELF']
*
* @param string $class (opcional) Valor del atributo "class" de la etiqueta &lt;form&gt; asociada al formulario. Si este parámetro incluye la cadena "nocsrf" no se generá el token CSRF para este formulario.
*
* @param string enctype (opcional) Valor del parámetro enctype del formulario.
*/
public function __construct($tipoFormulario, $opciones = array(), $formId = 1)
{
$this->tipoFormulario = $tipoFormulario;
$this->formId = $tipoFormulario.$formId;
public function __construct($formId, $opciones = array() ) {
$this->formId = $formId;
$opcionesPorDefecto = array( 'action' => null, 'class' => null, 'enctype' => null );
$opcionesPorDefecto = array( 'ajax' => false, 'action' => null, 'class' => null, 'enctype' => null );
$opciones = array_merge($opcionesPorDefecto, $opciones);
$this->ajax = $opciones['ajax'];
$this->action = $opciones['action'];
$this->classAtt = $opciones['class'];
$this->enctype = $opciones['enctype'];
if ( !$this->action ) {
$this->action = htmlentities($_SERVER['PHP_SELF']);
$this->action = $_SERVER['PHP_SELF'];
}
}
/**
* Se encarga de orquestar todo el proceso de gestión de un formulario.
*
* El proceso es el siguiente:
* <ul>
* <li>O bien se quiere mostrar el formulario (petición GET)</li>
* <li>O bien hay que procesar el formulario (petición POST) y hay dos situaciones:
* <ul>
* <li>El formulario se ha procesado correctamente y se devuelve un <code>string</code> en {@see Form::procesaFormulario()}
* que será la URL a la que se rederigirá al usuario. Se redirige al usuario y se termina la ejecución del script.</li>
* <li>El formulario NO se ha procesado correctamente (errores en los datos, datos incorrectos, etc.) y se devuelve
* un <code>array</code> con entradas (campo, mensaje) con errores específicos para un campo o (entero, mensaje) si el mensaje
* es un mensaje que afecta globalmente al formulario. Se vuelve a generar el formulario pasándole el array de errores.</li>
* </ul>
* </li>
* </ul>
*/
public function gestiona()
{
public function gestiona() {
if ( ! $this->formularioEnviado($_POST) ) {
return $this->generaFormulario();
echo $this->generaFormulario();
} else {
// Valida el token CSRF si es necesario (hay un token en la sesión asociada al formulario)
$tokenRecibido = $_POST['CSRFToken'] ?? FALSE;
$errores = $this->csrfguard_ValidateToken($this->tipoFormulario, $tokenRecibido);
// limpia los tokens CSRF que no han sido utilizados en esta petición
self::limpiaCsrfTokens();
$tokenRecibido = isset($_POST['CSRFToken']) ? $_POST['CSRFToken'] : FALSE;
if ( ($errores = $this->csrfguard_ValidateToken($this->formId, $tokenRecibido)) !== TRUE ) {
if ( ! $this->ajax ) {
echo $this->generaFormulario($errores, $_POST);
} else {
echo $this->generaHtmlErrores($errores);
}
} else {
$result = $this->procesaFormulario($_POST);
if ( is_array($result) ) {
return $this->generaFormulario($_POST, $result);
// Error al procesar el formulario, volvemos a mostrarlo
if ( ! $this->ajax ) {
echo $this->generaFormulario($result, $_POST);
} else {
echo $this->generaHtmlErrores($result);
}
} else {
if ( ! $this->ajax ) {
header('Location: '.$result);
exit();
} else {
echo $result;
}
}
}
}
}
/**
* Genera el HTML necesario para presentar los campos del formulario.
*
* Si el formulario ya ha sido enviado y hay errores en {@see Form::procesaFormulario()} se llama a este método
* nuevamente con los datos que ha introducido el usuario en <code>$datosIniciales</code> y los errores al procesar
* el formulario en <code>$errores</code>
*
* @param string[] $datosIniciales Datos iniciales para los campos del formulario (normalmente <code>$_POST</code>).
*
* @param string[] $errores (opcional)Lista / Tabla asociativa de errores asociados al formulario.
*
* @return string HTML asociado a los campos del formulario.
* Devuelve un <code>string</code> con el HTML necesario para presentar los campos del formulario. Es necesario asegurarse que como parte del envío se envía un parámetro con nombre <code$formId</code> (i.e. utilizado como valor del atributo name del botón de envío del formulario).
*/
protected function generaCamposFormulario($datosIniciales, $errores = array())
{
protected function generaCamposFormulario ($datos) {
return '';
}
/**
* Procesa los datos del formulario.
*
* @param string[] $datos Datos enviado por el usuario (normalmente <code>$_POST</code>).
*
* @return string|string[] Devuelve el resultado del procesamiento del formulario, normalmente una URL a la que
* se desea que se redirija al usuario, o un array con los errores que ha habido durante el procesamiento del formulario.
*/
protected function procesaFormulario($datos)
{
return array();
protected function procesaFormulario($datos) {
}
/**
* Función que verifica si el usuario ha enviado el formulario.
* Función que verifica si el usuario ha enviado el formulario. Comprueba si existe el parámetro <code>$formId</code> en <code>$params</code>.
*
* Comprueba si existe el parámetro <code>$formId</code> en <code>$params</code>.
* @param array $params Array que contiene los datos recibidos en el envío formulario.
*
* @param string[] $params Array que contiene los datos recibidos en el envío formulario.
*
* @return boolean Devuelve <code>true</code> si <code>$formId</code> existe como clave en <code>$params</code>
* @return boolean Devuelve <code>TRUE</code> si <code>$formId</code> existe como clave en <code>$params</code>
*/
private function formularioEnviado(&$params)
{
return isset($params['action']) && $params['action'] == $this->tipoFormulario;
private function formularioEnviado(&$params) {
return isset($params['action']) && $params['action'] == $this->formId;
}
/**
* Función que genera el HTML necesario para el formulario.
*
* @param string[] $datos (opcional) Array con los valores por defecto de los campos del formulario.
*
* @param string[] $errores (opcional) Array con los mensajes de error de validación y/o procesamiento del formulario.
* @param array $errores (opcional) Array con los mensajes de error de validación y/o procesamiento del formulario.
*
* @return string HTML asociado al formulario.
* @param array $datos (opcional) Array con los valores por defecto de los campos del formulario.
*/
private function generaFormulario(&$datos = array(), &$errores = array())
{
$htmlCamposFormularios = $this->generaCamposFormulario($datos, $errores);
private function generaFormulario($errores = array(), &$datos = array()) {
$classAtt='';
$html= $this->generaListaErrores($errores);
$html .= '<form method="POST" action="'.$this->action.'" id="'.$this->formId.'"';
if ( $this->classAtt ) {
$classAtt = " class=\"{$this->classAtt}\"";
$html .= ' class="'.$this->classAtt.'"';
}
$enctypeAtt='';
if ( $this->enctype ) {
$enctypeAtt = " enctype=\"{$this->enctype}\"";
$html .= ' enctype="'.$this->enctype.'"';
}
$html .=' >';
// Se genera el token CSRF si el usuario no solicita explícitamente lo contrario.
$tokenCSRF = '';
if ( ! $this->classAtt || strpos($this->classAtt, 'nocsrf') === false ) {
$tokenValue = $this->csrfguard_GenerateToken($this->tipoFormulario);
$tokenCSRF = "<input type='hidden' name='CSRFToken' value='$tokenValue' />";
$tokenValue = $this->csrfguard_GenerateToken($this->formId);
$html .= '<input type="hidden" name="CSRFToken" value="'.$tokenValue.'" />';
}
/* <<< 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}{$classAtt}{$enctypeAtt}' >
<input type='hidden' name='action' value='{$this->tipoFormulario}' />
".$tokenCSRF.$htmlCamposFormularios."
</form>";
return $htmlForm;
$html .= '<input type="hidden" name="action" value="'.$this->formId.'" />';
$html .= $this->generaCamposFormulario($datos);
$html .= '</form>';
return $html;
}
/**
* Genera la lista de mensajes de errores globales (no asociada a un campo) a incluir en el formulario.
*
* @param string[] $errores (opcional) Array con los mensajes de error de validación y/o procesamiento del formulario.
*
* @param string $classAtt (opcional) Valor del atributo class de la lista de errores.
*
* @return string El HTML asociado a los mensajes de error.
*/
protected static function generaListaErroresGlobales($errores = array(), $classAtt='')
{
private function generaListaErrores($errores) {
$html='';
$clavesErroresGenerales = array_filter(array_keys($errores), function ($elem) {
return is_numeric($elem);
});
$numErrores = count($clavesErroresGenerales);
if ($numErrores > 0) {
$html = "<ul class=\"$classAtt\">";
$numErrores = count($errores);
if ( $numErrores == 1 ) {
$html .= "<li>$errores[0]</li>";
} else {
foreach($clavesErroresGenerales as $clave) {
$html .= "<li>$errores[$clave]</li>";
}
$html .= "</li>";
}
$html .= '</ul>';
$html .= "<ul><li>".$errores[0]."</li></ul>";
} else if ( $numErrores > 1 ) {
$html .= "<ul><li>";
$html .= implode("</li><li>", $errores);
$html .= "</li></ul>";
}
return $html;
}
/**
* Crea una etiqueta para mostrar un mensaje de error. Sólo creará el mensaje de error
* si existe una clave <code>$idError</code> dentro del array <code>$errores</code>.
*
* @param string[] $errores (opcional) Array con los mensajes de error de validación y/o procesamiento del formulario.
* @param string $idError (opcional) Clave dentro de <code>$errores</code> del error a mostrar.
* @param string $htmlElement (opcional) Etiqueta HTML a crear para mostrar el error.
* @param array $atts (opcional) Tabla asociativa con los atributos a añadir a la etiqueta que mostrará el error.
*/
protected static function createMensajeError($errores=array(), $idError='', $htmlElement='span', $atts = array())
{
$html = '';
if (isset($errores[$idError])) {
$att = '';
foreach($atts as $key => $value) {
$att .= "$key=$value";
}
$html = " <$htmlElement $att>{$errores[$idError]}</$htmlElement>";
private function csrfguard_GenerateToken($formId) {
if ( ! isset($_SESSION) ) {
throw new Exception('La sesión del usuario no está definida.');
}
return $html;
}
/**
* Método para eliminar los tokens CSRF almecenados en la petición anterior que no hayan sido utilizados en la actual.
*/
public static function limpiaCsrfTokens()
{
foreach(array_keys($_SESSION) as $key) {
if (strpos($key, self::CSRF_PARAM) === 0) {
unset($_SESSION[$key]);
}
}
}
private function csrfguard_GenerateToken($formParameter)
{
if ( ! session_id() ) {
throw new \Exception('La sesión del usuario no está definida.');
}
$paramSession = self::CSRF_PARAM.'_'.$formParameter;
if (isset($_SESSION[$paramSession])) {
$token = $_SESSION[$paramSession];
} else {
if ( function_exists('hash_algos') && in_array('sha512', hash_algos()) ) {
$token = hash('sha512', mt_rand(0, mt_getrandmax()));
} else {
@ -307,37 +181,58 @@ abstract class Form {
}
}
$_SESSION[$paramSession]=$token;
}
$_SESSION[$formId.'_'.self::CSRF_PARAM]=$token;
return $token;
}
private function csrfguard_ValidateToken($formParameter, $tokenRecibido)
{
if ( ! session_id() ) {
throw new \Exception('La sesión del usuario no está definida.');
private function csrfguard_ValidateToken($formId, $tokenRecibido) {
if ( ! isset($_SESSION) ) {
throw new Exception('La sesión del usuario no está definida.');
}
$result = TRUE;
$paramSession = self::CSRF_PARAM.'_'.$formParameter;
if ( isset($_SESSION[$paramSession]) ) {
if ( $_SESSION[$paramSession] !== $tokenRecibido ) {
if ( isset($_SESSION[$formId.'_'.self::CSRF_PARAM]) ) {
if ( $_SESSION[$formId.'_'.self::CSRF_PARAM] !== $tokenRecibido ) {
$result = array();
$result[] = 'Has enviado el formulario dos veces';
}
$_SESSION[$paramSession] = ' ';
unset($_SESSION[$paramSession]);
$_SESSION[$formId.'_'.self::CSRF_PARAM] = ' ';
unset($_SESSION[$formId.'_'.self::CSRF_PARAM]);
} else {
$result = array();
$result[] = 'Formulario no válido';
}
return $result;
}
//Test some form input.
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}
/*
class Formulario {
private $formId;
private $action;
private $classAtt;
private $enctype;
public function __construct($formId, $opciones = array() ) {
$this->formId = $formId;
$opcionesPorDefecto = array( 'ajax' => false, 'action' => null, 'class' => null,
'enctype' => null );
$opciones = array_merge($opcionesPorDefecto, $opciones);
$this->ajax = $opciones['ajax'];
$this->action = $opciones['action'];
$this->classAtt = $opciones['class'];
$this->enctype = $opciones['enctype'];
if (!$this->action) {
$app = Aplicacion::getSingleton();
$this->action = htmlspecialchars($_SERVER['REQUEST_URI']);
$this->action = $app->resuelve($this->action);
}
}
}
*/
?>

View File

@ -1,17 +1,14 @@
<?php
class Template {
//Constants:
//private const _NUMPAGES = 10; //Constant to page results.
//Attributes:
private $page; //Page Name.
private $prefix; //Page prefix.
public $page; //Page Name.
public $prefix; //Page prefix.
private $session; //"Iniciar Sesión" (if user isn´t logged in), "Cerrar Sesión" (otherwise).
private $session_route; //"login/" (if user isn´t logged in), "logout/" (otherwise).
private $panel; //Button to access the user's dashboard (only displayed if logged in).
private $user_route; //Route of the panel (depends on the type of user).
public $session; //"Iniciar Sesión" (if user isn´t logged in), "Cerrar Sesión" (otherwise).
public $session_route; //"login/" (if user isn´t logged in), "logout/" (otherwise).
public $panel; //Button to access the user's dashboard (only displayed if logged in).
public $user_route; //Route of the panel (depends on the type of user).
//Constructor:
function __construct(){
@ -104,7 +101,7 @@
<a href='{$prefix}cinemas/'><li>Nuestros Cines</li></a>
<a href='{$prefix}fdicines/miembros/'><li>Quiénes somos</li></a>
<a href='{$prefix}contacto/'><li>Contacto</li></a>
</ul>
<ul>
</li>
</nav>
</div>
@ -130,7 +127,7 @@
}
//Print generic Main:
function print_main($content = ""){
function print_main(){
$page = $this->page;
$prefix = $this->prefix;
@ -152,330 +149,12 @@
}
/* MAIN */
if($prefix === "./"){
if(isset($_SESSION["nombre"])){
$tittle = "<h1>Bienvenido {$_SESSION["nombre"]}</h1>\n";
} else {
$tittle = "<h1>Bienvenido a CompluCine</h1>\n";
}
} else {
$tittle = "<h1>{$page}</h1>\n";
}
echo"<main>
echo"<div class='main'>
<div class='image'><a href='{$prefix}'><img src='{$prefix}img/logo_trasparente.png' alt='logo_FDI-Cines' /></a></div>
{$sub_header}
{$tittle}{$content}
<h1>{$page}</h1>
<hr />
</main>\n";
}
//Print panel menu:
function print_panelMenu($panel){
if($_SESSION["login"]){
$prefix = $this->prefix;
$menus = array("<a href='./'><li>Panel Principal</li></a>");
switch($panel){
case "admin": array_push($menus, "<li>Ver como...
<ul>
<a href='./?state=un'><li>Usuario</li></a>
<a href='./?state=ur'><li>Usuario registrado</li></a>
<a href='./?state=ag'><li>Gerente</li></a>
</ul>
</li>");
array_push($menus, "<li>Modificar
<ul>
<a href='./?state=mc'><li>Cines</li></a>
<a href='./?state=mf'><li>Películas</li></a>
<a href='./?state=mp'><li>Promociones</li></a>
<a href='./?state=mg'><li>Gerentes</li></a>
</ul>
</li>");
break;
case "manager": array_push($menus, "<li>Ver como...
<ul>
<a href='./?state=view_user'><li>Usuario</li></a>
<a href='./?state=view_ruser'><li>Usuario registrado</li></a>
</ul>
</li>");
array_push($menus, "<li>Modificar
<ul>
<a href='./?state=manage_halls'><li>Salas</li></a>
<a href='./?state=manage_sessions'><li>Sesiones</li></a>
</ul>
</li>");
break;
case "user": array_push($menus, "<a href='./?option=manage_profile'><li>Cuenta de usuario</li></a>");
array_push($menus, "<a href='./?option=purchases'><li>Historial Compras</li></a>");
array_push($menus, "<a href='./?option=payment'><li>Datos Pago</li></a>");
array_push($menus, "<a href='./?option=delete_user'><li>Eliminar Usuario</li></a>");
break;
default: $menus = array(); break;
}
if($_SESSION["rol"] === $panel){
echo"<div class='header sub'>
<div class='menu'>
<nav>";
foreach($menus as $value){
echo $value;
}
echo"</nav>
</div>
</div>
";
}
}
}
//Print specific page content:
function print_section($section){
/* Panel menu */
$sub_header = '';
if(strpos($_SERVER['PHP_SELF'], 'panel')){
echo "<!-- Panel Menu -->
";
$this->print_panelMenu($_SESSION["rol"]);
$this->print_msg();
}
echo $section;
}
//Print Films Cards:
function print_fimls(){
$reply = "";
//List of the movies:
require_once(__DIR__.'/common/film_dao.php');
$prefix= $this->get_prefix();
$films = new Film_DAO("complucine");
$films_array = $films->allFilmData();
$ids = array();
$tittles = array();
$descriptions = array();
$times = array();
$languages = array();
foreach($films_array as $key => $value){
$ids[$key] = $value->getId();
$tittles[$key] = $value->getTittle();
$descriptions[$key] = $value->getDescription();
$times[$key] = $value->getDuration();
$languages[$key] = $value->getLanguage();
}
switch($this->page){
case "Cartelera":
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column side'>
";
}
else{
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column middle'>
";
}
$reply .= "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/films/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<div class='blockquote'>
<p>".$descriptions[$i]."</p>
</div>
<li>Duración: ".$times[$i]." minutos</li>
<li>Lenguaje: ".$languages[$i]."</li>
</div>
</div>
</section>
";
}
$reply .= "</div>\n";
break;
case "Panel de Administrador":
$reply .= "<div class='column'>";
for($i = 0; $i < count($films_array); $i++){
$tittle = str_replace('_', ' ', $tittles[$i]);
if($i%2 === 0){
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column side'>
";
}
else{
if($i != 0) $reply .= "</div>
";
$reply .= "<div class='column middle'>
";
}
$reply .= "<section id='".$tittles[$i]."'>
<div class='zoom'>
<div class='code showtimes'>
<div class='image'><img src='".$prefix."img/films/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div>
<h2>".$tittle."</h2>
<hr />
<form method='post' action='./index.php?state=mf'>
<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 type='submit' id='submit' value='Editar' name='edit_film' class='primary' />
</form>
<form method='post' action='./index.php?state=mf'>
<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 type='submit' id='submit' value='Eliminar' name='delete_film' class='primary' />
</form>
</div>
</div>
</section>
";
}
$reply .= "</div>\n";
break;
case "Panel de Gerente":
break;
default:
$reply .='<div class="column left">
<div class="galery">
<h1>Últimos Estrenos</h1><hr />';
$count = 0;
for($i = count($tittles)-4; $i < count($tittles); $i++){
if($count%2===0){
if($count != 0) $reply .= "
</div>";
$reply .= "
<div class='fila'>";
}
$reply .= "
<div class='zoom'>
<div class='columna'>
<a href='".$prefix."showtimes/#".$tittles[$i]."'><div class='image'><img src='img/films/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div></a>
</div>
</div>";
$count++;
}
$reply .= "
</div>
</div>
</div>
<div class='column right'>
<div class='galery'>";
$count = rand(0, count($tittles)-1);
$title = str_replace('_', ' ', $tittles[$count]);
$reply .= "
<h1>{$title}</h1><hr />
<div class='zoom'>
<a href='".$prefix."showtimes/#".$tittles[$count]."'><div class='image main'><img src='img/films/".$tittles[$count].".jpg' alt='".$tittles[$count]."' /></div></a>
</div>
</div>
</div>\n";
break;
}
return $reply;
}
//Print Cinemas info:
function print_cinemas(){
$reply = "";
//List of the cinemas:
require_once(__DIR__.'/common/cinema_dao.php');
$cine = new Cinema_DAO("complucine");
$cinemas = $cine->allCinemaData();
$ids = array();
$names = array();
$directions = array();
$phones = array();
if(is_array($cinemas)){
foreach($cinemas as $key => $value){
$ids[$key] = $value->getId();
$names[$key] = $value->getName();
$directions[$key] = $value->getDirection();
$phones[$key] = $value->getPhone();
}
}
switch($this->page){
case "Panel de Administrador":
$reply .= "<div class='row'>
<div class='column side'></div>
<div class='column middle'>
<table class='alt'>
<thead>
<tr>
<th>Id</th>
<th>Nombre</th>
<th>Direccion</th>
<th>Telefono</th>
</tr>
</thead>
<tbody>
";
if(is_array($cinemas)){
for($i = 0; $i < count($cinemas); $i++){
$reply .= '<tr>
<td>'. $ids[$i] .'</td>
<td>'. $names[$i] .'</td>
<td>'. $directions[$i] .'</td>
<td>'. $phones[$i] .'</td>
<td>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Editar" name="edit_cinema" class="primary" />
</form>
</td>
<td>
<form method="post" action="index.php?state=mc">
<input name="id" type="hidden" value="'.$ids[$i].'">
<input name="name" type="hidden" value="'.$names[$i].'">
<input name="direction" type="hidden" value="'.$directions[$i].'">
<input name="phone" type="hidden" value="'.$phones[$i].'">
<input type="submit" id="submit" value="Eliminar" name="delete_cinema" class="primary" />
</form>
</td>
</tr>
';
}
}
$reply .='</tbody>
</table>
</div>
<div class="column side"></div>
';
break;
default:
break;
}
return $reply;
}
//Print session MSG:
@ -488,28 +167,18 @@
//Print generic Footer:
function print_footer(){
//$page = $this->page;
$prefix = $this->prefix;
/* TODO */
$css = "{$prefix}assets/css/highContrast.css";
$nameCSS = "Alto Contraste";
//$css = "{$prefix}assets/css/main.css";
//$nameCSS = "Contraste Normal";
echo"<footer>
<div class='footer'>
<p>© Práctica 3 | Sistemas Web 2021 </p>
<p>© Práctica 2 | Sistemas Web 2021 </p>
</div>
<a href='{$prefix}fdicines/about_us/'>Sobre FDI-Cines</a> |
<a href='{$prefix}fdicines/terms_conditions/'>Términos de uso</a> |
<a href='{$prefix}fdicines/terms_conditions/'>Términos y condiciones</a> |
<a href='{$prefix}cinemas/'>Nuestros cines</a> |
<a href='{$prefix}contacto/'>Contacto</a> |
<button onclick=\"cambiarCSS('$css');\">$nameCSS</button>
<a href='{$prefix}contacto/'>Contacto</a>
</footer>\n";
echo"
<!-- Scripts -->
<script src='{$prefix}assets/js/cambiarCSS.js'></script>\n";
}
}

83
assets/php/user_dao.php Normal file
View File

@ -0,0 +1,83 @@
<?php
require_once('dao.php');
include_once('user_dto.php');
class UserDAO extends DAO {
//Constants:
private const _USER = "user";
private const _MANAGER = "manager";
private const _ADMIN = "admin";
//Attributes:
//Constructor:
function __construct($bd_name){
parent::__construct($bd_name);
}
//Methods:
//Encrypt password with SHA254.
private function encryptPass($password){
//$password = hash('sha256', $password);
$password = password_hash($password, PASSWORD_DEFAULT);
return $password;
}
//Returns true if the password and hash match, or false otherwise.
public function verifyPass($password, $passwd){
return password_verify($password, $passwd);
}
//Create a new User.
public function createUser($id, $username, $email, $password, $rol){
$password = $this->encryptPass($password);
$sql = sprintf( "INSERT INTO users( id, username, email, passwd, rol)
VALUES ( '%s', '%s', '%s', '%s', '%s')",
$id, $username, $email, $password, $rol );
return $sql;
}
//Returns a query to check if the user name exists.
public function selectUser($username){
$username = $this->mysqli->real_escape_string($username);
$sql = sprintf( "SELECT * FROM users WHERE username = '%s'", $username );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Returns a query to check if the user pass matches.
public function selectPass($username, $password){
$username = $this->mysqli->real_escape_string($username);
$password = $this->mysqli->real_escape_string($password);
$password = $this->encryptPass($password);
$sql = sprintf( "SELECT * FROM users WHERE username = '%s' AND passwd = '%s'", $username, $password);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
//return $this->mysqli->query($sql);
return $resul;
}
//Returns a query to get the user's data.
public function userData($id){
$sql = sprintf( "SELECT * FROM users WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Create a new User Data Transfer Object.
public function loadUser($id, $username, $email, $password, $rol){
return new UserDTO($id, $username, $email, $password, $rol);
}
}
?>

37
assets/php/user_dto.php Normal file
View File

@ -0,0 +1,37 @@
<?php
include_once('users_dto_interface.php');
class UserDTO implements UsersDTO {
//Attributes:
private $_id; //User Id.
private $_username; //User name.
private $_email; //User email.
private $_password; //User password.
private $_rol; //Type of user: user | manager | admin.
//Constructor:
function __construct($id, $username, $email, $password, $rol){
$this->_id = $id;
$this->_username = $username;
$this->_email = $email;
$this->_password = $password;
$this->_rol = $rol;
}
//Methods:
//Getters && Setters:
public function setId($id){ $this->_id = $id; }
public function getId(){ return $this->_id; }
public function setName($username){ $this->_username = $username; }
public function getName(){ return $this->_username; }
public function setEmail($email){ $this->_email = $email; }
public function getEmail(){ return $this->_email; }
public function setPass($passwd){ $this->_password = $passwd; }
public function getPass(){ return $this->_password; }
public function setRol($rol){ $this->_rol = $rol; }
public function getRol(){ return $this->_rol; }
}
?>

View File

@ -0,0 +1,14 @@
<?php
interface UsersDTO {
public function setId($id);
public function getId();
public function setName($username);
public function getName();
public function setEmail($email);
public function getEmail();
public function setPass($passwd);
public function getPass();
public function setRol($rol);
public function getRol();
}
?>

View File

@ -1,10 +1,32 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../assets/php/config.php');
//Specific page content:
$section = '';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<?php
$template->print_main();
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -1,88 +0,0 @@
<?php
require_once($prefix.'assets/php/form.php');
class FormContact extends Form {
//Constants:
const HTML5_EMAIL_REGEXP = '^[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$';
public function __construct() {
$options = array("action" => "");
parent::__construct('formContact', $options);
}
protected function generaCamposFormulario($datos, $errores = array()) {
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorNombre = self::createMensajeError($errores, 'name', 'span', array('class' => 'error'));
$errorEmail = self::createMensajeError($errores, 'email', 'span', array('class' => 'error'));
$errorMessage = self::createMensajeError($errores, 'message', 'span', array('class' => 'error'));
// Se genera el HTML asociado a los campos del formulario y los mensajes de error.
$html = "<div class='row'>
<fieldset id='datos_personales'>
<legend>Datos personales</legend><pre>".$htmlErroresGlobales."</pre>
<div class='_name'>
<input type='text' name='name' id='name' value='' placeholder='Nombre' required/><pre>".$errorNombre."</pre>
</div>
<div class='_email'>
<input type='email' name='email' id='email' value='' placeholder='Email' required/><pre>".$errorEmail."</pre>
</div>
</fieldset>
<fieldset id='motivo'>
<legend>Motivo de la consulta</legend>
<div class='reason'>
<input type='radio' id='radio' name='reason' value='evaluation' checked>
<label for='evaluation'>Evaluación</label>
</div>
<div class='reason'>
<input type='radio' id='radio' name='reason' value='sugestions'>
<label for='sugestions'>Sugerencias</label>
</div>
<div class='reason'>
<input type='radio' id='radio' name='reason' value='critics'>
<label for='critics'>Críticas</label>
</div>
</fieldset>
<div class='message'><pre>".$errorMessage."</pre>
<textarea name='message' id='message' placeholder='Escribe aquí tu mensaje...'></textarea>
</div>
<div class='verify'>
<input type='checkbox' id='checkbox' name='terms' required>
<label for='terms'>Marque esta casilla para verificar que ha leído nuestros términos y condiciones del servicio.</label>
</div>
<div class='actions'>
<input type='submit' id='submit' value='Enviar mensaje' class='primary' />
<input type='reset' id='reset' value='Borrar' />
</div>
</div>";
return $html;
}
protected function procesaFormulario($datos) {
$result = array();
$nombre = $this->test_input($datos['name']) ?? null;
if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 8 ) {
$result['name'] = "El nombre tiene que tener\n una longitud de más de\n 3 caracteres\n y menos de 8 caracteres.";
}
$email = $this->test_input($datos['email']) ?? null;
if ( empty($email) || !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $email) ) {
$result['email'] = "El email no es válido.";
}
$message = $this->test_input($datos['message']) ?? null;
if ( empty($message) || mb_strlen($message) < 1 || mb_strlen($message) > 250 ) {
$result['message'] = "El mensaje no puede estar vacío\ny no puede contener más de\n250 caracteres.";
}
if (count($result) === 0) {
$result = ROUTE_APP;
}
return $result;
}
}

View File

@ -1,20 +1,77 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../assets/php/config.php');
//Contact form:
require_once('includes/formContact.php');
$form = new FormContact();
$htmlForm = $form->gestiona();
//Specific page content:
$section = '<!-- Contact Form -->
<section id="formulario">
<h4>Formulario (EN DESARROLLO)</h4>
'.$htmlForm.'
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<?php
$template->print_main();
?>
<!-- Form -->
<section id="formulario">
<h4>Formulario</h4>
<form method="post" action="mailto:fernmend@ucm.es">
<div class="row">
<fieldset id="datos_personales">
<legend>Datos personales</legend>
<div class="_name">
<input type="text" name="name" id="name" value="" placeholder="Nombre" required/>
</div>
<div class="_email">
<input type="email" name="email" id="email" value="" placeholder="Email" required/>
</div>
</fieldset>
<fieldset id="motivo">
<legend>Motivo de la consulta</legend>
<div class="reason">
<input type="radio" id="radio" name="reason" value="evaluation" checked>
<label for="evaluation">Evaluación</label>
</div>
<div class="reason">
<input type="radio" id="radio" name="reason" value="sugestions">
<label for="sugestions">Sugerencias</label>
</div>
<div class="reason">
<input type="radio" id="radio" name="reason" value="critics">
<label for="critics">Críticas</label>
</div>
</fieldset>
<div class="message">
<textarea name="message" id="message" placeholder="Escribe aquí tu mensaje..."></textarea> <!-- rows="5" -->
</div>
<div class="verify">
<input type="checkbox" id="checkbox" name="terms" required>
<label for="terms">Marque esta casilla para verificar que ha leído nuestros términos y condiciones del servicio.</label>
</div>
<div class="actions">
<input type="submit" id="submit" value="Enviar mensaje" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</section>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -1,9 +1,33 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../../assets/php/config.php');
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
//Specific page content:
$section = '<!-- Description -->
<!-- Main -->
<div class="main">
<div class="image"><a href='../../'><img src="../../img/logo_trasparente.png" alt="logo_FDI-Cines" /></a></div>
<!-- Sub Header -->
<?php
$template->print_subheader();
?>
</div>
<!-- Description -->
<section id="description">
<div class="code" id="resume">
<h1>Descripción</h1>
@ -30,18 +54,22 @@
<hr />
<div class="blockquote">
<p>
Somos un <a href="../miembros/">grupo de estudiantes</a> de la asignatura de Sistemas Web
Somos un <a href="../../miembros/">grupo de estudiantes</a> de la asignatura de Sistemas Web
de la Facultad de Informática de la Universidad Complutense de Madrid.
</p>
<p>
CompluCine es un proyecto web universitario y en ningún momento pretende ofrecer una funcionalidad real.
Para más información acerca del proyecto, haz click <a href="../detalles/">aquí</a>.
Para más información acerca del proyecto, haz click <a href="../../detalles/">aquí</a>.
</p>
</div>
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -1,9 +1,29 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../../assets/php/config.php');
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
//Specific page content:
$section = '<!-- Flow -->
<!-- Main -->
<?php
$template->print_main();
?>
<!-- Flow -->
<section id="flow">
<div class="code">
<h2>FLUJO DE NAVEGACIÓN</h2>
@ -69,7 +89,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/bocetos/inicio.png" />
<img src="../../img/inicio.png" />
<div class="description">
<h3>Pantalla de inicio</h3>
<p>Pantalla de bienvenida al entrar en la web.</p>
@ -78,7 +98,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/bocetos/registrarse_iniciar_sesion.png" />
<img src="../../img/registrarse_iniciar_sesion.png" />
<div class="description">
<h3>Pantalla de Registro / Inicio de sesión</h3>
<p>Pantalla para que un usuario nuevo se registre o, en caso de ya tener una cuenta de usuario, inicie sesión.</p>
@ -89,7 +109,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/bocetos/menu_usuario.png" />
<img src="../../img/menu_usuario.png" />
<div class="description">
<h3>Menú de usuario registrado</h3>
<p>Pantalla con todas las opciones disponibles, propias de un usuario registrado.</p>
@ -98,7 +118,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/bocetos/peliculas.png" />
<img src="../../img/peliculas.png" />
<div class="description">
<h3>Cartelera</h3>
<p>Pantalla con información sobre todas las películas disponibles en ese momento.</p>
@ -109,7 +129,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/bocetos/cine.png" />
<img src="../../img/cine.png" />
<div class="description">
<h3>Cines</h3>
<p>Pantalla con un mapa que indica la geolocalización de todos los cines de FDI-Cines.</p>
@ -118,7 +138,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/bocetos/selector_horario.png" />
<img src="../../img/selector_horario.png" />
<div class="description">
<h3>Selección de Horario</h3>
<p>Pantalla que muestra los horarios disponibles por salas para un cine y película elegidos.</p>
@ -129,7 +149,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/bocetos/mapa_asientos.png" />
<img src="../../img/mapa_asientos.png" />
<div class="description">
<h3>Mapa de los Asientos</h3>
<p>Pantalla con un mapa para selccionar los asientos que se quieren escoger. Los asientos ocupados no pondrán ser seleccionados.</p>
@ -138,7 +158,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/bocetos/pagar.png" />
<img src="../../img/pagar.png" />
<div class="description">
<h3>Pagar</h3>
<p>Pantalla para realizar el pago, después de haber selecionado película, cine, sala, horario y butacas.</p>
@ -149,7 +169,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/bocetos/compra_realizada.png" />
<img src="../../img/compra_realizada.png" />
<div class="description">
<h3>Compra Realizada</h3>
<p>Pantalla de confirmación con los datos de compra.</p>
@ -158,7 +178,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/bocetos/about_us.png" />
<img src="../../img/about_us.png" />
<div class="description">
<h3>Sobre nosotros</h3>
<p>Pantalla con información sobre FDI-Cines.</p>
@ -169,7 +189,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/bocetos/contacto.png" />
<img src="../../img/contacto.png" />
<div class="description">
<h3>Formulario de Contacto</h3>
<p>Pantalla con un formulario para realizar una consulta a los administradores.</p>
@ -178,7 +198,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/bocetos/terminos_y_condiciones.png" />
<img src="../../img/terminos_y_condiciones.png" />
<div class="description">
<h3>Términos y Condiciones</h3>
<p>Pantalla con todos los términos y condiciones de uso del servicio.</p>
@ -194,7 +214,7 @@
<div class="row">
<div class="column side">
<div class="sketches">
<img src="../../img/bocetos/panel_inicio_gerente.png" />
<img src="../../img/panel_inicio_gerente.png" />
<div class="description">
<h3>Panel de Incio Gerente</h3>
<p>Pantalla con las funciones exclusivas a las que puede acceder un Gerente.</p>
@ -203,7 +223,7 @@
</div>
<div class="column middle">
<div class="sketches">
<img src="../../img/bocetos/gestionar_salas.png" />
<img src="../../img/gestionar_salas.png" />
<div class="description">
<h3>Gestionar salas</h3>
<p>Pantalla en la que los Gerentes pueden interactuar para añadir, modificar o eliminar la sala de un cine.</p>
@ -212,7 +232,7 @@
</div>
<div class="column side">
<div class="sketches">
<img src="../../img/bocetos/gestionar_sesiones.png" />
<img src="../../img/gestionar_sesiones.png" />
<div class="description">
<h3>Gestionar Sesiones</h3>
<p>Pantalla en la que los Gerentes pueden interactuar para añadir, modificar o eliminar las sesiones de una película.</p>
@ -228,7 +248,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/bocetos/panel_inicio_admin.png" />
<img src="../../img/panel_inicio_admin.png" />
<div class="description">
<h3>Panel Inicio Administrador</h3>
<p>Pantalla con las funciones exclusivas a las que puede acceder un Administrador.</p>
@ -237,7 +257,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/bocetos/gestionar_peliculas.png" />
<img src="../../img/gestionar_peliculas.png" />
<div class="description">
<h3>Gestionar Películas</h3>
<p>Pantalla en la que los Administradores pueden interactuar para añadir, modificar o eliminar las películas de la cartelera.</p>
@ -248,7 +268,7 @@
<div class="row">
<div class="column side">
<div class="sketches">
<img src="../../img/bocetos/gestionar_cines.png" />
<img src="../../img/gestionar_cines.png" />
<div class="description">
<h3>Gestionar Cines</h3>
<p>Pantalla en la que los Administradores pueden interactuar para añadir, modificar o eliminar los cines.</p>
@ -257,7 +277,7 @@
</div>
<div class="column middle">
<div class="sketches">
<img src="../../img/bocetos/gestionar_promociones.png" />
<img src="../../img/gestionar_promociones.png" />
<div class="description">
<h3>Gestionar Promociones</h3>
<p>Pantalla en la que los Administradores pueden interactuar para añadir, modificar o eliminar las promociones existentes.</p>
@ -266,7 +286,7 @@
</div>
<div class="column side">
<div class="sketches">
<img src="../../img/bocetos/gestionar_admins_gerentes.png" />
<img src="../../img/gestionar_admins_gerentes.png" />
<div class="description">
<h3>Gestionar Administradores y Gerentes</h3>
<p>Pantalla en la que los Administradores pueden interactuar para añadir, modificar o eliminar tanto otros Administradores como Gerentes.</p>
@ -275,8 +295,12 @@
</div>
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -1,9 +1,33 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../../assets/php/config.php');
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
//Specific page content:
$section = '<!-- Details -->
<!-- Main -->
<div class="main">
<div class="image"><a href='../../'><img src="../../img/logo_trasparente.png" alt="logo_FDI-Cines" /></a></div>
<!-- Sub Header -->
<?php
$template->print_subheader();
?>
</div>
<!-- Details -->
<section id="details">
<div class = "code">
<h1>Detalles</h1>
@ -87,8 +111,10 @@
</div>
</div>
</section>
';
<!-- Footer -->
<?php
$template->print_footer();
?>
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

@ -1,9 +1,33 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../../assets/php/config.php');
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
$content = '<hr />
<!-- Main -->
<div class="main">
<div class="image"><img src="../../img/logo_trasparente.png" /></div>
<!-- Sub Header -->
<?php
$template->print_subheader();
?>
<section id="members_table">
<h1>Miembros</h1>
<hr />
<table>
<thead>
<tr>
@ -38,10 +62,10 @@
</tr>
</tbody>
</table>
</section>';
</section>
</div>
//Specific page content:
$section = '<!-- Members -->
<!-- Members -->
<section id="members">
<div class="row">
<div class="column side">
@ -49,7 +73,7 @@
<section id="MEP">
<div class="zoom">
<div class="code">
<img src="../../img/us/mep.jpg" />
<img src="../../img/mep.jpg" />
<p>~ Marco Expósito Pérez (marcoexp@ucm.es)</p>
<div class="blockquote bio">
<p>Aficionado a todo tipo de videojuegos, principalmente la saga Zelda. Tambien me gusta leer tanto literatura fantastica como mangas y veo anime asiduamente.</p>
@ -64,7 +88,7 @@
<section id="FMT">
<div class="zoom">
<div class="code">
<img src="../../img/us/fmt.jpg" />
<img src="../../img/fmt.jpg" />
<p>~ Fernando Méndez (fernmend@ucm.es)</p>
<div class="blockquote bio">
<p>Estudiante de Ingeniería de Computadores en la Universidad Complutense de Madrid.</p>
@ -79,7 +103,7 @@
<section id="DMG">
<div class="zoom">
<div class="code">
<img src="../../img/us/dmg.jpg" />
<img src="../../img/dmg.jpg" />
<p>~ Daniel Muñoz García (danimu03@ucm.es)</p>
<div class="blockquote bio">
<p>Estudiante del grado en ingeniería informática en la Universidad Complutense de Madrid. Aficionado a la ciberseguridad y las nuevas tecnologías.</p>
@ -96,7 +120,7 @@
<section id="IMT">
<div class="zoom">
<div class="code">
<img src="../../img/us/imt.jpg" />
<img src="../../img/imt.jpg" />
<p>~ Ioan Marian Tulai (ioantula@ucm.es)</p>
<div class="blockquote bio">
<p>Estudiante con mucha ilusion y ganas de trabajar especialista en hardware.</p>
@ -111,7 +135,7 @@
<section id="ORP">
<div class="zoom">
<div class="code">
<img src="../../img/us/orp.jpg" />
<img src="../../img/orp.jpg" />
<p>~ Óscar Ruiz de Pedro (oscarrui@ucm.es)</p>
<div class="blockquote bio">
<p>Estudiante de ingeniería de computadores en la Universidad Complutense de Madrid.</p>
@ -127,7 +151,7 @@
<section id="ARN">
<div class="zoom">
<div class="code">
<img src="../../img/us/arn.jpg" />
<img src="../../img/arn.jpg" />
<p>~ Adrian Real del Noval (adrireal@ucm.es)</p>
<div class="blockquote bio">
<p>Estudiante de 3er año de Ingeniería de Computadores en la Universidad Complutense de Madrid.</p>
@ -138,8 +162,16 @@
</section>
</div>
</div>
</section>';
</section>
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>
</html>

View File

@ -1,9 +1,29 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../../assets/php/config.php');
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
//Specific page content:
$section = '<!-- Planning -->
<!-- Main -->
<?php
$template->print_main();
?>
<!-- Planning -->
<section class="planning">
<div class="row">
<div class="column side">
@ -241,12 +261,12 @@
<tr>
<td>Práctica 2</td>
<td>15 de Abril de 2021</td>
<td>ENTREGADO</td>
<td>EN PROCESO</td>
</tr>
<tr>
<td>Práctica 3</td>
<td>14 de Mayo de 2021</td>
<td>EN PROCESO</td>
<td>7 de Mayo de 2021</td>
<td>PENDIENTE</td>
</tr>
<tr>
<td>Entrega Final</td>
@ -264,9 +284,12 @@
en función de los requisitos de las prácticas y nuestra carga de trabajo.
</p>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!DOCTYPE HTML>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

@ -1,9 +1,32 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('../../assets/php/config.php');
session_start();
//Specific page content:
$section = '<!-- Section -->
//HTML template:
require_once('../../assets/php/template.php');
$template = new Template();
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<?php
$template->print_main();
?>
<!-- Section -->
<section id="terms_and_conditions">
<div class="code">
<p>
@ -186,8 +209,12 @@
</ol>
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 152 KiB

After

Width:  |  Height:  |  Size: 152 KiB

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

View File

Before

Width:  |  Height:  |  Size: 151 KiB

After

Width:  |  Height:  |  Size: 151 KiB

View File

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

View File

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

View File

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

Before

Width:  |  Height:  |  Size: 98 KiB

After

Width:  |  Height:  |  Size: 98 KiB

View File

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 36 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 41 KiB

View File

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 16 KiB

View File

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 70 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 46 KiB

View File

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 50 KiB

View File

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 67 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

Before

Width:  |  Height:  |  Size: 120 KiB

After

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

BIN
img/mapa_asientos.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

View File

Before

Width:  |  Height:  |  Size: 97 KiB

After

Width:  |  Height:  |  Size: 97 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 66 KiB

View File

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 34 KiB

View File

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 47 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 505 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 419 B

View File

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 38 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

View File

@ -1,18 +1,95 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once(__DIR__.'/assets/php/config.php');
require_once('./assets/php/config.php');
//Page-specific content:
$section = '<!-- Undercard -->
//List of the tittles of the movies:
require_once($prefix.'panel_admin/includes/film_dao.php');
$films = new Film_DAO("complucine");
$films_array = $films->allFilmData();
$tittles = array();
foreach($films_array as $key => $value){
$tittles[$key] = $value->getTittle();
}
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<div class="main">
<div class="image"><a href='./'><img src="./img/logo_trasparente.png" alt="logo_FDI-Cines" /></a></div>
<?php
if(isset($_SESSION["nombre"])){
echo "<h1>Bienvenido {$_SESSION["nombre"]}</h1>\n";
}
else{
echo "<h1>Bienvenido a CompluCine</h1>\n";
}
?>
<hr />
</div>
<!-- Undercard -->
<section id="cartelera">
<div class="row">
<div class="code">
'.$template->print_fimls().'
<div class="column left">
<div class="galery">
<h1>Últimos Estrenos</h1><hr />
<?php
$count = 0;
for($i = count($tittles)-4; $i < count($tittles); $i++){
if($count%2===0){
if($count != 0) echo "</div>
";
echo "<div class='fila'>
";
}
echo "<div class='zoom'>
<div class='columna'>
<a href='".$prefix."showtimes/#".$tittles[$i]."'><div class='image'><img src='img/".$tittles[$i].".jpg' alt='".$tittles[$i]."' /></div></a>
</div>
</div>
";
$count++;
}
echo "</div>\n";
?>
</div>
</div>
<div class="column right">
<div class="galery">
<?php
$count = rand(0, count($tittles)-1);
$title = str_replace('_', ' ', $tittles[$count]);
echo "<h1>{$title}</h1><hr />
<div class='zoom'>
<a href='".$prefix."showtimes/#".$tittles[$count]."'><div class='image main'><img src='img/".$tittles[$count].".jpg' alt='".$tittles[$count]."' /></div></a>
</div>\n";
?>
</div>
</div>
</div>
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

238
login/includes/form.php Normal file
View File

@ -0,0 +1,238 @@
<?php
class Form {
/**
* Sufijo para el nombre del parámetro de la sesión del usuario donde se almacena el token CSRF.
*/
const CSRF_PARAM = 'csrf';
/**
* Cadena utilizada como valor del atributo "id" de la etiqueta &lt;form&gt; asociada al formulario y como parámetro a comprobar para verificar que el usuario ha enviado el formulario.
*/
private $formId;
private $ajax;
/**
* URL asociada al atributo "action" de la etiqueta &lt;form&gt; del fomrulario y que procesará el envío del formulario.
*/
private $action;
/**
* Valor del atributo "class" de la etiqueta &lt;form&gt; asociada al formulario. Si este parámetro incluye la cadena "nocsrf" no se generá el token CSRF para este formulario.
*/
private $classAtt;
/**
* Valor del parámetro enctype del formulario.
*/
private $enctype;
/**
* Se encarga de orquestar todo el proceso de creación y procesamiento de un formulario web.
*
* @param string $formId Cadena utilizada como valor del atributo "id" de la etiqueta &lt;form&gt; asociada al formulario y como parámetro a comprobar para verificar que el usuario ha enviado el formulario.
*
* @param string $action (opcional) URL asociada al atributo "action" de la etiqueta &lt;form&gt; del fomrulario y que procesará el envío del formulario. Por defecto la URL es $_SERVER['PHP_SELF']
*
* @param string $class (opcional) Valor del atributo "class" de la etiqueta &lt;form&gt; asociada al formulario. Si este parámetro incluye la cadena "nocsrf" no se generá el token CSRF para este formulario.
*
* @param string enctype (opcional) Valor del parámetro enctype del formulario.
*/
public function __construct($formId, $opciones = array() ) {
$this->formId = $formId;
$opcionesPorDefecto = array( 'ajax' => false, 'action' => null, 'class' => null, 'enctype' => null );
$opciones = array_merge($opcionesPorDefecto, $opciones);
$this->ajax = $opciones['ajax'];
$this->action = $opciones['action'];
$this->classAtt = $opciones['class'];
$this->enctype = $opciones['enctype'];
if ( !$this->action ) {
$this->action = $_SERVER['PHP_SELF'];
}
}
public function gestiona() {
if ( ! $this->formularioEnviado($_POST) ) {
echo $this->generaFormulario();
} else {
// Valida el token CSRF si es necesario (hay un token en la sesión asociada al formulario)
$tokenRecibido = isset($_POST['CSRFToken']) ? $_POST['CSRFToken'] : FALSE;
if ( ($errores = $this->csrfguard_ValidateToken($this->formId, $tokenRecibido)) !== TRUE ) {
if ( ! $this->ajax ) {
echo $this->generaFormulario($errores, $_POST);
} else {
echo $this->generaHtmlErrores($errores);
}
} else {
$result = $this->procesaFormulario($_POST);
if ( is_array($result) ) {
// Error al procesar el formulario, volvemos a mostrarlo
if ( ! $this->ajax ) {
echo $this->generaFormulario($result, $_POST);
} else {
echo $this->generaHtmlErrores($result);
}
} else {
if ( ! $this->ajax ) {
header('Location: '.$result);
} else {
echo $result;
}
}
}
}
}
/**
* Devuelve un <code>string</code> con el HTML necesario para presentar los campos del formulario. Es necesario asegurarse que como parte del envío se envía un parámetro con nombre <code$formId</code> (i.e. utilizado como valor del atributo name del botón de envío del formulario).
*/
protected function generaCamposFormulario ($datos) {
return '';
}
/**
* Procesa los datos del formulario.
*/
protected function procesaFormulario($datos) {
}
/**
* Función que verifica si el usuario ha enviado el formulario. Comprueba si existe el parámetro <code>$formId</code> en <code>$params</code>.
*
* @param array $params Array que contiene los datos recibidos en el envío formulario.
*
* @return boolean Devuelve <code>TRUE</code> si <code>$formId</code> existe como clave en <code>$params</code>
*/
private function formularioEnviado(&$params) {
return isset($params['action']) && $params['action'] == $this->formId;
}
/**
* Función que genera el HTML necesario para el formulario.
*
*
* @param array $errores (opcional) Array con los mensajes de error de validación y/o procesamiento del formulario.
*
* @param array $datos (opcional) Array con los valores por defecto de los campos del formulario.
*/
private function generaFormulario($errores = array(), &$datos = array()) {
$html= $this->generaListaErrores($errores);
$html .= '<form method="POST" action="'.$this->action.'" id="'.$this->formId.'"';
if ( $this->classAtt ) {
$html .= ' class="'.$this->classAtt.'"';
}
if ( $this->enctype ) {
$html .= ' enctype="'.$this->enctype.'"';
}
$html .=' >';
// Se genera el token CSRF si el usuario no solicita explícitamente lo contrario.
if ( ! $this->classAtt || strpos($this->classAtt, 'nocsrf') === false ) {
$tokenValue = $this->csrfguard_GenerateToken($this->formId);
$html .= '<input type="hidden" name="CSRFToken" value="'.$tokenValue.'" />';
}
$html .= '<input type="hidden" name="action" value="'.$this->formId.'" />';
$html .= $this->generaCamposFormulario($datos);
$html .= '</form>';
return $html;
}
private function generaListaErrores($errores) {
$html='';
$numErrores = count($errores);
if ( $numErrores == 1 ) {
$html .= "<ul><li>".$errores[0]."</li></ul>";
} else if ( $numErrores > 1 ) {
$html .= "<ul><li>";
$html .= implode("</li><li>", $errores);
$html .= "</li></ul>";
}
return $html;
}
private function csrfguard_GenerateToken($formId) {
if ( ! isset($_SESSION) ) {
throw new Exception('La sesión del usuario no está definida.');
}
if ( function_exists('hash_algos') && in_array('sha512', hash_algos()) ) {
$token = hash('sha512', mt_rand(0, mt_getrandmax()));
} else {
$token=' ';
for ($i=0;$i<128;++$i) {
$r=mt_rand(0,35);
if ($r<26){
$c=chr(ord('a')+$r);
} else{
$c=chr(ord('0')+$r-26);
}
$token.=$c;
}
}
$_SESSION[$formId.'_'.self::CSRF_PARAM]=$token;
return $token;
}
private function csrfguard_ValidateToken($formId, $tokenRecibido) {
if ( ! isset($_SESSION) ) {
throw new Exception('La sesión del usuario no está definida.');
}
$result = TRUE;
if ( isset($_SESSION[$formId.'_'.self::CSRF_PARAM]) ) {
if ( $_SESSION[$formId.'_'.self::CSRF_PARAM] !== $tokenRecibido ) {
$result = array();
$result[] = 'Has enviado el formulario dos veces';
}
$_SESSION[$formId.'_'.self::CSRF_PARAM] = ' ';
unset($_SESSION[$formId.'_'.self::CSRF_PARAM]);
} else {
$result = array();
$result[] = 'Formulario no válido';
}
return $result;
}
}
/*
class Formulario {
private $formId;
private $action;
private $classAtt;
private $enctype;
public function __construct($formId, $opciones = array() ) {
$this->formId = $formId;
$opcionesPorDefecto = array( 'ajax' => false, 'action' => null, 'class' => null,
'enctype' => null );
$opciones = array_merge($opcionesPorDefecto, $opciones);
$this->ajax = $opciones['ajax'];
$this->action = $opciones['action'];
$this->classAtt = $opciones['class'];
$this->enctype = $opciones['enctype'];
if (!$this->action) {
$app = Aplicacion::getSingleton();
$this->action = htmlspecialchars($_SERVER['REQUEST_URI']);
$this->action = $app->resuelve($this->action);
}
}
}
*/
?>

View File

@ -1,6 +1,6 @@
<?php
include_once($prefix.'assets/php/common/user_dao.php');
include_once('user_dao.php');
include_once($prefix.'assets/php/form.php');
class FormLogin extends Form {
@ -9,92 +9,86 @@ class FormLogin extends Form {
//Atributes:
private $user; // User who is going to log-in.
private $reply; // Validation response
//Constructor:
public function __construct() {
parent::__construct('formLogin');
$this->reply = array();
}
protected function generaCamposFormulario($datos, $errores = array()){
$nombre = $datos['name'] ?? '';
// Se generan los mensajes de error si existen.
$htmlErroresGlobales = self::generaListaErroresGlobales($errores);
$errorNombre = self::createMensajeError($errores, 'name', 'span', array('class' => 'error'));
$errorPassword = self::createMensajeError($errores, 'pass', 'span', array('class' => 'error'));
$html = "<div class='row'>
<fieldset id='nombre_usuario'><pre>".$htmlErroresGlobales."</pre>
<legend>Datos Personales</legend>
<input type='text' name='name' id='name' value='' placeholder='Nombre' required/><pre>".$errorNombre."</pre>
<input type='password' name='pass' id='pass' value='' placeholder='Contraseña' required/><pre>".$errorPassword."</pre>
</fieldset>
<div class='actions'>
<input type='submit' id='submit' value='Iniciar Sesión' class='primary' />
<input type='reset' id='reset' value='Borrar' />
</div>
</div>";
return $html;
}
protected function procesaFormulario($datos){
$result = array();
//$nombre = $this->test_input($datos['name']) ?? null;
$nombre = $datos['name'] ?? null;
$nombre = strtolower($nombre);
if ( empty($nombre) || mb_strlen($nombre) < 3 || mb_strlen($nombre) > 8 ) {
$result['name'] = "El nombre tiene que tener\n una longitud de al menos\n 3 caracteres\n y menos de 8 caracteres.";
}
//$password = $this->test_input($datos['pass']) ?? null;
$password = $datos['pass'] ?? null;
if ( empty($password) || mb_strlen($password) < 4 ) {
$result['pass'] = "El password tiene que tener\n una longitud de al menos\n 4 caracteres.";
}
if (count($result) === 0) {
$bd = new UserDAO('complucine');
if($bd){
$this->user = $bd->selectUser($nombre, $password);
if ($this->user) {
$this->user->setPass(null);
$_SESSION["user"] = serialize($this->user);
$_SESSION["nombre"] = $this->user->getName();
$_SESSION["rol"] = $this->user->getRol();
$_SESSION["login"] = true;
$result = 'validate.php';
} else {
$result[] = "El usuario o el password\nno coinciden.";
}
} else {
$result[] = "Error al conectar con la BD.";
}
}
return $result;
}
//Methods:
//Returns validation response:
static public function getReply() {
public function getReply() {
if(isset($_SESSION["login"])){
$name = strtoupper($_SESSION['nombre']);
$reply = "<h1>Bienvenido {$name}</h1><hr />
$this->reply = "<h1>Bienvenido {$_SESSION['nombre']}</h1><hr />
<p>{$name}, has iniciado sesión correctamente.</p>
<p>Usa los botones para navegar</p>
<a href='../'><button>Inicio</button></a>
<a href='../panel_{$_SESSION["rol"]}'><button>Mi Panel</button></a>\n";
<a href='../../panel_{$_SESSION["rol"]}'><button>Mi Panel</button></a>\n";
}
else if(!isset($_SESSION["login"])){
$reply = "<h1>ERROR</h1><hr />".
$this->reply = "<h1>ERROR</h1><hr />".
"<p>El usuario o contraseña no son válidos.</p>
<p>Vuelve a intetarlo o regístrate si no lo habías hecho previamente.</p>
<a href='./'><button>Iniciar Sesión</button></a>
<form method='post' action='./'><button name='register' id='register'>Registro</button></form>\n";
}
return $reply;
return $this->reply;
}
//Process form:
public function processesForm($name, $pass) {
$login = true;
$name = $this->test_input($name);
$pass = $this->test_input($pass);
$username = isset($name) ? $name : null ;
if (!$username) {
$login = false;
}
/*
$email = isset($mail) ? $mail : null ;
if (!$email || !mb_ereg_match(self::HTML5_EMAIL_REGEXP, $email)) {
$login = false;
}
*/
$password = isset($pass) ? $pass : null ;
if (!$password || mb_strlen($password) < 4) {
$login = false;
}
if ($login) {
$bd = new UserDAO('complucine');
if($bd){
$this->user = $bd->selectUser($username, $password);
try{
if ($this->user) {
//$_SESSION["user"] = $this->user; //¿? No funcionan los getters con el objeto.
$_SESSION["nombre"] = $this->user->getName();
$_SESSION["rol"] = $this->user->getRol();
$_SESSION["login"] = $login;
}
}
catch (Exception $e){
$_SESSION["login"] = $login;
}
}
}
}
protected function test_input($input){
return htmlspecialchars(trim(strip_tags($input)));
}
}
?>

View File

@ -1,5 +1,6 @@
<?php
include_once('user.php');
require_once('../assets/php/dao.php');
include_once('user_dto.php');
class UserDAO extends DAO {
@ -30,19 +31,6 @@
return password_verify($password, $passwd);
}
//All users
public function allUsersNotM(){
$sql = sprintf( "SELECT * FROM `users` WHERE users.id NOT IN (SELECT id FROM `manager`)");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$users[] = $this->loadUser($fila['id'], $fila['username'], $fila['email'], $fila['passwd'], $fila['rol']);
}
$resul->free();
return $users;
}
//Create a new User.
public function createUser($id, $username, $email, $password, $rol){
$password = $this->encryptPass($password);
@ -51,7 +39,7 @@
VALUES ( '%s', '%s', '%s', '%s', '%s')",
$id, $username, $email, $password, $rol );
$resul = mysqli_query($this->mysqli, $sql);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
@ -59,13 +47,11 @@
//Returns a query to check if the user name exists.
public function selectUser($username, $password){
$username = $this->mysqli->real_escape_string($username);
$password = $this->mysqli->real_escape_string($password);
$sql = sprintf( "SELECT * FROM users WHERE username = '%s'", $username );
$resul = mysqli_query($this->mysqli, $sql);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$resul->data_seek(0);
$user = null;
while ($fila = $resul->fetch_assoc()) {
if($username === $fila['username'] && $this->verifyPass($password, $fila['passwd'])){
$user = $this->loadUser($fila['id'], $fila['username'], $fila['email'], $fila['passwd'], $fila['rol']);
@ -78,68 +64,22 @@
return $user;
}
//Returns a query to get the user's data.
public function userData($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "SELECT * FROM users WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Search a user by name.
public function selectUserName($username){
//Returns a query to check if the user pass matches.
public function selectPass($username, $password){
$username = $this->mysqli->real_escape_string($username);
$sql = sprintf( "SELECT * FROM users WHERE username = '%s'", $username );
$resul = mysqli_query($this->mysqli, $sql);
return $resul;
}
//Change username by id.
public function changeUserName($id, $username){
$id = $this->mysqli->real_escape_string($id);
$username = $this->mysqli->real_escape_string($username);
$sql = sprintf( "UPDATE users SET username = '%s' WHERE id = '%d'", $username, $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Change userpass by id.
public function changeUserPass($id, $password){
$id = $this->mysqli->real_escape_string($id);
$password = $this->mysqli->real_escape_string($password);
$password = $this->encryptPass($password);
$sql = sprintf( "UPDATE users SET passwd = '%s' WHERE id = '%d'", $password, $id );
$sql = sprintf( "SELECT * FROM users WHERE username = '%s' AND passwd = '%s'", $username, $password);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
//return $this->mysqli->query($sql);
return $resul;
}
//Change user email by id.
public function changeUserEmail($id, $email){
$id = $this->mysqli->real_escape_string($id);
$email = $this->mysqli->real_escape_string($email);
$sql = sprintf( "UPDATE users SET email = '%s' WHERE id = '%d'", $email, $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
}
//Delete user account by id.
public function deleteUserAccount($id){
$id = $this->mysqli->real_escape_string($id);
$sql = sprintf( "DELETE FROM users WHERE id = '%d'", $id );
//Returns a query to get the user's data.
public function userData($id){
$sql = sprintf( "SELECT * FROM users WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
@ -147,7 +87,7 @@
//Create a new User Data Transfer Object.
public function loadUser($id, $username, $email, $password, $rol){
return new User($id, $username, $email, $password, $rol);
return new UserDTO($id, $username, $email, $password, $rol);
}
}

View File

@ -1,6 +1,7 @@
<?php
include_once('users_dto_interface.php');
class User {
class UserDTO implements UsersInterface {
//Attributes:
private $_id; //User Id.

View File

@ -0,0 +1,14 @@
<?php
interface UsersInterface {
public function setId($id);
public function getId();
public function setName($username);
public function getName();
public function setEmail($email);
public function getEmail();
public function setPass($passwd);
public function getPass();
public function setRol($rol);
public function getRol();
}
?>

View File

@ -1,12 +1,5 @@
<!DOCTYPE HTML>
<?php
/**
* USUARIOS DE PRUEBAS:
* user | userpass
* fernando | ferpass
* manager | managerpass
* admin | adminpass
*/
//General Config File:
require_once('../assets/php/config.php');
@ -14,60 +7,49 @@
require('login_register_view.php');
$view = new LoginRegisterView();
$isLogin = $view->getIsLogin();
$login = $view->getLogin();
$register = $view->getRegister();
?>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
//Forms:
require('includes/formLogin.php');
require($prefix.'register/includes/formRegister.php');
$formLogin = new FormLogin();
$htmlFormLogin = $formLogin->gestiona();
$formRegister = new FormRegister();
$htmlFormRegister = $formRegister->gestiona();
if($isLogin){
$form = "<!-- Login -->
<div class='column left'>
<div class='code info'>
<h2>¿No tienes una cuenta?</h2>
<!-- Main -->
<div class="main">
<div class="image"><img src="../img/logo_trasparente.png" /></div>
<h1>Acceso</h1>
<hr />
<p>Para crear una cuenta de usuario es necesario haber rellenado el formulario de registro previamente</p>
<p>Haz click en el botón para registrate.</p>
<form method='post'>
<button type='submit' name='register' id='_register'>Registrate</button>
</form>
</div>
</div>
<div class='column right'>
<h2>Iniciar Sesión</h2>
".$htmlFormLogin."
</div>"."\n";
} else {
$form = "<!-- Register -->
<div class='column left'>
<h2>Registro</h2>
".$htmlFormRegister."
</div>
<div class='column right'>
<div class='code info'>
<h2>¿Ya estás registrado?</h2>
<hr />
<p>Si dispones de una cuenta de usuario, no es necesario que rellenes este formulario nuevamente</p>
<p>Haz click en el botón para iniciar sesión.</p>
<form method='post'>
<button type='submit' name='login' id='_login'>Inicia Sesión</button>
</form>
</div>
</div>"."\n";
}
//Specific page content:
$section = '<!-- Login / Register -->
<!-- Login / Register -->
<section id="login_register">
<div class ="row">
'.$form.'
<?php
if($isLogin){
echo $login;
} else {
echo $register;
}
?>
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
<!-- Footer -->
<?php
$template->print_footer();
?>
</body>
</html>

96
login/login_register.php Normal file
View File

@ -0,0 +1,96 @@
<?php
$isLogin = setLogin(true);
if(array_key_exists('register',$_POST)){
$isLogin = setLogin(false);
}
else if(array_key_exists('login',$_POST)){
$isLogin = setLogin(true);
}
function setLogin($set){
return $set;
}
$register = '<!-- Register -->
<div class="column left">
<h2>Registro</h2>
<form method="post" action="">
<div class="row">
<fieldset id="datos_personales">
<legend>Datos personales</legend>
<div class="_name">
<input type="text" name="name" id="name" value="" placeholder="Nombre" required/>
</div>
<div class="_email">
<input type="email" name="email" id="email" value="" placeholder="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="verify">
<input type="checkbox" id="checkbox" name="terms" required>
<label for="terms">Marque esta casilla para verificar que ha leído nuestros términos y condiciones del servicio.</label>
</div>
<div class="actions">
<input type="submit" id="submit" value="Registrarse" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>
<div class="column right">
<div class="code info">
<h2>¿Ya estás registrado?</h2>
<hr />
<p>Si dispones de una cuenta de usuario, no es necesario que rellenes este formulario nuevamente</p>
<p>Haz click en el botón para iniciar sesión.</p>
<form method="post">
<button type="submit" name="login" id="login">Inicia Sesión</button>
</form>
</div>
</div>'."\n";
$login = '<!-- Login -->
<div class="column left">
<div class="code info">
<h2>¿No tienes una cuenta?</h2>
<hr />
<p>Para crear una cuenta de usuario es necesario haber rellenado el formulario de registro previamente</p>
<p>Haz click en el botón para registrate.</p>
<form method="post">
<button type="submit" name="register" id="register">Registrate</button>
</form>
</div>
</div>
<div class="column right">
<h2>Iniciar Sesión</h2>
<form method="post" action="validate.php">
<div class="row">
<fieldset id="datos_personales">
<legend>Datos personales</legend>
<div class="_name">
<input type="text" name="name" id="name" value="" placeholder="Nombre" required/>
</div>
<!--
<div class="_email">
<input type="email" name="email" id="email" value="" placeholder="Email" required/>
</div>
-->
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Iniciar Sesión" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>'."\n";
?>

View File

@ -16,6 +16,9 @@
else if(array_key_exists('login', $_POST)){
$this->setIsLogin(true);
}
$this->initLoginRegister();
}
//Methods:
@ -34,5 +37,89 @@
public function getRegister(){
return $this->register;
}
private function initLoginRegister(){
$this->register = '<!-- Register -->
<div class="column left">
<h2>Registro</h2>
<form method="post" action="../register/register.php">
<div class="row">
<fieldset id="datos_personales">
<legend>Datos personales</legend>
<div class="_name">
<input type="text" name="name" id="name" value="" placeholder="Nombre" required/>
</div>
<div class="_email">
<input type="email" name="email" id="email" value="" placeholder="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="verify">
<input type="checkbox" id="checkbox" name="terms" required>
<label for="terms"><a href ="../fdicines/terms_conditions/">Marque esta casilla para verificar que ha leído nuestros términos y condiciones del servicio.</a></label>
</div>
<div class="actions">
<input type="submit" id="submit" value="Registrarse" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>
<div class="column right">
<div class="code info">
<h2>¿Ya estás registrado?</h2>
<hr />
<p>Si dispones de una cuenta de usuario, no es necesario que rellenes este formulario nuevamente</p>
<p>Haz click en el botón para iniciar sesión.</p>
<form method="post">
<button type="submit" name="login" id="login">Inicia Sesión</button>
</form>
</div>
</div>'."\n";
$this->login = '<!-- Login -->
<div class="column left">
<div class="code info">
<h2>¿No tienes una cuenta?</h2>
<hr />
<p>Para crear una cuenta de usuario es necesario haber rellenado el formulario de registro previamente</p>
<p>Haz click en el botón para registrate.</p>
<form method="post">
<button type="submit" name="register" id="register">Registrate</button>
</form>
</div>
</div>
<div class="column right">
<h2>Iniciar Sesión</h2>
<form method="post" action="validate.php">
<div class="row">
<fieldset id="datos_personales">
<legend>Datos personales</legend>
<div class="_name">
<input type="text" name="name" id="name" value="" placeholder="Nombre" required/>
</div>
<!--
<div class="_email">
<input type="email" name="email" id="email" value="" placeholder="Email" required/>
</div>
-->
<div class="_passwd">
<input type="password" name="pass" id="pass" value="" placeholder="Contraseña" required/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Iniciar Sesión" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>'."\n";
}
}
?>

View File

@ -1,27 +1,59 @@
<?php
//General Config File:
require_once('../assets/php/config.php');
session_start();
//HTML template:
require_once('../assets/php/template.php');
$template = new Template();
$prefix = $template->get_prefix();
//Login form validate:
require_once('./includes/formLogin.php');
$reply = FormLogin::getReply();
$login = new FormLogin();
$login->processesForm($_POST["name"], $_POST["pass"]);
$reply = $login->getReply();
//Specific page content:
$section = '<!-- Reply -->
?>
<!DOCTYPE HTML>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<div class="main">
<div class="image"><img src="../img/logo_trasparente.png" /></div>
</div>
<!-- Reply -->
<section class="reply">
<div class ="row">
<div class="column side"></div>
<div class="column middle">
<div class="code info">
'.$reply.'
<?php
echo $reply;
?>
</div>
</div>
<div class="column side"></div>
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
<!-- Footer -->
<?php
$template->print_footer();
?>
?>
</body>
</html>

View File

@ -19,22 +19,49 @@
Haz clic <a href='{$prefix}'>aquí</a> si tu navegador no te redirige automáticamente.</p>\n";
}
//Specific page content:
$section = '<!-- Reply -->
<section id="reply">
?>
<!DOCTYPE HTML>
<!--
Práctica 2 - Sistemas Web | Grupo D
CompluCine - FDI-cines
-->
<html lang="es">
<!-- Head -->
<?php
$template->print_head();
?>
<body>
<!-- Header -->
<?php
$template->print_header();
?>
<!-- Main -->
<div class="main">
<div class="image"><img src="../img/logo_trasparente.png" /></div>
</div>
<!-- Reply -->
<section class="reply">
<div class ="row">
<div class="column side"></div>
<div class="column middle">
<div class="code info">
'.$reply.'
<?php
echo $reply;
?>
</div>
</div>
<div class="column side"></div>
</div>
</section>
';
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
<!-- Footer -->
<?php
$template->print_footer();
?>
?>
</body>
</html>

13
panel_admin/add_film.php Normal file
View File

@ -0,0 +1,13 @@
<?php
session_start();
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['add_film']) {
$film = new FormFilm();
$film->processesForm(null, $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "new");
$_SESSION['message'] = $film->getReply();
header("Location: ../panel_admin/index.php?state=mf");
}
?>

View File

@ -0,0 +1,30 @@
<?php
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['delete_film']) {
echo'<div class="column size">
<h2>Editar pelicula</h2>
<form method="post" action="delete_film.php">
<div class="row">
<fieldset id="film_form">
<legend>¿Estás seguro de que quieres eliminar esta pelicula?</legend>
<input type="hidden" name="id" value='.$_REQUEST['id'].'/>
<p>Id: '.$_REQUEST['id'].' </p>
<p>Título: '.$_REQUEST['tittle'].' </p>
<p>Duración: '.$_REQUEST['duration'].' </p>
<p>Idioma: '.$_REQUEST['language'].' </p>
<p>Descripción: '.$_REQUEST['description'].' </p>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Eliminar" name="confirm_delete_film" class="primary" />
<input type="submit" id="submit" value="Cancelar" name="cancel_delete_film" class="primary" />
</div>
</div>
</form>
</div>';
}
?>

View File

@ -0,0 +1,12 @@
<?php
session_start();
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['confirm_delete_film']) {
$film = new FormFilm();
$film->processesForm($_REQUEST['id'],null,null,null,null,"del");
$_SESSION['message'] = $film->getReply();
}
header("Location: ../panel_admin/index.php?state=mf");
?>

37
panel_admin/editFilm.php Normal file
View File

@ -0,0 +1,37 @@
<?php
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['edit_film']) {
echo'<div class="column size">
<h2>Editar pelicula</h2>
<form method="post" action="edit_film.php">
<div class="row">
<fieldset id="film_form">
<legend>Datos de pelicula</legend>
<input type="hidden" name="id" value='.$_REQUEST['id'].'/>
<div>
<input type="text" name="tittle" value='.$_REQUEST['tittle'].' />
</div>
<div>
<input type="number" name="duration" id="duration" value='.$_REQUEST['duration'].' />
</div>
<div>
<input type="text" name="language" id="language" value='.$_REQUEST['language'].' />
</div>
<div>
<input type="text" name="description" id="description" value='.$_REQUEST['description'].'/>
</div>
</fieldset>
<div class="actions">
<input type="submit" id="submit" value="Editar" name="confirm_edit_film" class="primary" />
<input type="reset" id="reset" value="Borrar" />
</div>
</div>
</form>
</div>';
}
?>

11
panel_admin/edit_film.php Normal file
View File

@ -0,0 +1,11 @@
<?php
session_start();
include_once('./includes/film_dto.php');
include_once('./includes/formFilm.php');
if($_REQUEST['confirm_edit_film']) {
$film = new FormFilm();
$film->processesForm($_REQUEST['id'], $_REQUEST['tittle'], $_REQUEST['duration'], $_REQUEST['language'], $_REQUEST['description'], "edit");
$_SESSION['message'] = $film->getReply();
header("Location: ../panel_admin/index.php?state=mf");
}
?>

View File

@ -1,5 +1,8 @@
<?php
include_once('film.php');
include_once('film_dto.php');
$template = new Template();
$prefix = $template->get_prefix();
include_once($prefix.'assets/php/dao.php');
class Film_DAO extends DAO {
@ -11,10 +14,10 @@
//Methods:
//Create a new Session.
public function createFilm($id, $tittle, $duration, $language, $description, $img){
$sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`, `img`)
VALUES ( '%d', '%s', '%d', '%s','%s', '%s')",
$id, $tittle, $duration, $language, $description, $img);
public function createFilm($id, $tittle, $duration, $language,$description){
$sql = sprintf( "INSERT INTO `film`( `id`, `tittle`, `duration`, `language`,`description`)
VALUES ( '%d', '%s', '%d', '%s','%s')",
$id, $tittle, $duration, $language,$description);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
@ -40,7 +43,7 @@
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
while($fila=$resul->fetch_assoc()){
$films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"], $fila["img"]);
$films[] = $this->loadFilm($fila["id"], $fila["tittle"], $fila["duration"], $fila["language"], $fila["description"]);
}
$resul->free();
return $films;
@ -80,10 +83,10 @@
}
//Edit a film.
public function editFilm($id, $tittle, $duration, $language,$description,$img){
$sql = sprintf( "UPDATE film SET tittle = '%s' , duration = '%d', language ='%s' , description ='%s', img ='%s'
public function editFilm($id, $tittle, $duration, $language,$description){
$sql = sprintf( "UPDATE film SET tittle = '%s' , duration = '%d', language ='%s' , description ='%s'
WHERE film.id = '%d';",
$tittle, $duration, $language, $description, $img, $id);
$tittle, $duration, $language, $description, $id);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@ -91,8 +94,8 @@
}
//Create a new film Data Transfer Object.
public function loadFilm($id, $tittle, $duration, $language,$description, $img){
return new Film( $id, $tittle, $duration, $language,$description, $img);
public function loadFilm($id, $tittle, $duration, $language,$description){
return new Film_DTO( $id, $tittle, $duration, $language,$description);
}
}

View File

@ -1,6 +1,7 @@
<?php
include_once('film_dto_interface.php');
class Film{
class Film_DTO implements FilmDTO {
//Attributes:
private $_id; //Film ID.
@ -8,16 +9,15 @@
private $_duration; //Film duration.
private $_language; //Film language.
private $_description; //Film description.
private $_img;
//Constructor:
function __construct($id, $tittle, $duration, $language, $description, $img){
function __construct($id, $tittle, $duration, $language, $description){
$this->_id = $id;
$this->_tittle = $tittle;
$this->_duration = $duration;
$this->_language = $language;
$this->_description = $description;
$this->_img = $img;
}
//Methods:
@ -33,7 +33,5 @@
public function getLanguage(){return $this->_language;}
public function setDescription($description){ $this->_description = $description;}
public function getDescription(){return $this->_description;}
public function setImg($img){ $this->_img = $img;}
public function getImg(){return $this->_img;}
}
?>

Some files were not shown because too many files have changed in this diff Show More