diff --git a/Practicas/Practicas_PHP/codigo/comprobacion_variables_session.php b/Practicas/Practicas_PHP/codigo/comprobacion_variables_session.php new file mode 100644 index 0000000..158ff8a --- /dev/null +++ b/Practicas/Practicas_PHP/codigo/comprobacion_variables_session.php @@ -0,0 +1,73 @@ + array_diff($claves_a_comprobar, array_keys($___SESSION) +// Forma 1 => array_diff($claves_a_comprobar, array_keys($___SESSION)) === [] +// Forma 2 => empty(array_diff($claves_a_comprobar, array_keys($___SESSION))) +// Forma 3 => count(array_diff($claves_a_comprobar, array_keys($___SESSION))) === 0 + +/***** Ejemplo *****/ +$___SESSION = [ + 'cero' => 0, + 'uno' => '1', + 'dos' => 'dos', + 'tres' => 3, + 'cuatro' => '4', +]; + +/*----- Caso 1: Todas las claves existen -----*/ +$claves_a_comprobar = ['uno', 'dos', 'tres']; + +// Forma 1 +if(array_diff($claves_a_comprobar, array_keys($___SESSION)) === []) { + echo 'OK-[]' . PHP_EOL; +} +else { + echo 'NOOOO-[]' . PHP_EOL; +} + +// Forma 2 +if(empty(array_diff($claves_a_comprobar, array_keys($___SESSION)))) { + echo 'OK-EMPTY' . PHP_EOL; +} +else { + echo 'NOOOO-EMPTY' . PHP_EOL; +} + +// Forma 3 +if(count(array_diff($claves_a_comprobar, array_keys($___SESSION))) === 0) { + echo 'OK-COUNT' . PHP_EOL; +} +else { + echo 'NOOOO-COUNT' . PHP_EOL; +} + +/*----- Caso 2: No existen todas las claves -----*/ +$claves_a_comprobar = ['uno', 'two', 'tres']; + +// Forma 1 +if(array_diff($claves_a_comprobar, array_keys($___SESSION)) === []) { + echo 'OK-[]' . PHP_EOL; +} +else { + echo 'NOOOO-[]' . PHP_EOL; +} + +// Forma 2 +if(empty(array_diff($claves_a_comprobar, array_keys($___SESSION)))) { + echo 'OK-EMPTY' . PHP_EOL; +} +else { + echo 'NOOOO-EMPTY' . PHP_EOL; +} + +// Forma 3 +if(count(array_diff($claves_a_comprobar, array_keys($___SESSION))) === 0) { + echo 'OK-COUNT' . PHP_EOL; +} +else { + echo 'NOOOO-COUNT' . PHP_EOL; +} \ No newline at end of file diff --git a/Practicas/Practicas_PHP/codigo/cookies/INTRO_COOKIES_PHP.php b/Practicas/Practicas_PHP/codigo/cookies/INTRO_COOKIES_PHP.php new file mode 100644 index 0000000..690777f --- /dev/null +++ b/Practicas/Practicas_PHP/codigo/cookies/INTRO_COOKIES_PHP.php @@ -0,0 +1,21 @@ + diff --git a/Practicas/Practicas_PHP/codigo/cookies/INTRO_COOKIES_PHP2.php b/Practicas/Practicas_PHP/codigo/cookies/INTRO_COOKIES_PHP2.php new file mode 100644 index 0000000..032e7cc --- /dev/null +++ b/Practicas/Practicas_PHP/codigo/cookies/INTRO_COOKIES_PHP2.php @@ -0,0 +1,16 @@ + diff --git a/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/busqueda.php b/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/busqueda.php index 48b58a1..4a820cd 100755 --- a/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/busqueda.php +++ b/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/busqueda.php @@ -4,7 +4,9 @@ - + ' + : '' ?> Busqueda y eliminacion de registros @@ -83,7 +85,7 @@ { return "
- +
"; } ?> diff --git a/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/estilos_claro.css b/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/estilos_claro.css new file mode 100644 index 0000000..89061cb --- /dev/null +++ b/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/estilos_claro.css @@ -0,0 +1,135 @@ +@charset "UTF-8"; + +*{ + margin: 0; + padding: 0; + list-style: none; + text-decoration: none; + border: none; + outline: none; +} + +p{ + margin-bottom: 10px; +} + +table { + width:80%; + min-width:350px; + margin:auto; + background-color: #ffffff;; + border:2px solid #9d2236; + color:#9d2236; +} + +td,th { + text-align: center; + padding:3px; +} + +a { + color: #9d2236; + text-decoration: underline; +} + + +form,div { + width:80%; + min-width:350px; + background-color: #ffffff; + border:2px solid #9d2236; + padding:10px; + box-sizing:border-box; + color:#9d2236; + font-size:18px; + margin:auto; + margin-top: 20px; + +} + +fieldset { + background-color: #ffffff; + border:2px solid #9d2236; + padding:10px; + box-sizing:border-box; + +} + +#flex { + display:flex; + justify-content:space-between; +} + +label { + margin-right:10px; + margin-bottom: 5px; +} + +input { + color:#9d2236; + background-color: #ffffff; + border:2px solid #9d2236; + padding: 2px; + min-width: 300px; +} + +legend { + font-weight: bold; + font-size: 20px; + margin:10px; +} +select,option { + color:#9d2236; + background-color: #ffffff; + border:2px solid #9d2236; + padding: 2px; +} + +textarea { + background-color: #ffffff; + width:100%; + height:200px; + color:#9d2236; + border:2px solid #9d2236; + padding:10px; + box-sizing:border-box; + margin-left: 10px; +} + +input[type=submit], input[type=button],input[type=reset] { + background-color: #ffffff; + color:#9d2236; + font-size: 16px; + font-weight: lighter; + margin-top: 10px; + padding: 5px; + border:2px solid #9d2236; + border-radius:5px; + box-shadow: 1px 2px 3px #000; + +} + +/* Media query para pantallas de menos de 450 píxeles de ancho */ +@media (max-width: 450px) { + + label { + display: block; + margin-bottom: 5px; + } + #flex { + flex-wrap:wrap; + flex-direction: column-reverse; + } + textarea { + margin-left: 0px; + } + + table { + display: block; + width: 80%; + overflow-x: auto; + } + + + +} \ No newline at end of file diff --git a/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/formulario_hotel.php b/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/formulario_hotel.php index f290577..131e197 100755 --- a/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/formulario_hotel.php +++ b/Practicas/Practicas_PHP/ejercicios/Plantilla Examen/formulario_hotel.php @@ -5,7 +5,9 @@ Reservas hotel - + ' + : '' ?>