Examen PHP
BIN
Practicas/Practicas_PHP/UF1844_alumnos.zip
Normal file
123
Practicas/Practicas_PHP/ejercicios/examen/Examen_UF1844_xx.html
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Examen_UF1844</title>
|
||||
<link rel="stylesheet" type="text/css" href="estilos.css">
|
||||
<script>
|
||||
function obtener() {
|
||||
var dias = document.getElementById("dias").value;
|
||||
var tipo = document.getElementById("tipo").value;
|
||||
|
||||
var tipoP, riesgo;
|
||||
|
||||
if (tipo == "basico") {
|
||||
tipoP = 45;
|
||||
riesgo = 15;
|
||||
}
|
||||
|
||||
if (tipo == "gamamedia") {
|
||||
tipoP = 65;
|
||||
riesgo = 25;
|
||||
}
|
||||
|
||||
if (tipo == "lujo") {
|
||||
tipoP = 85;
|
||||
riesgo = 35;
|
||||
}
|
||||
|
||||
var vehiculo;
|
||||
if (document.getElementById("riesgo").checked) {
|
||||
vehiculo = dias * (tipoP + riesgo);
|
||||
} else {
|
||||
vehiculo = dias * (tipoP + 10);
|
||||
}
|
||||
|
||||
var silla, gps;
|
||||
if (document.getElementById("silla").checked) {
|
||||
silla = 15;
|
||||
} else {
|
||||
silla = 0;
|
||||
}
|
||||
|
||||
if (document.getElementById("gps").checked) {
|
||||
gps = 5;
|
||||
} else {
|
||||
gps = 0;
|
||||
}
|
||||
|
||||
var extras = (silla + gps) * dias;
|
||||
|
||||
var total = vehiculo + extras;
|
||||
var totalI = total * 1.21;
|
||||
|
||||
var precioMenor;
|
||||
if (document.getElementById("menor").checked) {
|
||||
precioMenor = totalI * 0.3;
|
||||
} else {
|
||||
precioMenor = 0;
|
||||
}
|
||||
|
||||
var totalF = (totalI + precioMenor).toFixed(2);
|
||||
document.getElementById("total").value = totalF;
|
||||
document.getElementById("recargo").value = precioMenor;
|
||||
}
|
||||
|
||||
function faltan() {
|
||||
var dias = document.getElementById("dias").value;
|
||||
var inicio = new Date(document.getElementById("fecha_inicio").value).getTime();
|
||||
var entrega = inicio + (dias * 24 * 60 * 60 * 1000);
|
||||
var entregaF = new Date(entrega);
|
||||
var entregaP = entregaF.toLocaleDateString();
|
||||
|
||||
|
||||
// Calcular días hasta inicio de alquiler
|
||||
var diferenciaMilisegundos = inicio - new Date().getTime();
|
||||
var diasF = Math.ceil(diferenciaMilisegundos / (1000 * 60 * 60 * 24));
|
||||
|
||||
var frase = "Faltan " + diasF + " días para tu alquiler\nTu fecha de entrega del vehículo es el " + entregaP + "\n";
|
||||
|
||||
document.getElementById("info").value = frase;
|
||||
document.getElementById("entrega").value = entregaP;
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
<form action="recibeformulario_coches.php" method="post" enctype="multipart/form-data">
|
||||
<h1>Alquiler de vehículo</h1>
|
||||
<p>Introduzca número de dias de alquiler
|
||||
<input type="number" name="dias" id="dias" size="3" value="0" required>
|
||||
<p>Elige la fecha de inicio del alquiler <input type="date" name="fecha_inicio" id="fecha_inicio" required></p>
|
||||
<p>Seleccione el tipo de vehículo
|
||||
<!-- Lista de selección -->
|
||||
<select name="tipo" id="tipo">
|
||||
<option value="basico">Básico 45 Euros/día</option>
|
||||
<option value="gamamedia">Gama media 65 Euros/día</option>
|
||||
<option value="lujo">Lujo 85 Euros/día</option>
|
||||
</select></p>
|
||||
<h2>Elementos opcionales</h2>
|
||||
<p>Silla Infantil * 15 Euros por día de alquiler<input type="checkbox" name="silla" id="silla" value="silla"></p>
|
||||
<p>GPS * 5 Euros por día de alquiler <input type="checkbox" name="gps" id="gps" value="gps"></p>
|
||||
<h2>Seguro</h2>
|
||||
<p>** El seguro a terceros es obligatorio y tiene un coste de 10 Euros/día sin IVA</p>
|
||||
<p>Seguro a todo riesgo <input type="checkbox" name="riesgo" id="riesgo" value="riesgo"></p>
|
||||
<p>Conductor menor de 30 años <input type="checkbox" name="menor" id="menor" value="menor"></p>
|
||||
<p>Coste total <input type="text" name="total" id="total" ></p>
|
||||
|
||||
<input type="button" value="Calcular coste total" onclick="obtener();faltan()">
|
||||
<p>*Nombre: <input type="text" name="nombre" id="nombre" placeholder="Nombre y Apellidos" required></p>
|
||||
<p>*Correo electrónico: <input type="email" name="email" placeholder="Escribe tu correo" required></p>
|
||||
<p>*Teléfono: <input type="tel" name="telefono" required></p>
|
||||
<p>Check-in online (opcional):</p>
|
||||
<p>Adjunte fotocopia de DNI <input type="file" name="dni_archivo" id="dni_archivo" accept=".pdf,.jpg" ></p>
|
||||
<p><label for="dni">DNI:</label> <input type="text" id="dni" name="dni" ></p>
|
||||
<textarea rows="2" cols="40" name="info" id="info"></textarea>
|
||||
<input type="hidden" name="entrega" id="entrega" >
|
||||
<input type="hidden" name="recargo" id="recargo" >
|
||||
<input type="reset" name="limpiar" value="Borrar" />
|
||||
<br><input type="submit" value="Enviar la reserva" >
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 65 KiB |
|
After Width: | Height: | Size: 255 KiB |
|
After Width: | Height: | Size: 112 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
|
@ -0,0 +1,154 @@
|
|||
<!-- ************************** -->
|
||||
<!-- Examen práctico - UF1844 -->
|
||||
<!-- ALUMNO: MARCOS LOPEZ GOMEZ -->
|
||||
<!-- ************************** -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="estilos.css" />
|
||||
<title>Busqueda y eliminacion de registros</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form method="post">
|
||||
<p>*Término a buscar: </p>
|
||||
<p><input type="text" name="termBusqueda" id="termBusqueda" size="30" placeholder="Introduzca la palabra de Busqueda" required></p>
|
||||
<input type="submit" name="buscar" value="Buscar">
|
||||
</form>
|
||||
<br>
|
||||
|
||||
|
||||
<?php
|
||||
include_once('caracteres.php');
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['buscar'])) {
|
||||
$termBusqueda = isset($_POST['termBusqueda']) ? $_POST['termBusqueda'] : '';
|
||||
$termBusqueda !== "" ? busqueda($termBusqueda) : null;
|
||||
unset($_POST);
|
||||
}
|
||||
|
||||
function busqueda($termBusqueda)
|
||||
{
|
||||
$termBusqueda = eliminar_tildes(strtolower($termBusqueda));
|
||||
$nombre_archivo = "listado_reservas.txt";
|
||||
$registros = [];
|
||||
$archivo = fopen($nombre_archivo, 'r');
|
||||
|
||||
while (($linea = fgets($archivo)) !== false) {
|
||||
if (strpos(eliminar_tildes(strtolower($linea)), $termBusqueda) !== false) {
|
||||
$registros[] = $linea;
|
||||
}
|
||||
}
|
||||
fclose($archivo);
|
||||
|
||||
if (count($registros) > 0) {
|
||||
echo "<table border= \"2\">
|
||||
<tbody>
|
||||
<thead>
|
||||
<th>Id Alquiler</th>
|
||||
<th>Nombre</th>
|
||||
<th>Correo</th>
|
||||
<th>Telefono</th>
|
||||
<th>Fecha de Inicio</th>
|
||||
<th>Fecha de Alquiler</th>
|
||||
<th>Duracion</th>
|
||||
<th>Tipo Vehiculo</th>
|
||||
<th>Acciones</th>
|
||||
</thead>";
|
||||
foreach ($registros as $registro) {
|
||||
$campos = explode("/_/", $registro);
|
||||
echo "<tr>";
|
||||
foreach ($campos as $campo) {
|
||||
echo "<td> $campo </td>";
|
||||
}
|
||||
echo "<td>" . genButtonDel($campos[0]) . "</td>";
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</tbody>";
|
||||
echo "</table>";
|
||||
} else {
|
||||
echo "<div><h4> No se han encontrado registros con los terminos indicados </h4></div>";
|
||||
}
|
||||
}
|
||||
|
||||
function genButtonDel($idReserva)
|
||||
{
|
||||
return "<form method=\"POST\" style=\"border: none; padding:0.2rem; min-width: auto; margin:0\">
|
||||
<input type=\"hidden\" name=\"idReserva\" value=\"$idReserva\" style=\"border: none; padding:0; min-width: auto; margin:0\">
|
||||
<input type=\"submit\" name=\"borrar\" value=\"Eliminar\" style=\"border: none; background-color:#122f50; color:white;cursor: pointer; padding:0.2rem 0.4rem; min-width: auto; margin:0\">
|
||||
</form>";
|
||||
}
|
||||
?>
|
||||
|
||||
|
||||
|
||||
|
||||
<form method="post">
|
||||
<p>*ID de reserva para borrar: </p>
|
||||
<input type="text" name="idReserva" value="" id="idReserva" size="15" minlength="15" maxlength="15" placeholder="Id de reserva" />
|
||||
<input type="submit" name="borrar" value="Borrar reserva de alquiler">
|
||||
</form>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST" && isset($_POST['borrar'])) {
|
||||
$idReserva = isset($_POST['idReserva']) ? $_POST['idReserva'] : '';
|
||||
if ($idReserva !== "") {
|
||||
echo "<div>";
|
||||
echo "<h4>Actuaciones sobre el registro: $idReserva</h4> <br>";
|
||||
echo eliminaDeLista($idReserva) ?
|
||||
"<p>Se ha encontrado el registro en el archivo y se ha eliminado</p>" :
|
||||
"<p>No se encontro el registro especificado en el archivo</p>";
|
||||
echo eliminaRegistro($idReserva) ?
|
||||
"<p>Se ha eliminado correctamente el registro de reserva</p>" :
|
||||
"No se ha encontrado el registro de reserva especificado</p>";
|
||||
echo eliminaUpload($idReserva) ?
|
||||
"<p>Se ha eliminado el documento almacenado con el registro</p>" :
|
||||
"<p>No se ha encontrado documentos asociados al registro</p>";
|
||||
echo "</div>";
|
||||
}
|
||||
unset($_POST);
|
||||
}
|
||||
|
||||
function eliminaDeLista($idReserva)
|
||||
{
|
||||
$nombre_archivo = "listado_reservas.txt";
|
||||
$flagEncontrado = false;
|
||||
$registros = [];
|
||||
$archivo = fopen($nombre_archivo, 'r');
|
||||
while (($linea = fgets($archivo)) !== false) {
|
||||
if (strpos($linea, $idReserva) === false) {
|
||||
$registros[] = $linea;
|
||||
} else {
|
||||
$flagEncontrado = true;
|
||||
}
|
||||
}
|
||||
fclose($archivo);
|
||||
$res=file_put_contents($nombre_archivo, $registros);
|
||||
return ($flagEncontrado && ($res!==false));
|
||||
}
|
||||
|
||||
function eliminaRegistro($idReserva)
|
||||
{
|
||||
$dir_reservas = "alquileres/";
|
||||
$nombre_archivo = "alquiler_" . "$idReserva.txt";
|
||||
return file_exists($dir_reservas . $nombre_archivo) ?
|
||||
unlink($dir_reservas . $nombre_archivo) :
|
||||
false;
|
||||
}
|
||||
|
||||
function eliminaUpload($idReserva)
|
||||
{
|
||||
$dir_uploads = "dni_clientes/";
|
||||
$file = glob($dir_uploads . "*" . $idReserva . "*");
|
||||
return (count($file) > 0) ? unlink($file[0]) : false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
42
Practicas/Practicas_PHP/ejercicios/examen/caracteres.php
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
<?php
|
||||
// Eliminar tildes
|
||||
function eliminar_tildes($cadena){
|
||||
|
||||
//Codificamos la cadena en formato utf8 en caso de que nos de errores
|
||||
//$cadena = utf8_encode($cadena);
|
||||
|
||||
//Ahora reemplazamos las letras
|
||||
$cadena = str_replace(
|
||||
array('á', 'à', 'ä', 'â', 'ª', 'Á', 'À', 'Â', 'Ä'),
|
||||
array('a', 'a', 'a', 'a', 'a', 'A', 'A', 'A', 'A'),
|
||||
$cadena
|
||||
);
|
||||
|
||||
$cadena = str_replace(
|
||||
array('é', 'è', 'ë', 'ê', 'É', 'È', 'Ê', 'Ë'),
|
||||
array('e', 'e', 'e', 'e', 'E', 'E', 'E', 'E'),
|
||||
$cadena );
|
||||
|
||||
$cadena = str_replace(
|
||||
array('í', 'ì', 'ï', 'î', 'Í', 'Ì', 'Ï', 'Î'),
|
||||
array('i', 'i', 'i', 'i', 'I', 'I', 'I', 'I'),
|
||||
$cadena );
|
||||
|
||||
$cadena = str_replace(
|
||||
array('ó', 'ò', 'ö', 'ô', 'Ó', 'Ò', 'Ö', 'Ô'),
|
||||
array('o', 'o', 'o', 'o', 'O', 'O', 'O', 'O'),
|
||||
$cadena );
|
||||
|
||||
$cadena = str_replace(
|
||||
array('ú', 'ù', 'ü', 'û', 'Ú', 'Ù', 'Û', 'Ü'),
|
||||
array('u', 'u', 'u', 'u', 'U', 'U', 'U', 'U'),
|
||||
$cadena );
|
||||
|
||||
$cadena = str_replace(
|
||||
array('ñ', 'Ñ', 'ç', 'Ç'),
|
||||
array('n', 'N', 'c', 'C'),
|
||||
$cadena
|
||||
);
|
||||
|
||||
return $cadena;
|
||||
}
|
||||
31
Practicas/Practicas_PHP/ejercicios/examen/estilos.css
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
@charset "UTF-8";
|
||||
|
||||
|
||||
|
||||
body{
|
||||
|
||||
padding:10px;
|
||||
color:white;
|
||||
background-color:#225b9d;
|
||||
}
|
||||
|
||||
span {
|
||||
color:rgb(53, 190, 11);
|
||||
}
|
||||
|
||||
div {
|
||||
width:80%;
|
||||
min-width:350px;
|
||||
background-color:#225b9d;
|
||||
border:2px solid #fff;
|
||||
padding:10px;
|
||||
margin:10px;
|
||||
box-sizing:border-box;
|
||||
color:white;
|
||||
margin:auto;
|
||||
margin-top: 20px;
|
||||
}
|
||||
|
||||
th, td {
|
||||
padding: 5px;
|
||||
}
|
||||
|
|
@ -0,0 +1,181 @@
|
|||
<!-- ************************** -->
|
||||
<!-- Examen práctico - UF1844 -->
|
||||
<!-- ALUMNO: MARCOS LOPEZ GOMEZ -->
|
||||
<!-- ************************** -->
|
||||
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="estilos.css" />
|
||||
<title>Reserva alquiler!!!</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<?php
|
||||
// Validar el método de solicitud HTTP
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$datosReserva = recopilarDatosReserva($_POST, ['dias', 'fecha_inicio', 'tipo', 'silla', 'gps', 'riesgo', 'menor', 'total', 'nombre', 'email', 'telefono', 'dni', 'info', 'entrega', 'recargo']);
|
||||
$resultadoProcesamiento = procesarReserva($datosReserva);
|
||||
mostrarResultado($resultadoProcesamiento);
|
||||
} else {
|
||||
echo "<h2>No se han recibido datos del formulario</h2>";
|
||||
}
|
||||
|
||||
|
||||
// Función para recopilar datos del formulario y sanitizarlos
|
||||
function recopilarDatosReserva($formulario, $campos)
|
||||
{
|
||||
$datos = [];
|
||||
foreach ($campos as $campo) {
|
||||
if (isset($_POST[$campo])) {
|
||||
$datos[$campo] = $formulario[$campo];
|
||||
} else {
|
||||
$datos[$campo] = "";
|
||||
}
|
||||
}
|
||||
return $datos;
|
||||
}
|
||||
|
||||
|
||||
// Función para procesar la reserva
|
||||
function procesarReserva($datosReserva)
|
||||
{
|
||||
// Variables para el resultado del procesamiento
|
||||
$exito = true;
|
||||
$msgExito = [];
|
||||
$msgError = [];
|
||||
|
||||
$dias = $datosReserva['dias'];
|
||||
$fecha_inicio = $datosReserva['fecha_inicio'];
|
||||
$tipo = $datosReserva['tipo'];
|
||||
$silla = $datosReserva['silla'] ? "Seleccionado" : "No seleccionado";
|
||||
$gps = $datosReserva['gps'] ? "Seleccionado" : "No seleccionado";
|
||||
$riesgo = $datosReserva['riesgo'] ? "Seleccionado" : "No seleccionado";
|
||||
$menor = $datosReserva['menor'] ? "Seleccionado" : "No seleccionado";
|
||||
$total = $datosReserva['total'];
|
||||
$nombre = $datosReserva['nombre'];
|
||||
$email = $datosReserva['email'];
|
||||
$telefono = $datosReserva['telefono'];
|
||||
$dni = $datosReserva['dni'];
|
||||
$info = $datosReserva['info'];
|
||||
$entrega = $datosReserva['entrega'];
|
||||
$recargo = $datosReserva['recargo'];
|
||||
|
||||
// Generar identificador de reserva
|
||||
$idReserva = time() . '_' . mt_rand(1000, 9999);
|
||||
// Fecha de reserva
|
||||
$fechaReserva = date("d-m-Y H:i:s");
|
||||
|
||||
$fichaReserva = "Id alquiler: $idReserva \r\n";
|
||||
$fichaReserva .= "Fecha de alquiler: $fechaReserva \r\n";
|
||||
$fichaReserva .= "Fecha de inicio: $fecha_inicio \r\n";
|
||||
$fichaReserva .= "Tipo de coche: $tipo \r\n";
|
||||
$fichaReserva .= "Gps: $gps \r\n";
|
||||
$fichaReserva .= "Silla: $silla \r\n";
|
||||
$fichaReserva .= "Todo riesgo: $riesgo \r\n";
|
||||
$fichaReserva .= "Menor de 30: $menor \r\n";
|
||||
$fichaReserva .= "Duración del alquiler: $dias \r\n";
|
||||
$fichaReserva .= "Coste Total: $total \r\n";
|
||||
$fichaReserva .= "Nombre: $nombre \r\n";
|
||||
$fichaReserva .= "Correo electrónico: $email \r\n";
|
||||
$fichaReserva .= "Teléfono: $telefono \r\n";
|
||||
$fichaReserva .= "DNI: $dni \r\n";
|
||||
|
||||
|
||||
// Enviar correo electrónico con los detalles de la reserva
|
||||
$destinatario = "appasin04@gmail.com";
|
||||
$asunto = "Informacion de reserva - $idReserva";
|
||||
$headers = 'Reply-To: appasin04@gmail.com' . "\r\n";
|
||||
$headers .= 'Bcc: ' . $email . "\r\n";
|
||||
if (!mail($destinatario, $asunto, $fichaReserva, $headers)) {
|
||||
$exito = false;
|
||||
$msgError[] = "Error al enviar el correo electrónico.";
|
||||
}
|
||||
|
||||
|
||||
// Guardar la ficha de reserva en un archivo
|
||||
$dir_reservas = "alquileres/";
|
||||
!is_dir($dir_reservas) ? !mkdir($dir_reservas, 0777, true) : null;
|
||||
$nombre_archivo = $dir_reservas . "alquiler_" . $idReserva . ".txt";
|
||||
if (file_put_contents($nombre_archivo, $fichaReserva) === false) {
|
||||
$exito = false;
|
||||
$msgError[] = "Error al guardar la ficha de reserva.";
|
||||
} else {
|
||||
$msgExito[] = "<h2>Reserva de alquiler confirmada!!!!</h2> " .
|
||||
"<p>". nl2br($info) . "</p>" .
|
||||
"<h4> Esta es la informacion detallada de tu reserva ! </h4>" . "<p>" . nl2br($fichaReserva) . "</p>";
|
||||
}
|
||||
|
||||
// Añadir al listado_reservas.txt una línea de reserva
|
||||
$registroReserva = implode('/_/', [$idReserva, $nombre, $email, $telefono, $fecha_inicio, $fechaReserva, $dias, $tipo]) . "\r\n";
|
||||
$nombre_archivo = "listado_reservas.txt";
|
||||
if (file_put_contents($nombre_archivo, $registroReserva, FILE_APPEND | LOCK_EX) === false) {
|
||||
$exito = false;
|
||||
$msgError[] = "Error al guardar la lista de reservas.";
|
||||
}
|
||||
|
||||
if (isset($_FILES['dni_archivo']) && $_FILES['dni_archivo']['error'] === UPLOAD_ERR_OK) {
|
||||
$exitoUpload = true;
|
||||
$dir_uploads = "dni_clientes/";
|
||||
!is_dir($dir_uploads) ? !mkdir($dir_uploads, 0777, true) : null;
|
||||
$nombreArchivo = implode("_", [$dni, $idReserva, $_FILES['dni_archivo']['name']]);
|
||||
$extension_archivo = strtolower(pathinfo($_FILES["dni_archivo"]["name"], PATHINFO_EXTENSION));
|
||||
$tamano_maximo = 1 * 1024 * 1024;
|
||||
$extensiones_permitidas = array("jpg", "jpeg", "pdf");
|
||||
|
||||
if (!in_array($extension_archivo, $extensiones_permitidas)) {
|
||||
$exitoUpload = false;
|
||||
$exito = false;
|
||||
$msgError[] = "El fichero no tiene una extension valida.";
|
||||
}
|
||||
|
||||
if ($_FILES["dni_archivo"]["size"] > $tamano_maximo) {
|
||||
$exitoUpload = false;
|
||||
$exito = false;
|
||||
$msgError[] = "El fichero excede el tamaño maximo (1Mb).";
|
||||
}
|
||||
|
||||
if ($exitoUpload) {
|
||||
if (move_uploaded_file($_FILES["dni_archivo"]["tmp_name"], $dir_uploads . $nombreArchivo)) {
|
||||
$msgExito[] = "<h4>El fichero adjunto se almaceno correctamente</h4>";
|
||||
} else {
|
||||
$exito = false;
|
||||
$msgError[] = "Ocurrio un error al almacenar el fichero adjunto";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resultado = [
|
||||
'exito' => $exito,
|
||||
'msgExito' => $msgExito,
|
||||
'msgError' => $msgError
|
||||
];
|
||||
return $resultado;
|
||||
}
|
||||
|
||||
function mostrarResultado($resultado)
|
||||
{
|
||||
echo "<div>";
|
||||
foreach ($resultado['msgExito'] as $key => $value) {
|
||||
echo "<p> $value </p>";
|
||||
}
|
||||
if (!$resultado['exito']) {
|
||||
echo "<h4>Se han encontrado los siguientes problemas al procesar su solicitud:</h4>";
|
||||
echo "<ul>";
|
||||
foreach ($resultado['msgError'] as $key => $value) {
|
||||
echo "<li> $value </li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
}
|
||||
echo "</div>";
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||