intranet-apei/admin/gestionUser.php

19 lines
736 B
PHP
Raw 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']));
}
if(isset($_POST['site']) && $_POST["site"] != ""){
updateUserSite($bdd, $_POST["username"], $_POST["site"]);
}
if($_POST['permissions'] != "Sélectionner"){
updateUserPermissions($bdd, $_POST['username'], $_POST['permissions']);
}
}else{
die('L\'utilisateur n\'existe pas...');
}