<?php
require "../main.php";

$mcServ = new mcServ();

if (isset($_GET["action"])) {
    if ($_GET["action"] == "logout") {
        setcookie("username", "", time() - 3600, "/");
        setcookie("session_id", "", time() - 3600, "/");
        setcookie("device_id", "", time() - 3600, "/");
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>mcServ // Login</title>
    <link rel="stylesheet" type="text/css" href="css/login.css">
</head>
<body>
    <div class="page-content" id="block">
        <div class="header">
            <h1>mcServControl</h1>
            <h2>Login</h2>
        </div>
        <div class="content">
            <form action="/api/login/getcookies.php" method="post">
                <div class="page">
                    <a href="/resetpasswd.php">Forget Passwort?</a>

                    <?php
                    if (isset($_GET["passwdIsFalse"])) { 
                        echo '<p class="message_red">Invalid username or password</p>';
                    }
                    ?>

                    <input type="text" name="username" placeholder="Username" id="user" required><br><br>
                    <input type="password" name="passwd" placeholder="Password" id="passwd" required><br><br>

                    <button type="submit">Login</button>
                </div>
            </form>
        </div>
    </div>
</body>
</html>