223 Commits
v2.0 ... v3.0

Author SHA1 Message Date
b8e24fdd38 Update config.php 2021-07-02 18:03:20 +02:00
857b404eed Update template.php 2021-05-19 11:02:24 +02:00
62038f6f51 Add files via upload 2021-05-14 16:53:59 +02:00
fdf0a17edd Funcional y ademas sin notices 2021-05-13 23:58:18 +02:00
a6636ca786 Functional except file upload in formAddFilm.php 2021-05-13 20:25:42 +02:00
9851535a08 Debug 2021-05-13 20:24:00 +02:00
39a8ef2ff5 update 2021-05-13 20:06:05 +02:00
530d51a9c9 Debug 2021-05-13 20:05:20 +02:00
7a52e6a6a7 Debug 2021-05-13 17:37:09 +02:00
58e8f0a17f Delete manage_films.php 2021-05-13 17:06:26 +02:00
e52fa850d7 Todo funcional 2021-05-13 14:06:48 +02:00
965d1b5c55 Añadido un nuevo estilo de boton negro 2021-05-13 14:06:29 +02:00
d2c4fdd77f Add files via upload 2021-05-13 14:06:07 +02:00
2925084c7c debug 2021-05-13 12:51:29 +02:00
ce47b5b766 Update panelAdmin.php 2021-05-13 12:44:12 +02:00
31ba3ec858 Update formAddCinema.php 2021-05-13 12:39:12 +02:00
a5cac66b1d debug 2021-05-13 12:37:15 +02:00
2b99c192b7 delete 2021-05-13 12:31:06 +02:00
2a89128d0b Promotion 2021-05-13 12:29:47 +02:00
60d6bdbd36 debug 2021-05-13 11:51:09 +02:00
05e487e648 Delete formFilm.php 2021-05-13 11:48:57 +02:00
fd367c2a3d Delete formManager.php 2021-05-13 11:48:48 +02:00
e88092b3c3 Delete manage_managers.php 2021-05-13 11:48:34 +02:00
54d6e99c1d forms Manager 2021-05-13 11:48:20 +02:00
258829ae2e update 2021-05-13 11:47:47 +02:00
4dad0c48ee resubido panel admin pisado 2021-05-13 11:39:54 +02:00
40d1964d6a cinemas 2021-05-13 11:27:17 +02:00
b9383645fe Add files via upload 2021-05-13 11:00:18 +02:00
5758e4e7fc Add files via upload 2021-05-13 10:13:03 +02:00
9fd6c810e4 Add files via upload 2021-05-13 10:12:44 +02:00
29011f52ca Add files via upload 2021-05-13 10:12:09 +02:00
4228691615 Delete formFilm.php 2021-05-13 10:01:28 +02:00
e6af14e150 Delete manage_films.php 2021-05-13 10:01:09 +02:00
657d1cc0fe Forms restructuring 2021-05-13 10:00:47 +02:00
4c7c93d691 cambio del index al uso más reducido de código 2021-05-13 09:37:14 +02:00
517b374f5c Update formManager.php 2021-05-13 09:28:09 +02:00
df430bb6b6 Delete film.php 2021-05-13 09:22:56 +02:00
b278c82228 manager update 2021-05-13 09:20:25 +02:00
624778cd7a Update config.php 2021-05-13 00:11:42 +02:00
4d59424d02 Add files via upload 2021-05-13 00:10:19 +02:00
a6f37400e7 Update config.php 2021-05-12 22:30:28 +02:00
231e72f17a Add files via upload 2021-05-12 22:24:10 +02:00
da7bdacbaa Update config.php 2021-05-12 15:56:40 +02:00
4339a5db1e Add files via upload 2021-05-12 15:54:13 +02:00
1b64bce911 Add files via upload 2021-05-12 10:40:22 +02:00
b6ea25caa1 Add files via upload 2021-05-11 23:07:30 +02:00
3515a4a583 Cambio sesiones aña/edit/elim para uso del Form 2021-05-11 19:39:14 +02:00
b6025fc79c Cambio sesiones aña/edit/elim para uso del Form 2021-05-11 19:38:22 +02:00
0cf7615ed5 cambio en funciones, nada relevante 2021-05-11 19:36:50 +02:00
ce2a100e86 Update config.php 2021-05-11 17:39:52 +02:00
7f40b87a54 Add files via upload 2021-05-11 17:38:13 +02:00
6834851714 Add files via upload 2021-05-11 17:36:06 +02:00
d106e3c3d3 Add files via upload 2021-05-11 16:13:33 +02:00
2eab8ad868 Add files via upload 2021-05-11 15:07:30 +02:00
40da0f3ffe Delete img directory 2021-05-11 15:06:25 +02:00
709ac9f3d4 Add files via upload 2021-05-11 13:15:13 +02:00
1bf79d9093 Add files via upload 2021-05-11 13:14:55 +02:00
4449f48e83 Add files via upload 2021-05-11 13:14:28 +02:00
85cd4a8e27 Add files via upload 2021-05-11 11:06:27 +02:00
6d8a383a58 Add files via upload 2021-05-11 11:03:44 +02:00
c6ccc9aa59 Update config.php 2021-05-11 10:29:51 +02:00
99229e6d67 Add files via upload 2021-05-11 10:22:44 +02:00
b5a737fd1d Update config.php 2021-05-11 10:20:21 +02:00
2d14033940 Update config.php 2021-05-11 10:19:02 +02:00
ab5402b470 Add files via upload 2021-05-11 10:11:10 +02:00
93c556d390 Update config.php 2021-05-10 22:23:11 +02:00
805dffd5ba Add files via upload 2021-05-10 22:22:32 +02:00
c012b3b617 Update form.php 2021-05-10 21:25:14 +02:00
6c7555dcd7 Update config.php 2021-05-10 18:18:20 +02:00
63d18e5ba3 Add files via upload 2021-05-10 18:15:58 +02:00
9da5b9310b Add files via upload 2021-05-10 16:46:18 +02:00
a1d04a6eae fromHalls funciona con ->gestiona 2021-05-10 16:45:36 +02:00
57ef61e293 Update config.php 2021-05-10 12:47:57 +02:00
4fbf70a142 Add files via upload 2021-05-10 12:46:22 +02:00
ed8b795b52 Add files via upload 2021-05-10 12:45:32 +02:00
73faa928a6 Add files via upload 2021-05-10 12:30:15 +02:00
a4cd04f121 Add files via upload 2021-05-10 11:52:45 +02:00
43c39e67ed Update formChangeName.php 2021-05-09 23:51:24 +02:00
7e76797804 Add files via upload 2021-05-09 21:59:52 +02:00
50229ff233 Update config.php 2021-05-09 20:45:11 +02:00
b9a7f053dd Add files via upload 2021-05-09 20:44:13 +02:00
d075d04a2a Add files via upload 2021-05-09 20:31:54 +02:00
99e298e1eb Delete formChagePass.php 2021-05-09 19:01:36 +02:00
e207fe0155 Añadir/editar/borrar sesiones 100% funcional 2021-05-09 17:50:30 +02:00
871a7e1a7f Delete manager.css 2021-05-09 17:50:01 +02:00
f46f5c8af6 Add files via upload 2021-05-09 17:49:38 +02:00
22b468a949 Add files via upload 2021-05-09 17:48:58 +02:00
b3362d8a86 Update manager.php 2021-05-09 17:39:27 +02:00
67279ed25b Update print->films(manager) 2021-05-09 17:38:38 +02:00
b1bab61049 Delete user_dto.php 2021-05-09 16:58:46 +02:00
b68d618220 Delete users_dto_interface.php 2021-05-09 16:58:41 +02:00
696b256f83 Delete users_dto_interface.php 2021-05-09 16:58:29 +02:00
f50e8e91b8 Delete user_dto.php 2021-05-09 16:58:25 +02:00
70a0bd93c1 Delete user_dao.php 2021-05-09 16:58:21 +02:00
6d0619f5ec Add files via upload 2021-05-09 16:46:12 +02:00
bb94e30282 Add files via upload 2021-05-09 16:27:21 +02:00
40e74c9eff Add files via upload 2021-05-09 16:14:52 +02:00
1a67a7169a Add files via upload 2021-05-08 15:35:06 +02:00
8b4ed63f9f Add files via upload 2021-05-08 15:17:51 +02:00
3e48951b90 Add files via upload 2021-05-07 19:07:03 +02:00
59a89cff30 Add files via upload 2021-05-07 19:06:45 +02:00
b635ce70a0 Add files via upload 2021-05-07 19:06:12 +02:00
bed5c222ff Panel de Gerente films template 2021-05-07 13:49:45 +02:00
7be148840e Add files via upload 2021-05-07 13:48:50 +02:00
fe520f1495 Eliminadas las interaciones con film y film_dao 2021-05-07 13:48:20 +02:00
2b3a0e60fd Update panel_manager.php 2021-05-07 09:19:30 +02:00
d00c212e07 Esta comentado las opciones de sesion
Hay un fallo con film.php que esperamos arreglarlo mañana con el join en sesion y el template
2021-05-06 23:25:38 +02:00
8bb34474d6 Add files via upload 2021-05-06 23:23:34 +02:00
582cb35477 Update film_dao.php 2021-05-06 18:55:59 +02:00
0d7f34d1fa Add files via upload 2021-05-06 18:12:46 +02:00
bb2f0934dd Add files via upload 2021-05-06 18:12:26 +02:00
f439c925d8 Add files via upload 2021-05-06 18:11:55 +02:00
f3c318a34b Add files via upload 2021-05-06 18:11:12 +02:00
8139625507 Add files via upload 2021-05-06 18:10:19 +02:00
bc04b3ac76 update 2021-05-06 12:19:16 +02:00
64af5a6357 update 2021-05-06 12:18:45 +02:00
5ee09a12de updates 2021-05-06 12:18:20 +02:00
042333b96c Debud / new function in user_dao.php 2021-05-06 12:16:37 +02:00
4c0522b4a5 cambio en state de panel Manager 2021-05-06 11:06:58 +02:00
5231fd0320 Update config.php 2021-05-06 10:42:30 +02:00
89669ce53e Add files via upload 2021-05-06 10:40:56 +02:00
993f70a373 Editar/Eliminar sesiones 2021-05-06 10:33:54 +02:00
343a37d602 Editar/Eliminar sesiones 2021-05-06 10:33:12 +02:00
db298d1ea6 Editar/Eliminar sesiones 2021-05-06 10:32:11 +02:00
62fec4883d Update manage_promotions.php 2021-05-06 09:52:59 +02:00
8408636fa5 Update template
Comprobación antes de imprimir cines, al no haber cines da error en el xamp
2021-05-06 07:44:01 +02:00
8614c4b0ef Update film_dao.php 2021-05-06 07:33:27 +02:00
7993f02c27 remover film_dto 2021-05-06 07:32:24 +02:00
1447369a16 Add files via upload 2021-05-05 22:31:17 +02:00
cdb9b25754 Add files via upload 2021-05-05 21:11:27 +02:00
1c5e449cdb Estructura terminada
Sigue faltando edit/delete halls y sessions
2021-05-05 21:10:46 +02:00
fbd5227780 encryptpass 2021-05-05 19:46:10 +02:00
a3ce8a7313 Update manage_managers.php 2021-05-05 19:34:57 +02:00
1dba527f1e mg panelAdmin 2021-05-05 19:33:03 +02:00
c3371e41f1 Add/edit/del manager todavia incompleto
falta terminar y probar
2021-05-05 19:23:09 +02:00
13e0a508ff hall y hall_dao update 2021-05-05 16:55:00 +02:00
21276e226a Delete validateSession.php 2021-05-05 16:53:35 +02:00
d11d02b223 Delete manage_sessions.php 2021-05-05 16:53:28 +02:00
835c0c1fa8 Delete manage_rooms.php 2021-05-05 16:53:23 +02:00
7c1c2a7711 Delete manage_halls.php 2021-05-05 16:53:15 +02:00
0afd4b16f5 Delete hello_panel.php 2021-05-05 16:53:10 +02:00
9a8b3de844 Delete edit_sessions.php 2021-05-05 16:53:05 +02:00
8bf625e73c Delete edit_halls.php 2021-05-05 16:52:59 +02:00
f154863e36 Cambiada la toolbar de manager 2021-05-05 16:52:23 +02:00
b537db0a1b Nueva estructura
Solo funciona el añadir salas. Estoy arreglando las sesiones para que vayan igual
2021-05-05 16:52:04 +02:00
055973a459 new functionality 2021-05-05 11:57:42 +02:00
985f353216 new functionality 2021-05-05 11:57:13 +02:00
7ea975ded7 new functionality 2021-05-05 11:56:27 +02:00
17c64e04de Debug print_panelMenu 2021-05-05 11:55:41 +02:00
ebc132e205 Add files via upload 2021-05-04 22:26:24 +02:00
aacb6886bc Add files via upload 2021-05-04 21:15:53 +02:00
7c130693fe Add files via upload 2021-05-04 21:14:59 +02:00
62db2dcd23 Add files via upload 2021-05-04 21:14:38 +02:00
43219ccefa Add files via upload 2021-05-04 21:14:18 +02:00
ea3fc5f55a Delete validateSession.php 2021-05-04 21:14:01 +02:00
2cad32cecf Delete manage_rooms.php 2021-05-04 21:13:51 +02:00
b400df160f Delete manage_halls.php 2021-05-04 21:13:44 +02:00
94433c374d Delete edit_halls.php 2021-05-04 21:13:34 +02:00
ef7d231707 Delete hello_panel.php 2021-05-04 21:13:25 +02:00
04f9c8bf2a Add files via upload 2021-05-03 21:58:47 +02:00
ac2b2cfee0 Add files via upload 2021-05-03 16:51:08 +02:00
4c3fccca92 Add files via upload 2021-05-03 16:38:53 +02:00
1aa3d0d77a Add files via upload 2021-05-03 15:18:17 +02:00
0d394cf2f6 Update config.php 2021-05-03 15:12:57 +02:00
74b79fbff1 Add files via upload 2021-05-03 15:11:59 +02:00
fb7f5cb42b Add files via upload 2021-05-03 14:12:38 +02:00
d370d281f1 Restructuracion de las salas
La lista de salas se obtiene de forma distinta, por eso editar/crear sessiones ha dejado de funcionar, pero bueno, estamos a la espera de ver como deberiamos estructurarlo y eso hay que cambiarlo asi que tampoco es problema.

El html del formulario de crear salas esta guardado en formhalls, haciendo mas sencillo el codigo de la vista y la logica de edit_halls
2021-05-03 12:40:59 +02:00
02bb7938f0 Delete session_dto_interface.php 2021-05-03 12:38:40 +02:00
9d488f4c25 Delete session_dto.php 2021-05-03 12:38:35 +02:00
e260d94612 Delete session_dao.php 2021-05-03 12:38:29 +02:00
2a5087cbc2 Delete session.php 2021-05-03 12:38:24 +02:00
98b0d8156b Delete hall_dto_interface.php 2021-05-03 12:38:19 +02:00
d77eb135c1 Delete hall.php 2021-05-03 12:38:13 +02:00
e90cd9220d Delete hall_dto.php 2021-05-03 12:38:03 +02:00
52f5d9417f Delete hall_dao.php 2021-05-03 12:37:56 +02:00
83f4264ccb Re actualizado hall.php y session.php
por favor, no los volvais a sobrescribir y pongais de nuevo todos los dto y sus interfaces
2021-05-03 12:37:10 +02:00
c47c7fd50e Delete session_dto_interface.php 2021-05-03 12:36:31 +02:00
482d78ba6f Delete session_dto.php 2021-05-03 12:36:25 +02:00
c35a4ca0d9 Delete hall_dto_interface.php 2021-05-03 12:36:16 +02:00
f21e8d6c33 Delete hall_dto.php 2021-05-03 12:36:08 +02:00
d7cbedc524 Debug 2021-05-03 09:49:58 +02:00
9d1869023a Delete cinema.php 2021-05-03 01:19:26 +02:00
27d651223c Delete cinema_dao.php 2021-05-03 01:19:08 +02:00
1a1893f6fa Delete film_dto_interface.php 2021-05-03 01:18:53 +02:00
5acddf66b9 Delete film_dto.php 2021-05-03 01:18:43 +02:00
50e4cfbcff Delete film_dao.php 2021-05-03 01:18:36 +02:00
41000d9627 Add files via upload 2021-05-03 01:17:42 +02:00
015b2ffcf8 Debug 2021-05-02 17:57:23 +02:00
d0556cdafe cinema & cinema_dao 2021-05-02 17:27:46 +02:00
13b14d7758 add function print_cinemas 2021-05-02 17:27:20 +02:00
b74ea05d08 Delete update_film.php 2021-05-02 17:26:26 +02:00
1efa3487c3 Delete updateFilm.php 2021-05-02 17:26:18 +02:00
dfbe2877b5 restructuring and functionality cinemas 2021-05-02 17:25:58 +02:00
d85e933c73 Add files via upload 2021-05-02 16:01:05 +02:00
3d144738c8 Add files via upload 2021-05-01 09:34:03 +02:00
d5dbb1ddcc Add files via upload 2021-04-30 22:23:26 +02:00
779f11d8d0 Update template.php 2021-04-30 21:29:59 +02:00
ce80df9c55 Update template.php 2021-04-30 20:55:33 +02:00
1e99798482 Update template.php 2021-04-30 20:49:43 +02:00
22c329bb5b Add files via upload 2021-04-30 20:49:21 +02:00
a873ead5db Update film.php 2021-04-29 10:52:45 +02:00
ee9ac06a8b . 2021-04-29 10:51:43 +02:00
071bce7b71 delete 2021-04-29 10:46:33 +02:00
090f820453 . 2021-04-29 10:39:14 +02:00
4affecf524 DTO deleted 2021-04-29 10:23:10 +02:00
f97f4f8c94 Delete session_dto_interface.php 2021-04-29 10:22:41 +02:00
0811b17f34 Delete session_dto.php 2021-04-29 10:22:36 +02:00
5e4d7eb94b Delete session_dao.php 2021-04-29 10:22:31 +02:00
1a1f6ad12c Delete hall_dao.php 2021-04-29 10:22:24 +02:00
875cf8e04a Delete hall_dto_interface.php 2021-04-29 10:22:12 +02:00
8beecc7ce1 Delete hall_dto.php 2021-04-29 10:22:07 +02:00
49ab2fb2d1 Hall and Session dao updates 2021-04-29 10:21:44 +02:00
ceca74f8e9 Delete session_dto_interface.php 2021-04-29 10:21:12 +02:00
89b204fbbe Delete session_dto.php 2021-04-29 10:21:07 +02:00
981b141693 Delete hall_dto_interface.php 2021-04-29 10:20:59 +02:00
1e42bc8b36 Delete hall_dto.php 2021-04-29 10:20:49 +02:00
9756959978 Add files via upload 2021-04-28 21:46:10 +02:00
12a56f33bf Add files via upload 2021-04-28 21:07:54 +02:00
b3aa890b7e Add files via upload 2021-04-28 21:06:53 +02:00
9ee7889968 Add files via upload 2021-04-28 21:06:13 +02:00
1e9685ee9b Add files via upload 2021-04-26 22:40:34 +02:00
b033bdf328 Add files via upload 2021-04-26 22:36:16 +02:00
a63c0f9a46 Update README.md 2021-02-16 16:36:28 +01:00
158 changed files with 6776 additions and 3952 deletions

Binary file not shown.

Binary file not shown.

BIN
Practica3-Enunciado.pdf Normal file

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 2.0 (Segunda entrega)
## Versión 3.0 (Tercera entrega)
***
## Licencia 📄
Educational Community License v2.0 (ECL-2.0).

613
assets/css/highContrast.css Normal file
View File

@ -0,0 +1,613 @@
/* 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: 11px;
width: 13px;
}
/* Header Menu */
.menu {
@ -114,6 +114,15 @@ 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 */
@ -134,7 +143,7 @@ a:hover{
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #d3ebff;
color: #000000
color: #000000;
}
/* Table */
@ -164,7 +173,7 @@ table a{
color: #1f2c3d;
font-size: 0.9em;
font-weight: 600;
padding: 0 0.85em 0.85em 0.85em;
padding: 0.85em 0.85em 0.85em 0.85em;
}
table thead, table tfoot {
border-bottom: solid 2px #1f2c3d;
@ -192,16 +201,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: 50%;
main img {
width: 40%;
}
/* Create three unequal columns that floats next to each other */
@ -287,7 +296,7 @@ table a{
.code a {
text-decoration: underline;
}
.code ul, .code ol {
.code ul, .code ol, .code li {
color: #dadada;
}
.code img{
@ -305,6 +314,9 @@ table a{
font-size: 90%;
color: #d3ebff;
}
.code label{
color: #d3ebff;
}
.code.details{
height: 750px;
}
@ -514,7 +526,7 @@ textarea {
color: rgb(138, 150, 32);
}
#submit {
#submit, #register {
width: 100%;
height: 35px;
border: 1px solid #000000;
@ -526,7 +538,7 @@ textarea {
filter: brightness(105%);
cursor: pointer;
}
#submit:hover {
#submit:hover, #register:hover {
background-color: #d3ebff;
}
@ -547,7 +559,21 @@ 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 {
@ -562,6 +588,16 @@ 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%;

68
assets/css/manager.css Normal file
View File

@ -0,0 +1,68 @@
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: ../");
?>

3
assets/js/cambiarCSS.js Normal file
View File

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

598
assets/mysql/complucine.sql Normal file
View File

@ -0,0 +1,598 @@
-- 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

@ -0,0 +1,34 @@
<!--
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>

138
assets/php/aplication.php Normal file
View File

@ -0,0 +1,138 @@
<?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

@ -0,0 +1,32 @@
<?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

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

View File

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

103
assets/php/common/hall.php Normal file
View File

@ -0,0 +1,103 @@
<?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

@ -0,0 +1,96 @@
<?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

@ -0,0 +1,35 @@
<?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

@ -0,0 +1,77 @@
<?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

@ -0,0 +1,36 @@
<?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

@ -0,0 +1,77 @@
<?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

@ -0,0 +1,63 @@
<?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

@ -0,0 +1,58 @@
<?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

@ -0,0 +1,118 @@
<?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,6 +1,5 @@
<?php
require_once('../assets/php/dao.php');
include_once('session_dto.php');
include_once('session.php');
class SessionDAO extends DAO {
//Constructor:
@ -14,9 +13,9 @@
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
$sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`)
VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s')",
$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
$sql = sprintf( "INSERT INTO `session` (`id`, `idfilm`, `idhall`, `idcinema`, `date`, `start_time`, `seat_price`, `format`, `seats_full`)
VALUES ('%d', '%d', '%d', '%d', '%s', '%s', '%d', '%s', '%d')",
$id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, "0");
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@ -28,47 +27,56 @@
$sql = sprintf( "SELECT * FROM `session` WHERE id = '%d'", $id );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database en sessionData con la id '. $id);
$resul = mysqli_fetch_array($resul);
return $resul;
}
//Returns the count of the session searched
public function filmTittle($idfilm){
$sql = sprintf("SELECT * FROM film JOIN session ON film.id = session.idfilm WHERE session.idfilm = '%d' ", $idfilm );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database en sessionData con la id '. $idfilm);
$resul = mysqli_fetch_array($resul);
return $resul;
}
//Returns a session
public function searchSession($cinema, $hall, $startTime, $date){
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
$sql = sprintf( "SELECT COUNT(*) FROM session WHERE
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$cinema, $hall, $date, $startTime);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$session = null;
$session = mysqli_fetch_array($resul);
mysqli_free_result($resul);
return $session[0];
return $session;
}
//Returns a query to get all the session's data.
public function getAllSessionsFromACinemaHallDate($cinema, $hall, $date){
public function getAllSessions($hall, $cinema, $date){
$date = date('Y-m-d', strtotime( $date ) );
$sql = sprintf( "SELECT * FROM session WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s'",
idcinema = '%s' AND idhall = '%s' AND date = '%s' ORDER BY start_time ASC;",
$cinema, $hall, $date);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$sessions = null;
while($fila=mysqli_fetch_array($resul)){
$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"]);
$sessions[] = $this->loadSession($fila["id"], $fila["idfilm"], $fila["idhall"], $fila["idcinema"], $fila["date"], $fila["start_time"], $fila["seat_price"], $fila["format"], $fila["seats_full"]);
}
mysqli_free_result($resul);
return $sessions;
}
public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
public function editSession($idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin){
$format = $this->mysqli->real_escape_string($format);
$date = date('Y-m-d', strtotime( $date ) );
$startTime = date('H:i:s', strtotime( $startTime ) );
@ -78,7 +86,7 @@
`start_time` = '%s', `seat_price` = '%d', `format` = '%s'
WHERE
idcinema = '%s' AND idhall = '%s' AND date = '%s' AND start_time = '%s'",
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $_SESSION["cinema"],$_SESSION["hall"],$_SESSION["date"],$_SESSION["start"]);
$idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $origin["cinema"],$origin["hall"],$origin["date"],$origin["start"]);
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
@ -97,8 +105,8 @@
}
//Create a new Session Data Transfer Object.
public function loadSession( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format){
return new SessionDTO( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format);
public function loadSession( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full){
return new Session( $id, $idfilm, $idhall, $idcinema, $date, $startTime, $seatPrice, $format, $seats_full);
}
}

View File

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

View File

@ -1,6 +1,5 @@
<?php
require_once('../assets/php/dao.php');
include_once('user_dto.php');
include_once('user.php');
class UserDAO extends DAO {
@ -31,6 +30,19 @@
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);
@ -39,7 +51,7 @@
VALUES ( '%s', '%s', '%s', '%s', '%s')",
$id, $username, $email, $password, $rol );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
$resul = mysqli_query($this->mysqli, $sql);
return $resul;
}
@ -47,11 +59,13 @@
//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) or die ('Error into query database');
$resul = mysqli_query($this->mysqli, $sql);
$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']);
@ -64,22 +78,68 @@
return $user;
}
//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);
//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 username = '%s' AND passwd = '%s'", $username, $password);
$sql = sprintf( "SELECT * FROM users WHERE id = '%d'", $id );
$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 );
//Search a user by name.
public function selectUserName($username){
$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 );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
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 );
$resul = mysqli_query($this->mysqli, $sql) or die ('Error into query database');
return $resul;
@ -87,7 +147,7 @@
//Create a new User Data Transfer Object.
public function loadUser($id, $username, $email, $password, $rol){
return new UserDTO($id, $username, $email, $password, $rol);
return new User($id, $username, $email, $password, $rol);
}
}

View File

@ -1,4 +1,31 @@
<?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();
@ -6,4 +33,23 @@
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,37 +1,24 @@
<?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 == null) $bd_name = self::_BD;
try{
if (!$this->mysqli) {
$this->mysqli = new mysqli(self::_SERVERNAME, self::_USERNAME,
self::_PASSWORD, $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";
}
// echo "Conexión a la BD, satisfactoria.";
} catch (Exception $e){
echo "Error de conexión a la BD: ". mysqli_connect_error();
exit();
$app = Aplicacion::getSingleton();
$this->mysqli = $app->conexionBd();
}
/* ... */
}
//Destructor:
//Destructor (Ya no es necesdario):
/*
public function __destruct(){
$this->mysqli->close();
}
*/
//Methods:
}
?>

View File

@ -1,171 +1,297 @@
<?php
class Form {
/**
* Sufijo para el nombre del parámetro de la sesión del usuario donde se almacena el token CSRF.
* 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.
*/
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.
* @var string Identificador utilizado para construir el atributo "id" de la etiqueta &lt;form&gt; como <code>$tipoFormulario.$formId</code>.
*/
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.
* @var string 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.
* @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.
*/
public function __construct($formId, $opciones = array() ) {
$this->formId = $formId;
private $classAtt;
$opcionesPorDefecto = array( 'ajax' => false, 'action' => null, 'class' => null, 'enctype' => null );
/**
* @var string Parámetro de la petición utilizado para comprobar que el usuario ha enviado el formulario..
*/
private $tipoFormulario;
/**
* @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.
*
* 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 array $opciones (ver más arriba).
*/
public function __construct($tipoFormulario, $opciones = array(), $formId = 1)
{
$this->tipoFormulario = $tipoFormulario;
$this->formId = $tipoFormulario.$formId;
$opcionesPorDefecto = array( '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'];
$this->action = htmlentities($_SERVER['PHP_SELF']);
}
}
public function gestiona() {
/**
* 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()
{
if ( ! $this->formularioEnviado($_POST) ) {
echo $this->generaFormulario();
return $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;
$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();
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);
return $this->generaFormulario($_POST, $result);
} else {
echo $this->generaHtmlErrores($result);
}
} else {
if ( ! $this->ajax ) {
header('Location: '.$result);
} else {
echo $result;
}
}
exit();
}
}
}
/**
* 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).
* 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.
*/
protected function generaCamposFormulario ($datos) {
protected function generaCamposFormulario($datosIniciales, $errores = array())
{
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) {
protected function procesaFormulario($datos)
{
return array();
}
/**
* Función que verifica si el usuario ha enviado el formulario. Comprueba si existe el parámetro <code>$formId</code> en <code>$params</code>.
* Función que verifica si el usuario ha enviado el formulario.
*
* @param array $params Array que contiene los datos recibidos en el envío formulario.
* Comprueba si existe el parámetro <code>$formId</code> en <code>$params</code>.
*
* @return boolean Devuelve <code>TRUE</code> si <code>$formId</code> existe como clave en <code>$params</code>
* @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>
*/
private function formularioEnviado(&$params) {
return isset($params['action']) && $params['action'] == $this->formId;
private function formularioEnviado(&$params)
{
return isset($params['action']) && $params['action'] == $this->tipoFormulario;
}
/**
* 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 array $errores (opcional) Array con los mensajes de error de validación y/o procesamiento del formulario.
* @param string[] $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.
* @return string HTML asociado al formulario.
*/
private function generaFormulario($errores = array(), &$datos = array()) {
private function generaFormulario(&$datos = array(), &$errores = array())
{
$htmlCamposFormularios = $this->generaCamposFormulario($datos, $errores);
$html= $this->generaListaErrores($errores);
$html .= '<form method="POST" action="'.$this->action.'" id="'.$this->formId.'"';
$classAtt='';
if ( $this->classAtt ) {
$html .= ' class="'.$this->classAtt.'"';
$classAtt = " class=\"{$this->classAtt}\"";
}
$enctypeAtt='';
if ( $this->enctype ) {
$html .= ' enctype="'.$this->enctype.'"';
$enctypeAtt = " 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->formId);
$html .= '<input type="hidden" name="CSRFToken" value="'.$tokenValue.'" />';
$tokenValue = $this->csrfguard_GenerateToken($this->tipoFormulario);
$tokenCSRF = "<input type='hidden' name='CSRFToken' value='$tokenValue' />";
}
$html .= '<input type="hidden" name="action" value="'.$this->formId.'" />';
$html .= $this->generaCamposFormulario($datos);
$html .= '</form>';
return $html;
/* <<< 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;
}
private function generaListaErrores($errores) {
/**
* 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='')
{
$html='';
$numErrores = count($errores);
$clavesErroresGenerales = array_filter(array_keys($errores), function ($elem) {
return is_numeric($elem);
});
$numErrores = count($clavesErroresGenerales);
if ($numErrores > 0) {
$html = "<ul class=\"$classAtt\">";
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>";
$html .= "<li>$errores[0]</li>";
} else {
foreach($clavesErroresGenerales as $clave) {
$html .= "<li>$errores[$clave]</li>";
}
$html .= "</li>";
}
$html .= '</ul>';
}
return $html;
}
private function csrfguard_GenerateToken($formId) {
if ( ! isset($_SESSION) ) {
throw new Exception('La sesión del usuario no está definida.');
/**
* 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>";
}
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 {
@ -181,58 +307,37 @@ class Form {
}
}
$_SESSION[$formId.'_'.self::CSRF_PARAM]=$token;
$_SESSION[$paramSession]=$token;
}
return $token;
}
private function csrfguard_ValidateToken($formId, $tokenRecibido) {
if ( ! isset($_SESSION) ) {
throw new Exception('La sesión del usuario no está definida.');
private function csrfguard_ValidateToken($formParameter, $tokenRecibido)
{
if ( ! session_id() ) {
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 ) {
$paramSession = self::CSRF_PARAM.'_'.$formParameter;
if ( isset($_SESSION[$paramSession]) ) {
if ( $_SESSION[$paramSession] !== $tokenRecibido ) {
$result = array();
$result[] = 'Has enviado el formulario dos veces';
}
$_SESSION[$formId.'_'.self::CSRF_PARAM] = ' ';
unset($_SESSION[$formId.'_'.self::CSRF_PARAM]);
$_SESSION[$paramSession] = ' ';
unset($_SESSION[$paramSession]);
} 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,14 +1,17 @@
<?php
class Template {
//Attributes:
public $page; //Page Name.
public $prefix; //Page prefix.
//Constants:
//private const _NUMPAGES = 10; //Constant to page results.
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).
//Attributes:
private $page; //Page Name.
private $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).
//Constructor:
function __construct(){
@ -101,7 +104,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>
@ -127,7 +130,7 @@
}
//Print generic Main:
function print_main(){
function print_main($content = ""){
$page = $this->page;
$prefix = $this->prefix;
@ -149,12 +152,330 @@
}
/* MAIN */
echo"<div class='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>
<div class='image'><a href='{$prefix}'><img src='{$prefix}img/logo_trasparente.png' alt='logo_FDI-Cines' /></a></div>
{$sub_header}
<h1>{$page}</h1>
{$tittle}{$content}
<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:
@ -167,18 +488,28 @@
//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 2 | Sistemas Web 2021 </p>
<p>© Práctica 3 | Sistemas Web 2021 </p>
</div>
<a href='{$prefix}fdicines/about_us/'>Sobre FDI-Cines</a> |
<a href='{$prefix}fdicines/terms_conditions/'>Términos y condiciones</a> |
<a href='{$prefix}fdicines/terms_conditions/'>Términos de uso</a> |
<a href='{$prefix}cinemas/'>Nuestros cines</a> |
<a href='{$prefix}contacto/'>Contacto</a>
<a href='{$prefix}contacto/'>Contacto</a> |
<button onclick=\"cambiarCSS('$css');\">$nameCSS</button>
</footer>\n";
echo"
<!-- Scripts -->
<script src='{$prefix}assets/js/cambiarCSS.js'></script>\n";
}
}

View File

@ -1,83 +0,0 @@
<?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);
}
}
?>

View File

@ -1,37 +0,0 @@
<?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

@ -1,14 +0,0 @@
<?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,32 +1,10 @@
<!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();
?>
<!-- Main -->
<?php
$template->print_main();
?>
//Specific page content:
$section = '';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

@ -0,0 +1,88 @@
<?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,77 +1,20 @@
<!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();
?>
<!-- Main -->
<?php
$template->print_main();
?>
//Contact form:
require_once('includes/formContact.php');
$form = new FormContact();
$htmlForm = $form->gestiona();
<!-- Form -->
//Specific page content:
$section = '<!-- Contact 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>
<h4>Formulario (EN DESARROLLO)</h4>
'.$htmlForm.'
</section>
';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

@ -1,33 +1,9 @@
<!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();
?>
<!-- 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 -->
//Specific page content:
$section = '<!-- Description -->
<section id="description">
<div class="code" id="resume">
<h1>Descripción</h1>
@ -54,22 +30,18 @@
<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>
';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

@ -1,29 +1,9 @@
<!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();
?>
<!-- Main -->
<?php
$template->print_main();
?>
<!-- Flow -->
//Specific page content:
$section = '<!-- Flow -->
<section id="flow">
<div class="code">
<h2>FLUJO DE NAVEGACIÓN</h2>
@ -89,7 +69,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/inicio.png" />
<img src="../../img/bocetos/inicio.png" />
<div class="description">
<h3>Pantalla de inicio</h3>
<p>Pantalla de bienvenida al entrar en la web.</p>
@ -98,7 +78,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/registrarse_iniciar_sesion.png" />
<img src="../../img/bocetos/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>
@ -109,7 +89,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/menu_usuario.png" />
<img src="../../img/bocetos/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>
@ -118,7 +98,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/peliculas.png" />
<img src="../../img/bocetos/peliculas.png" />
<div class="description">
<h3>Cartelera</h3>
<p>Pantalla con información sobre todas las películas disponibles en ese momento.</p>
@ -129,7 +109,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/cine.png" />
<img src="../../img/bocetos/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>
@ -138,7 +118,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/selector_horario.png" />
<img src="../../img/bocetos/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>
@ -149,7 +129,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/mapa_asientos.png" />
<img src="../../img/bocetos/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>
@ -158,7 +138,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/pagar.png" />
<img src="../../img/bocetos/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>
@ -169,7 +149,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/compra_realizada.png" />
<img src="../../img/bocetos/compra_realizada.png" />
<div class="description">
<h3>Compra Realizada</h3>
<p>Pantalla de confirmación con los datos de compra.</p>
@ -178,7 +158,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/about_us.png" />
<img src="../../img/bocetos/about_us.png" />
<div class="description">
<h3>Sobre nosotros</h3>
<p>Pantalla con información sobre FDI-Cines.</p>
@ -189,7 +169,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/contacto.png" />
<img src="../../img/bocetos/contacto.png" />
<div class="description">
<h3>Formulario de Contacto</h3>
<p>Pantalla con un formulario para realizar una consulta a los administradores.</p>
@ -198,7 +178,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/terminos_y_condiciones.png" />
<img src="../../img/bocetos/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>
@ -214,7 +194,7 @@
<div class="row">
<div class="column side">
<div class="sketches">
<img src="../../img/panel_inicio_gerente.png" />
<img src="../../img/bocetos/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>
@ -223,7 +203,7 @@
</div>
<div class="column middle">
<div class="sketches">
<img src="../../img/gestionar_salas.png" />
<img src="../../img/bocetos/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>
@ -232,7 +212,7 @@
</div>
<div class="column side">
<div class="sketches">
<img src="../../img/gestionar_sesiones.png" />
<img src="../../img/bocetos/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>
@ -248,7 +228,7 @@
<div class="row">
<div class="column left">
<div class="sketches">
<img src="../../img/panel_inicio_admin.png" />
<img src="../../img/bocetos/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>
@ -257,7 +237,7 @@
</div>
<div class="column right">
<div class="sketches">
<img src="../../img/gestionar_peliculas.png" />
<img src="../../img/bocetos/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>
@ -268,7 +248,7 @@
<div class="row">
<div class="column side">
<div class="sketches">
<img src="../../img/gestionar_cines.png" />
<img src="../../img/bocetos/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>
@ -277,7 +257,7 @@
</div>
<div class="column middle">
<div class="sketches">
<img src="../../img/gestionar_promociones.png" />
<img src="../../img/bocetos/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>
@ -286,7 +266,7 @@
</div>
<div class="column side">
<div class="sketches">
<img src="../../img/gestionar_admins_gerentes.png" />
<img src="../../img/bocetos/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>
@ -295,12 +275,8 @@
</div>
</div>
</section>
';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

@ -1,33 +1,9 @@
<!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();
?>
<!-- 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 -->
//Specific page content:
$section = '<!-- Details -->
<section id="details">
<div class = "code">
<h1>Detalles</h1>
@ -111,10 +87,8 @@
</div>
</div>
</section>
<!-- Footer -->
<?php
$template->print_footer();
?>
';
</body>
</html>
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>

View File

@ -1,33 +1,9 @@
<!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();
?>
<!-- Main -->
<div class="main">
<div class="image"><img src="../../img/logo_trasparente.png" /></div>
<!-- Sub Header -->
<?php
$template->print_subheader();
?>
$content = '<hr />
<section id="members_table">
<h1>Miembros</h1>
<hr />
<table>
<thead>
<tr>
@ -62,10 +38,10 @@
</tr>
</tbody>
</table>
</section>
</div>
</section>';
<!-- Members -->
//Specific page content:
$section = '<!-- Members -->
<section id="members">
<div class="row">
<div class="column side">
@ -73,7 +49,7 @@
<section id="MEP">
<div class="zoom">
<div class="code">
<img src="../../img/mep.jpg" />
<img src="../../img/us/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>
@ -88,7 +64,7 @@
<section id="FMT">
<div class="zoom">
<div class="code">
<img src="../../img/fmt.jpg" />
<img src="../../img/us/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>
@ -103,7 +79,7 @@
<section id="DMG">
<div class="zoom">
<div class="code">
<img src="../../img/dmg.jpg" />
<img src="../../img/us/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>
@ -120,7 +96,7 @@
<section id="IMT">
<div class="zoom">
<div class="code">
<img src="../../img/imt.jpg" />
<img src="../../img/us/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>
@ -135,7 +111,7 @@
<section id="ORP">
<div class="zoom">
<div class="code">
<img src="../../img/orp.jpg" />
<img src="../../img/us/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>
@ -151,7 +127,7 @@
<section id="ARN">
<div class="zoom">
<div class="code">
<img src="../../img/arn.jpg" />
<img src="../../img/us/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>
@ -162,16 +138,8 @@
</section>
</div>
</div>
</section>
</section>';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>
</html>

View File

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

View File

@ -1,32 +1,9 @@
<!DOCTYPE HTML>
<?php
session_start();
//General Config File:
require_once('../../assets/php/config.php');
//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 -->
//Specific page content:
$section = '<!-- Section -->
<section id="terms_and_conditions">
<div class="code">
<p>
@ -209,12 +186,8 @@
</ol>
</div>
</section>
';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 42 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: 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: 42 KiB

After

Width:  |  Height:  |  Size: 42 KiB

View File

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 37 KiB

View File

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 48 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

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

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: 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

View File

Before

Width:  |  Height:  |  Size: 133 KiB

After

Width:  |  Height:  |  Size: 133 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

BIN
img/seat_green.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 505 B

BIN
img/seat_grey.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 600 B

BIN
img/seat_red.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 419 B

BIN
img/tmp/cm.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

View File

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 75 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: 79 KiB

After

Width:  |  Height:  |  Size: 79 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

@ -1,95 +1,18 @@
<!DOCTYPE HTML>
<?php
//General Config File:
require_once('./assets/php/config.php');
require_once(__DIR__.'/assets/php/config.php');
//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 -->
//Page-specific content:
$section = '<!-- Undercard -->
<section id="cartelera">
<div class="row">
<div class="code">
<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>
'.$template->print_fimls().'
</div>
</div>
</section>
';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

@ -1,238 +0,0 @@
<?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('user_dao.php');
include_once($prefix.'assets/php/common/user_dao.php');
include_once($prefix.'assets/php/form.php');
class FormLogin extends Form {
@ -9,86 +9,92 @@ 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();
}
//Methods:
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;
}
//Returns validation response:
public function getReply() {
static public function getReply() {
if(isset($_SESSION["login"])){
$name = strtoupper($_SESSION['nombre']);
$this->reply = "<h1>Bienvenido {$_SESSION['nombre']}</h1><hr />
$reply = "<h1>Bienvenido {$name}</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"])){
$this->reply = "<h1>ERROR</h1><hr />".
$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 $this->reply;
return $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,14 +0,0 @@
<?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,5 +1,12 @@
<!DOCTYPE HTML>
<?php
/**
* USUARIOS DE PRUEBAS:
* user | userpass
* fernando | ferpass
* manager | managerpass
* admin | adminpass
*/
//General Config File:
require_once('../assets/php/config.php');
@ -7,49 +14,60 @@
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();
?>
<!-- Main -->
<div class="main">
<div class="image"><img src="../img/logo_trasparente.png" /></div>
<h1>Acceso</h1>
//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>
<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";
}
<!-- Login / Register -->
//Specific page content:
$section = '<!-- Login / Register -->
<section id="login_register">
<div class ="row">
<?php
if($isLogin){
echo $login;
} else {
echo $register;
}
?>
'.$form.'
</div>
</section>
';
<!-- Footer -->
<?php
$template->print_footer();
//General page content:
require RAIZ_APP.'/HTMLtemplate.php';
?>
</body>
</html>

View File

@ -1,96 +0,0 @@
<?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,9 +16,6 @@
else if(array_key_exists('login', $_POST)){
$this->setIsLogin(true);
}
$this->initLoginRegister();
}
//Methods:
@ -37,89 +34,5 @@
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,59 +1,27 @@
<?php
session_start();
//HTML template:
require_once('../assets/php/template.php');
$template = new Template();
$prefix = $template->get_prefix();
//General Config File:
require_once('../assets/php/config.php');
//Login form validate:
require_once('./includes/formLogin.php');
$login = new FormLogin();
$login->processesForm($_POST["name"], $_POST["pass"]);
$reply = $login->getReply();
$reply = FormLogin::getReply();
?>
<!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 -->
//Specific page content:
$section = '<!-- Reply -->
<section class="reply">
<div class ="row">
<div class="column side"></div>
<div class="column middle">
<div class="code info">
<?php
echo $reply;
?>
'.$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,49 +19,22 @@
Haz clic <a href='{$prefix}'>aquí</a> si tu navegador no te redirige automáticamente.</p>\n";
}
?>
<!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">
//Specific page content:
$section = '<!-- Reply -->
<section id="reply">
<div class ="row">
<div class="column side"></div>
<div class="column middle">
<div class="code info">
<?php
echo $reply;
?>
'.$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

@ -1,13 +0,0 @@
<?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

@ -1,30 +0,0 @@
<?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

@ -1,12 +0,0 @@
<?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");
?>

View File

@ -1,37 +0,0 @@
<?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>';
}
?>

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