2021-01-22 21:58:46 +01:00
|
|
|
<?php require "../top.inc.php"; ?>
|
|
|
|
|
2021-01-23 17:26:46 +01:00
|
|
|
<form method="post">
|
2021-01-22 21:58:46 +01:00
|
|
|
<label for="username">Identifiant</label><br>
|
2021-01-23 17:26:46 +01:00
|
|
|
<input id="username" pattern="[a-z]{4,32}" required="" name="username" type="text" placeholder="proudhon"><span></span><br>
|
2021-01-22 21:58:46 +01:00
|
|
|
|
|
|
|
<label for="password">Mot de passe</label><br>
|
2021-01-23 17:26:46 +01:00
|
|
|
<input id="password" pattern=".{10,1024}" required="" name="password" type="password" placeholder="************"><span></span><br>
|
2021-01-22 21:58:46 +01:00
|
|
|
|
2021-01-23 17:26:46 +01:00
|
|
|
<input type="submit">
|
2021-01-22 21:58:46 +01:00
|
|
|
</form>
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
|
|
|
if (isset($_POST['username']) AND isset($_POST['password'])) {
|
|
|
|
$username = $_POST['username'];
|
|
|
|
$password = password_hash($_POST['password'], PASSWORD_DEFAULT);
|
|
|
|
|
|
|
|
$db = new PDO('sqlite:' . $dbPath);
|
|
|
|
|
|
|
|
$stmt = $db->prepare("INSERT INTO users(username, password) VALUES(:username, :password)");
|
|
|
|
|
|
|
|
$stmt->bindParam(':username', $username);
|
|
|
|
$stmt->bindParam(':password', $password);
|
|
|
|
|
|
|
|
$stmt->execute();
|
|
|
|
|
|
|
|
// Setup SFTP access for Hypertext
|
|
|
|
exec("sudo /root/maniver/target/debug/maniver setup-user " . $_POST['username'] . " " . $_POST['password']);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "Liste des utilisateurices<br>";
|
|
|
|
|
|
|
|
$db = new PDO('sqlite:' . $dbPath);
|
|
|
|
|
|
|
|
$result = $db->query('SELECT * FROM users');
|
|
|
|
|
|
|
|
foreach ($result as $result) {
|
|
|
|
print $result['id'];
|
|
|
|
echo " - ";
|
|
|
|
print $result['username'];
|
|
|
|
echo "<br>";
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
<?php require "../bottom.inc.php"; ?>
|