sesiones
This commit is contained in:
@@ -0,0 +1,77 @@
|
||||
<!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>Perfil de cliente</title>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<?php
|
||||
$nombre_usuario = $_SESSION['nombre'];
|
||||
$tipo_usuario = $_SESSION['tipo'];
|
||||
$email_usuario = $_SESSION['email'];
|
||||
echo "<div>
|
||||
<h2>Bienvenido $nombre_usuario </h2>
|
||||
<a href=\"logout.php\">Cerrar session</a>
|
||||
</div> <br>";
|
||||
busqueda($email_usuario);
|
||||
|
||||
echo "<div>
|
||||
<a href=\"formulario_hotel.php\">Registrar reserva</a>
|
||||
</div>";
|
||||
|
||||
|
||||
|
||||
function busqueda($termBusqueda)
|
||||
{
|
||||
include_once('caracteres.php');
|
||||
$termBusqueda = eliminar_tildes(strtolower($termBusqueda));
|
||||
$nombre_archivo = "listado_reservas.txt";
|
||||
$registros = [];
|
||||
|
||||
|
||||
$archivo = file_exists($nombre_archivo) ? fopen($nombre_archivo, 'r') : false;
|
||||
if ($archivo !== false) {
|
||||
while (($linea = fgets($archivo)) !== false) {
|
||||
if (strpos(eliminar_tildes(strtolower($linea)), $termBusqueda) !== false) {
|
||||
$registros[] = $linea;
|
||||
}
|
||||
}
|
||||
fclose($archivo);
|
||||
}
|
||||
|
||||
if (count($registros) > 0) {
|
||||
echo "<table>
|
||||
<tbody>
|
||||
<thead>
|
||||
<th>Id Reserva</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>
|
||||
</thead>";
|
||||
foreach ($registros as $registro) {
|
||||
$campos = explode("/_/", $registro);
|
||||
echo "<tr>";
|
||||
foreach ($campos as $campo) {
|
||||
echo "<td> $campo </td>";
|
||||
}
|
||||
echo "</tr>";
|
||||
}
|
||||
echo "</tbody>";
|
||||
echo "</table>";
|
||||
} else {
|
||||
echo "<div><h4> No se han encontrado registros con los terminos indicados </h4></div>";
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
Reference in New Issue
Block a user