Commit 6225059a8a7c6a8419c0062a52f9b59b3b37912f

Authored by Geoffrey PREUD'HOMME
1 parent b28bb0b4

api/client/decouvert

Showing 1 changed file with 29 additions and 0 deletions   Show diff stats
api/client/decouvert.php 0 → 100644
@@ -0,0 +1,29 @@ @@ -0,0 +1,29 @@
  1 +<?php
  2 +
  3 +require_once("../commun.php");
  4 +
  5 +verifierDroit(3);
  6 +
  7 +if (!(donne("idCarte") && donne("decouvert"))) {
  8 + retour("requete_malformee");
  9 +}
  10 +
  11 +if (!clientExiste(donne("idCarte"))) {
  12 + retour("client_inconnu");
  13 +}
  14 +
  15 +$decouvert = ($_POST['decouvert'] == 'true' || $_POST['decouvert'] == 1) ? 1 : 0;
  16 +
  17 +$requete = $db->prepare("UPDATE Clients SET decouvert=? WHERE idCarte=?");
  18 +if (!$requete) {
  19 + retour("erreur_bdd_preparee", ["message" => $db->error]);
  20 +}
  21 +$requete->bind_param("ss", $decouvert, $_POST["idCarte"]);
  22 +if (!$requete->execute()) {
  23 + retour("erreur_bdd", ["message" => $requete->error]);
  24 +}
  25 +$requete->close();
  26 +
  27 +retour("ok");
  28 +
  29 +?>