intranet-apei/admin/gestionUser.php

20 lines
766 B
PHP
Raw Permalink Normal View History

<?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']));
}
2026-03-12 13:10:45 +00:00
if (isset($_POST['site']) && $_POST["site"] != "") {
updateUserSite($bdd, $_POST["username"], $_POST["site"]);
}
2026-03-12 13:10:45 +00:00
if (!empty($_POST['permissions'])) {
updateUserPermissions($bdd, $_POST['username'], $_POST['permissions']);
}
2026-03-12 13:10:45 +00:00
header('location: admin.php');
} else {
die('L\'utilisateur n\'existe pas...');
}