Optimizaciones
This commit is contained in:
@@ -0,0 +1,81 @@
|
||||
<!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 de registros</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<form action="" method="POST">
|
||||
<h2>Buqueda de registro</h2>
|
||||
<input type="text" name="terminoBusqueda" id="terminoBusqueda">
|
||||
<input type="submit" value="Buscar" required>
|
||||
<br>
|
||||
</form>
|
||||
<br>
|
||||
|
||||
<?php
|
||||
include_once('./caracteres.php');
|
||||
|
||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
||||
$terminoBusqueda = $_POST['terminoBusqueda'];
|
||||
|
||||
$terminoBusqueda = eliminar_tildes(strtolower($terminoBusqueda));
|
||||
|
||||
$separador = "/_/";
|
||||
$nombre_archivo = "listado_reservas.txt";
|
||||
$archivo = fopen($nombre_archivo, 'r');
|
||||
|
||||
$registros = [];
|
||||
while (($linea = fgets($archivo)) !== false) {
|
||||
if (strpos(eliminar_tildes(strtolower($linea)), $terminoBusqueda) !== false) {
|
||||
$registros[] = $linea;
|
||||
}
|
||||
}
|
||||
fclose($archivo);
|
||||
|
||||
echo "<table>
|
||||
<tbody>
|
||||
<thead>
|
||||
<th>Id Usuario</th>
|
||||
<th>Nombre</th>
|
||||
<th>Email</th>
|
||||
<th>Nº Telefono</th>
|
||||
<th>Fecha de entrada</th>
|
||||
<th>Fecha de salida</th>
|
||||
<th>Fecha de registro</th>
|
||||
<th>Nº de noches</th>
|
||||
<th>Acciones</th>
|
||||
</thead>";
|
||||
foreach ($registros as $registro) {
|
||||
$campos = explode("/_/", $registro);
|
||||
echo "<tr>";
|
||||
foreach ($campos as $campo) {
|
||||
echo "<td> $campo </td>";
|
||||
}
|
||||
|
||||
echo "<td><form action=\"./eliminar_registro.php\" method=\"POST\">
|
||||
<input type=\"hidden\" name=\"idRegistro\" value=\"$campos[0]\">
|
||||
<input type=\"submit\" value=\"Eliminar\">
|
||||
</form></td>";
|
||||
|
||||
echo "</tr>";
|
||||
}
|
||||
|
||||
echo "</tbody>";
|
||||
echo "</table>";
|
||||
}
|
||||
?>
|
||||
|
||||
<form action="./eliminar_registro.php" method="POST">
|
||||
<h2>Eliminacion de registro</h2>
|
||||
<input type="text" name="idRegistro" id="idRegistro">
|
||||
<input type="submit" value="Eliminar" required>
|
||||
<br>
|
||||
</form>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user