<?php
include('includes/header.php');

if (isset($_POST['add_user'])) {
    $u = sanitize($_POST['username']);
    $p = sanitize($_POST['password']);

    if ($u && $p) {
        $db->query("
            INSERT OR REPLACE INTO extra_accounts
            (username, password, status, expiry)
            VALUES
            ('$u', '$p', 'Active', '')
        ");
        echo "<div class='alert alert-success'>App user created</div>";
    }
}
?>

<form method="post">
    <input name="username" placeholder="App username" required>
    <input name="password" placeholder="App password" required>
    <button name="add_user">Create App User</button>
</form>
