Commit acc8777f33990f508a571e61c47135ac50651a02
1 parent
2e79fa12
api/utilisateur/liste
Showing
1 changed file
with
25 additions
and
0 deletions
Show diff stats
@@ -0,0 +1,25 @@ | @@ -0,0 +1,25 @@ | ||
1 | +<?php | ||
2 | + | ||
3 | +require_once("../commun.php"); | ||
4 | + | ||
5 | +verifierDroit(2); | ||
6 | + | ||
7 | +$requete = $db->prepare("SELECT idCarte, solde, decouvert FROM Clients"); | ||
8 | +if (!$requete->execute()) { | ||
9 | + retour("erreur_bdd", ["message" => $requete->error]); | ||
10 | +} | ||
11 | +$requete->bind_result($idCarte, $solde, $decouvert); | ||
12 | +$clients = []; | ||
13 | +while ($requete->fetch()) { | ||
14 | + $client = ["idCarte" => $idCarte, "solde" => $solde]; | ||
15 | + if ($droit >= 3) { | ||
16 | + $client["decouvert"] = !!$decouvert; | ||
17 | + } | ||
18 | + $clients[] = $client; | ||
19 | +} | ||
20 | +$requete->close(); | ||
21 | + | ||
22 | + | ||
23 | +retour("ok", ["clients" => $clients]); | ||
24 | + | ||
25 | +?> |