19 lines
766 B
PHP
19 lines
766 B
PHP
<?php
|
|
include("../Assets/functions.php");
|
|
$config = json_decode(file_get_contents("../Assets/config.json"), true);
|
|
$bdd = connectBDD("localhost", $config["BDD_USER"], $config["BDD_PASSWD"], $config["BDD_NAME"]);
|
|
|
|
if (userExists($bdd, $_POST['username'])) {
|
|
if (isset($_POST['password']) && !empty($_POST["password"])) {
|
|
updateUserPassword($bdd, $_POST['username'], hash('sha256', $_POST['password']));
|
|
}
|
|
if (isset($_POST['site']) && $_POST["site"] != "") {
|
|
updateUserSite($bdd, $_POST["username"], $_POST["site"]);
|
|
}
|
|
if (!empty($_POST['permissions'])) {
|
|
updateUserPermissions($bdd, $_POST['username'], $_POST['permissions']);
|
|
}
|
|
header('location: admin.php');
|
|
} else {
|
|
die('L\'utilisateur n\'existe pas...');
|
|
}
|