aqui estan los codigos
login.php
<?php
session_start();
?>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- Bootstrap -->
<link href="css/css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<form name = "miform" action="procesa_login.php" method="POST">
<br />Login:
<br />
<input type="text" name="login">
<br />Password:
<br />
<input type="password" name="pass">
<br />
<br />
<input class="boton" type="submit" value="Entrar">
</form>
<p><a href="formulario.php" class="btn btn-lg btn-primary btn-block">Registrase en el Sistema</a></p>
</body>
</html>
procesa_login.php
<?php
session_start();
include 'config.php';
$link=Conectarse();
$login = $_POST['login'];
$pass = $_POST['pass'];
$pass=sha1(md5($pass));
$query = sprintf("SELECT usuarios.id,
usuarios.login,
usuarios.nombre,
usuarios.email,
usuarios.nivel
FROM usuarios WHERE usuarios.login='%s'&& usuarios.password = '%s'", $login, $pass);
$result=mysql_query($query,$link);
if(mysql_num_rows($result)){
$array=mysql_fetch_array($result);
$_SESSION["id_usuario"]= $array["id"];
$_SESSION["login"]= $array["login"];
$_SESSION["nombre"]= $array["nombre"];
$_SESSION["email"]= $array["email"];
$_SESSION["nivel"]= $array["nivel"];
header("Location:verifica.php");
} else {
echo "<h2>Login o Password Incorrectos</h2>";
echo "<br>";
echo "<a class='btn btn-primary btn-large btn-bloc' href='login.php' >Volver a intentar</a>";
}
?>
verifica.php
<?php
session_start();
?>
<?php
if($_SESSION["nivel"] == "AD"){
header("Location:admin.php");
} else {
header("Location:usuario.php");
}
?>
<p><a href="logout.php">Cerrar Sesión</a></p>
</body>
</html>
crea_usuarios.php
<?php
session_start();
include 'config.php';
$link=Conectarse();
$login = $_POST['login'];
$pass = $_POST['pass'];
$pass=sha1(md5($pass));
$query = sprintf("SELECT usuarios.id,
usuarios.login,
usuarios.nombre,
usuarios.email,
usuarios.nivel
FROM usuarios WHERE usuarios.login='%s'&& usuarios.password = '%s'", $login, $pass);
$result=mysql_query($query,$link);
if(mysql_num_rows($result)){
$array=mysql_fetch_array($result);
$_SESSION["id_usuario"]= $array["id"];
$_SESSION["login"]= $array["login"];
$_SESSION["nombre"]= $array["nombre"];
$_SESSION["email"]= $array["email"];
$_SESSION["nivel"]= $array["nivel"];
header("Location:verifica.php");
} else {
echo "<h2>Login o Password Incorrectos</h2>";
echo "<br>";
echo "<a class='btn btn-primary btn-large btn-bloc' href='login.php' >Volver a intental</a>";
}
?>
reservauser.php
<?php
session_start();
?>
<head>
<div style = "text-align:right;"><p><a href="logout.php" class = "btn btn-success">Cerrar Sesión</a></p></div>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $_SESSION["email"];?></title>
</head>
<?php
require_once('coneccion.php');
$sql = "SELECT b.name, u.email, b.time, b.date, b.comfort, b.adults, b.children, o.origen, d.destino FROM usuarios u join bookingfrom b on u.nombre=b.name join origen o on b.from=o.id join destino d on b.to=d.id where u.nombre=b.name";
$result = mysqli_query($con, $sql);
?>
<h3 class="t_list">LISTA </h3>
<table id="data-list" class="table table-striped">
<thead>
<tr><th>Name</th><th>Email</th><th>From</th><th>To</th><th>Time</th><th>Date</th><th>Comfort</th><th>Adults</th><th>Children</th></tr>
</thead>
<tbody>
<?php
while($row = mysqli_fetch_array($result, MYSQL_ASSOC)) {
echo "<tr>
<td>" . $row['name'] . "</td>
<td>" . $row['email'] . "</td>
<td>" . $row['origen'] . "</td>
<td>" . $row['destino'] . "</td>
<td>" . $row['time'] . "</td>
<td>" . $row['date'] . "</td>
<td>" . $row['comfort'] . "</td>
<td>" . $row['adults'] . "</td>
<td>" . $row['children'] . "</td>
</tr>";
}
?>
</tbody>
</table>
aca en reservauser.php es donde hago mi select para que se ve la reserva del user logueado. muchas gracias por sus ayudas.