<?php
    session_start();
    include 'get_mac.php';
    //print_r($_SESSION);
    if (isset($_SESSION['id'])) header("Location: produtos.php");
?>
<!DOCTYPE html>
<html lang="pt-BR" data-bs-theme="auto">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="Controle de estoque">
        <meta name="author" content="Jadiel Sousa, OnTop Sistemas">
        <meta name="generator" content="VSCode">    
        <title>WContagem - OnTop Sistemas</title>
        <link href="assets/css/bootstrap.min.css" rel="stylesheet">
        <link href="assets/css/index.css" rel="stylesheet">
        <link href="assets/icons/font/bootstrap-icons.css" rel="stylesheet">
    </head>
    <body class="bg-success bg-gradient">
        <main class="form w-100 m-auto text-center ">
            <div class="card bg-white">
                <div class="card-body">    
                    <form action="login.php" method="post">
                        <img class="mb-4" src="assets/img/ontop_logo_peq.png" alt="" > <!--height="57"-->
                        <h1 class="h3 mb-3 fw-normal">Acesso ao sistema</h1>
                        <div class="form-floating">
                            <input type="text" class="form-control" id="uname" name="uname" placeholder="Marcos" >
                            <label for="uname">Usuário</label>
                        </div>
                        <div class="form-floating">
                            <input type="password" class="form-control" id="upasswd" name="upasswd" placeholder="123" >
                            <label for="upasswd">Senha</label>
                        </div>  
                        <button class="mt-2 w-100 btn btn-lg btn-success" type="submit"><i class="bi-person"></i>    Acessar</button>
                    </form>
                     
                </div>
                <div class="card-footer">
                    <div class="row">
                    <p><i class="bi-pci-card"></i>        <?php echo get_mac(); ?><br>&copy; <script>document.write(new Date().getFullYear())</script> OnTop Sistemas.</p>
                    </div>
                </div>
            </div>
        </main>
        
        <script src="assets/js/sweetalert2.all.js"></script>
        <?php 
            if (isset($_SESSION['error'])) { ?>
                <script type="text/javascript">
                    Swal.fire('Oops! Algo deu errado!', '<?php echo $_SESSION['msg']; ?>', 'error');
                </script>
            <?php 
                unset($_SESSION['error']);
                unset($_SESSION['msg']);
        } ?>
        </script>
    </body>
</html>