<?php
session_start();

// Verifica si el usuario ya está logueado
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
    header("Location: dashboard.php");
    exit;
}
?>

<!DOCTYPE html>
<html lang="en">
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>LOGIN</title>
    <link rel="shortcut icon" href="img/diamond.png" type="image/x-icon">
    <link rel="stylesheet" href="css/style.css">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
   <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.0/css/all.min.css">
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/sweetalert2@11/dist/sweetalert2.min.css">
</head>

<body>
    <div class="login-div">
        <p>DIAMOND<span></span></p>
        <div class="card rounded-3 card-outline card-primary shadow">
            <div class="card-body login-card-body">
                
                <p>Introduzca sus datos de acceso</p>
                <form id="LoginForm">
                    <div class="input-group mb-3">
                        <input type="text" class="form-control rounded-l" id="user" name="nombre" placeholder="Nombre de usuario" aria-label="Username" aria-describedby="span-user" autofocus="autofocus">
                        <span class="input-group-text" id="span-user"><i class="fa-solid fa-user"></i></span>
                    </div>
                    <div class="input-group mb-3">
                        <input type="password" class="form-control" id="password" name="password" placeholder="Contraseña" aria-label="password" aria-describedby="span-password" autocomplete="off">
                        <span class="input-group-text" id="span-password"><i class="fa-solid fa-key" aria-hidden="true"></i></span>
                    </div>
                    <div class="row">
                        <div class="col">
                            <button type="submit" class="btn btn-outline-success btn-block fw-bold text-center" id="btnLogin"><i class="fa-solid fa-circle-arrow-right" aria-hidden="true"></i> LOGIN</button>
                        </div>
                    </div>
                </form>
            </div>
        </div>
        <div class="footer-login mt-5">
            <p>Diamond <span>| <?php echo date('Y') ?></span></p>
        </div>
    </div>
    <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
    <script src="js/session.js"></script>
</body>

</html>