|
|
|
@ -17,13 +17,11 @@ class ControllerUserPlayers
|
|
|
|
|
{
|
|
|
|
|
global $vues, $twig;
|
|
|
|
|
session_start();
|
|
|
|
|
$this->mdPlayer = new ModelPlayer();
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
if($_SESSION["idPlayerConnected"] != null){
|
|
|
|
|
$this->twig =$twig;
|
|
|
|
|
$this->vues = $vues;
|
|
|
|
|
|
|
|
|
|
$this->mdPlayer = new ModelPlayer();
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
header("Location:/loginPlayer");
|
|
|
|
@ -37,11 +35,11 @@ class ControllerUserPlayers
|
|
|
|
|
|
|
|
|
|
function delete($param) {
|
|
|
|
|
$this->mdPlayer->deletePlayerByID($param["id"]);
|
|
|
|
|
header("Location:/admin/administrators");
|
|
|
|
|
$_SESSION["idPlayerConnected"]=null;
|
|
|
|
|
header("Location:/");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function add($param) {
|
|
|
|
|
|
|
|
|
|
public function add($param) {
|
|
|
|
|
$nickname = $_POST['nickname'];
|
|
|
|
|
$password = $_POST['password'];
|
|
|
|
|
|
|
|
|
@ -50,6 +48,8 @@ class ControllerUserPlayers
|
|
|
|
|
'password' => $password,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
var_dump($Player);
|
|
|
|
|
|
|
|
|
|
$this->mdPlayer->addPlayer($Player);
|
|
|
|
|
|
|
|
|
|
header("Location:/loginPlayer");
|
|
|
|
@ -58,25 +58,21 @@ class ControllerUserPlayers
|
|
|
|
|
function updatemodal($param) {
|
|
|
|
|
|
|
|
|
|
$player = $this->mdPlayer->getPlayerByID($param["id"]);
|
|
|
|
|
|
|
|
|
|
echo $this->twig->render($this->vues["adminAdministratorsModal"], [
|
|
|
|
|
echo $this->twig->render($this->vues["userPlayerModal"], [
|
|
|
|
|
'player' => $player,
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function update($param) {
|
|
|
|
|
|
|
|
|
|
$id = $_POST['id'];
|
|
|
|
|
$username = $_POST['username'];
|
|
|
|
|
$password = $_POST['password'];
|
|
|
|
|
|
|
|
|
|
$Admin = [
|
|
|
|
|
'username' => $username,
|
|
|
|
|
'password' => $password,
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
$this->mdPlayer->updatePlayer($id,$Admin);
|
|
|
|
|
|
|
|
|
|
header("Location:/admin/administrators");
|
|
|
|
|
if (!isset($password) || empty($password) || !isset($id) || empty($id) || !is_numeric($id) || $id < 0 || empty(trim($password)) || empty(trim($id))) {
|
|
|
|
|
$_SESSION["error"] = "Veuillez remplir tous les champs correctement";
|
|
|
|
|
var_dump($id,$password);
|
|
|
|
|
header("Location:/userStatus");
|
|
|
|
|
} else {
|
|
|
|
|
$this->mdPlayer->updatePlayerPassword($id,$password);
|
|
|
|
|
header("Location:/userStatus");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|