<?php
if (isset($_POST["username"]) && isset($_POST["password"])) {
    if (!check_username($_POST["username"])) {
        $passhash = password_hash($_POST["password"], PASSWORD_BCRYPT, ["cost" => 14]);
        $success = create_account($_POST["username"], $passhash);
        $_POST["password"] = null;
        if ($success) {
            echo "Account created";
        } else {
            echo "An error occurred, you can try again in a moment.";
        }
    } else {
        $_POST["password"] = null;
        echo "Account alredy exists.";
    }
}
?>
<h3>Skapa konto</h3>
<form method="post" action="?page=admin&amp;subpage=create">
    <input type="text" name="username" placeholder="Användarnamn">
    <input type="password" name="password" placeholder="Lösenord">
    <input type="submit" value="Skapa">
</form>
