forked from space192/PiscineWeb22
-
Notifications
You must be signed in to change notification settings - Fork 0
/
queryAdmin.php
executable file
·50 lines (46 loc) · 1.26 KB
/
queryAdmin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
include_once 'const.php';
function getUsers()
{
global $mysqlConnection;
$memberStatement = $mysqlConnection->prepare("SELECT ID,Prenom,Nom,Mail FROM utilisateur WHERE ADMIN IS NULL;");
$memberStatement->execute();
return $memberStatement->fetchAll();
}
function getMed()
{
global $mysqlConnection;
$memberStatement = $mysqlConnection->prepare("SELECT ID,Prenom,Nom FROM Medecin;");
$memberStatement->execute();
return $memberStatement->fetchAll();
}
function supprM()
{
global $mysqlConnection;
$stmt= $mysqlConnection->prepare("DELETE FROM Medecin WHERE ID=?;");
$stmt->execute([$_POST["ID"]]);
}
function AddA()
{
global $mysqlConnection;
$stmt= $mysqlConnection->prepare("UPDATE utilisateur SET ADMIN = '1' WHERE ID=?;");
$stmt->execute([$_POST["ID"]]);
}
if(isset($_POST["query"]) && isset($_POST["ID"]))
{
switch($_POST["query"])
{
case 1: supprM(); break; //supprimer un medecin
case 2: AddA(); break; //Ajouter un Admin
}
header('Location: Account.php');
die;
}
function getSpe()
{
global $mysqlConnection;
$memberStatement = $mysqlConnection->prepare("SELECT ID_spe, Nom_spe FROM Specialite;");
$memberStatement->execute();
return $memberStatement->fetchAll();
}
?>