<!DOCTYPE html>
<html lang="sv">
<head>
    <meta charset="UTF-8">
    <title>Logga In</title>
    <meta name="viewport" content="initial-scale=1, viewport-fit=cover, user-scalable=no, width = device-width">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black-translucent">
    <link rel="manifest" href="manifest.json">
    <link rel="stylesheet" href="style.css">
</head>
<script>
    
</script>
<body>
    <div class="container">
        <div class="info-box">
            Du kan bara logga in om du redan har ett konto</a>
        </div>
        <h1>Logga In</h1>
        <?php if (isset($error)): ?>
            <p class="error"><?php echo $error; ?></p>
        <?php endif; ?>
        <?php if (isset($existing_user)): ?>
            <p>Mer än en användare är inloggad. Vill du logga ut alla andra och logga in som <?php echo htmlspecialchars($login_username); ?>?</p>
            <form method="POST">
                <input type="hidden" name="username" value="<?php echo htmlspecialchars($login_username); ?>">
                <input type="hidden" name="password" value="<?php echo htmlspecialchars($login_password); ?>">
                <button type="submit" name="logout_others">Logga ut alla andra och logga in</button>
            </form>
        <?php else: ?>
            <form method="POST">
                <input type="text" name="username" placeholder="Användarnamn" required>
                <input type="password" name="password" placeholder="Lösenord" required>
                <button type="submit">Logga In</button>
            </form>
        <?php endif; ?>
    </div>

</body>
</html>