From aaa94177ab5751c1328571f4b9cc8d8d2d127345 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 01:27:37 +0000 Subject: [PATCH 001/129] a --- Contestation/Assure.php | 16 ++++++++++++++++ Contestation/Demandereconnaissancefaciale.php | 6 ++++++ Contestation/verify_facial_api.php | 13 +++++++++---- 3 files changed, 31 insertions(+), 4 deletions(-) diff --git a/Contestation/Assure.php b/Contestation/Assure.php index 9f540ad..61361d3 100755 --- a/Contestation/Assure.php +++ b/Contestation/Assure.php @@ -94,7 +94,23 @@ class Assure extends Modelecontestation { return $ligne; } + public function get_nbTentativeBiometrie($codeSociete) + { + $sql = 'select nbTentativeBiometrie FROM societeuser WHERE (codeSociete=?);'; + + $resultat = $this->executerRequete($sql, array($codeSociete))->fetch(PDO::FETCH_ASSOC); + + return $resultat['nbTentativeBiometrie']; + } + public function get_parametres_scosiete($codeSociete) + { + $sql = 'select dureeTokenReconnaissanceFaciale, dossierPhoto, nbTentativeBiometrie FROM societeuser WHERE (codeSociete=?);'; + + $resultat = $this->executerRequete($sql, array($codeSociete))->fetch(PDO::FETCH_ASSOC); + + return $resultat; + } } ?> \ No newline at end of file diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index f35211e..2410b64 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -169,6 +169,12 @@ : "Paramètres vérifiés avec succès!"; afficherMessage("$message", false); */ + + $param_societe = $assure->get_parametres_scosiete($codeSociete); + + var_dump($param_societe); + exit; + } function afficherMessage($message) { diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 63d5911..6ac7237 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -5,15 +5,20 @@ */ header('Content-Type: application/json'); -require_once 'config.php'; -require_once 'database.php'; +// require_once 'config.php'; +// require_once 'database.php'; +require_once "Assure.php"; + class FacialVerificationAPI { - private $db; + // private $db; + private $assure_api; private $maxAttempts = 3; public function __construct($db) { - $this->db = $db; + // $this->db = $db; + $assure_api = new Assure(); + $maxAttempts = get_nbTentativeBiometrie($_SESSION['codeEntite']); } /** From 5dc7833b19e35754551018fded109d4d5972d0bf Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 01:34:41 +0000 Subject: [PATCH 002/129] a --- Contestation/Demandereconnaissancefaciale.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 2410b64..f079f1a 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -171,10 +171,10 @@ */ $param_societe = $assure->get_parametres_scosiete($codeSociete); - - var_dump($param_societe); - exit; + $_SESSION['dureeToken'] = $param_societe["dureeTokenReconnaissanceFaciale"]; + $_SESSION['dossierPhoto'] = $param_societe["dossierPhoto"]; + $_SESSION['nbTentative'] = $param_societe["nbTentativeBiometrie"]; } function afficherMessage($message) { @@ -554,7 +554,7 @@ verificationToken = urlParams.get('idDemande'); codeEntite = urlParams.get('codeEntite'); idBeneficiaire = urlParams.get('idBeneficiaire'); - alert("codeEntite="+codeEntite+" ; idBeneficiaire="+idBeneficiaire); + alert("codeEntite="+codeEntite+" ; idBeneficiaire="+idBeneficiaire+" ; verificationToken="+verificationToken); // Initialisation window.onload = function() { From 8e127d31e4c866227f3e593ec3c7c9ac44aa82e0 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 01:39:43 +0000 Subject: [PATCH 003/129] a --- Contestation/Assure.php | 14 ++++++++++++++ Contestation/verify_facial_api.php | 7 ++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/Contestation/Assure.php b/Contestation/Assure.php index 61361d3..428adbf 100755 --- a/Contestation/Assure.php +++ b/Contestation/Assure.php @@ -111,6 +111,20 @@ class Assure extends Modelecontestation { return $resultat; } + + public function valider_token() + { + $codeSociete = $_SESSION['codeBdd']; + $codePrestataire = $_SESSION['codePrestataire']; + $idBeneficiaire = $_SESSION['idBeneficiaire']; + $idDemande = $_SESSION['idDemande']; + + $sql = 'call sp_p_demandereconnaissancefaciale_valide(?, ?, ?, ?);'; + $resultat = $this->executerRequete($sql, array($codeSociete, $codePrestataire, $idBeneficiaire, $idDemande)); + $ligne = $resultat->fetch(PDO::FETCH_ASSOC); + return $ligne; + } + } ?> \ No newline at end of file diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 6ac7237..3acd9b0 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -26,6 +26,7 @@ class FacialVerificationAPI { */ public function validateToken($token) { try { + /* $sql = "SELECT vr.*, a.nom, a.prenoms, a.photo_reference_path FROM facial_verification_requests vr JOIN assures a ON vr.assure_id = a.id @@ -36,7 +37,11 @@ class FacialVerificationAPI { $stmt = $this->db->prepare($sql); $stmt->execute([$token]); $request = $stmt->fetch(PDO::FETCH_ASSOC); - + */ + $request = $assure_api->valider_token(); + var_dump(); + exit($request); + if (!$request) { return [ 'success' => false, From 794e89fd9e5982f17ee836a0765227151664ea92 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 01:49:22 +0000 Subject: [PATCH 004/129] a --- Contestation/Demandereconnaissancefaciale.php | 11 +++++------ Contestation/verify_facial_api.php | 3 ++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index f079f1a..174af1f 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -549,13 +549,12 @@ // Récupérer le token depuis l'URL const urlParams = new URLSearchParams(window.location.search); - // alert(urlParams); // verificationToken = urlParams.get('token'); - verificationToken = urlParams.get('idDemande'); - codeEntite = urlParams.get('codeEntite'); - idBeneficiaire = urlParams.get('idBeneficiaire'); - alert("codeEntite="+codeEntite+" ; idBeneficiaire="+idBeneficiaire+" ; verificationToken="+verificationToken); - + // verificationToken = urlParams.get('idDemande'); + verificationToken = ; + + alert("verificationToken = "+verificationToken); + // Initialisation window.onload = function() { if (!verificationToken) { diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 3acd9b0..537cde2 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -15,7 +15,8 @@ class FacialVerificationAPI { private $assure_api; private $maxAttempts = 3; - public function __construct($db) { + // public function __construct($db) { + public function __construct() { // $this->db = $db; $assure_api = new Assure(); $maxAttempts = get_nbTentativeBiometrie($_SESSION['codeEntite']); From 7eaa9b85318cf5d03db0fe8fbdf3c10c40f5216c Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 01:52:42 +0000 Subject: [PATCH 005/129] a --- Contestation/Demandereconnaissancefaciale.php | 4 ++-- Contestation/verify_facial_api.php | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 174af1f..4f3c326 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -550,10 +550,10 @@ // Récupérer le token depuis l'URL const urlParams = new URLSearchParams(window.location.search); // verificationToken = urlParams.get('token'); - // verificationToken = urlParams.get('idDemande'); + verificationToken = ; - alert("verificationToken = "+verificationToken); + // alert("verificationToken = "+verificationToken); // Initialisation window.onload = function() { diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 537cde2..38621db 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -40,8 +40,9 @@ class FacialVerificationAPI { $request = $stmt->fetch(PDO::FETCH_ASSOC); */ $request = $assure_api->valider_token(); + var_dump(); - exit($request); + // exit($request); if (!$request) { return [ @@ -410,8 +411,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $input = json_decode(file_get_contents('php://input'), true); $action = $input['action'] ?? null; - $db = new Database(); - $api = new FacialVerificationAPI($db->getConnection()); + // $api = new FacialVerificationAPI($db->getConnection()); + $api = new FacialVerificationAPI(); switch ($action) { case 'validate_token': From 0596bc786ee9f2498c48d455630ed4141095069c Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:01:30 +0000 Subject: [PATCH 006/129] a --- Contestation/Demandereconnaissancefaciale.php | 3 +- .../Demandereconnaissancefaciale_old.php | 361 ---------- .../Demandereconnaissancefacialeia.php | 673 ------------------ Contestation/verify_facial_api.php | 4 +- 4 files changed, 4 insertions(+), 1037 deletions(-) delete mode 100755 Contestation/Demandereconnaissancefaciale_old.php delete mode 100755 Contestation/Demandereconnaissancefacialeia.php diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 4f3c326..5ef8d32 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -579,6 +579,7 @@ }) .then(response => response.json()) .then(data => { + console.log('Réponse JSON :', data); if (data.success) { showStep('step-instructions'); } else { @@ -586,7 +587,7 @@ } }) .catch(error => { - showError('Erreur de connexion au serveur'); + showError('KANE : Erreur de connexion au serveur'); }); } diff --git a/Contestation/Demandereconnaissancefaciale_old.php b/Contestation/Demandereconnaissancefaciale_old.php deleted file mode 100755 index e7a3a5a..0000000 --- a/Contestation/Demandereconnaissancefaciale_old.php +++ /dev/null @@ -1,361 +0,0 @@ - - - - - - Erreur - - - - - -
-
-
- -
-

Erreur

-

{$message}

-
-
- - "; - exit(); - } - - if (!isset($_GET['lg'])) { - afficherMessage("Paramètre langue absent de la requête!"); - } - - $lg = $_GET['lg']; - $codeLangue = base64_decode($lg); - - $tab_code_langue = ["fr_FR", "en_US"]; - if (!in_array($codeLangue, $tab_code_langue)) { - afficherMessage("Langue inconnue!"); - } - - if (!isset($_GET['codeEntite'])) { - $msg = $codeLangue == 'en_US' ? "Entity parameter missing from query!" : "Paramètre entité absent de la requête!"; - afficherMessage($msg); - } - - if (!isset($_GET['idAdherent'])) { - $msg = $codeLangue == 'en_US' ? "Family parameter missing from query!" : "Paramètre famille absent de la requête!"; - afficherMessage($msg); - } - - if (!isset($_GET['dossier'])) { - $msg = $codeLangue == 'en_US' ? "Entity dossier missing from query!" : "Paramètre dossier absent de la requête!"; - afficherMessage($msg); - } - - $_SESSION['codeLangue'] = $lg; - $_SESSION['codeEntite'] = $_GET['codeEntite']; - $_SESSION['idAdherent'] = $_GET['idAdherent']; - $_SESSION['dossier'] = $_GET['dossier']; - - $codeEntite = $_GET['codeEntite']; - $idAdherent = $_GET['idAdherent']; - $dossier = $_GET['dossier']; - - $title = $codeLangue == 'en_US' ? "Contest a medical record" : "Contester un dossier médical"; - $label = $codeLangue == 'en_US' ? "Submit" : "Soumettre"; - $labelMotifContestation = $codeLangue == 'en_US' ? "Reason for the contestation:" : "Motif de la contestation:"; - $placeholder = $codeLangue == 'en_US' ? "Please describe in detail the reason for your contestation..." : "Veuillez décrire en détail le motif de votre contestation..."; - - $action = "/Contestation/Validercontestation.php?" . - "codeEntite=" . urlencode($codeEntite) . - "&idAdherent=" . urlencode($idAdherent) . - "&dossier=" . urlencode($dossier) . - "&lg=" . urlencode($lg); -?> - - - - - - - <?= htmlspecialchars($title) ?> - - - - - - -
-
-
-

- - -

-
- -
- -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
- 0/1000 -
-
- - -
-
-
-
- - - - - - \ No newline at end of file diff --git a/Contestation/Demandereconnaissancefacialeia.php b/Contestation/Demandereconnaissancefacialeia.php deleted file mode 100755 index 7961815..0000000 --- a/Contestation/Demandereconnaissancefacialeia.php +++ /dev/null @@ -1,673 +0,0 @@ -geUneBd($codeBdd); - - /* - var_dump( - array( - // "bdd" => $bdd, - "codeSociete" => $codeSociete, - "codePrestataire" => $codePrestataire, - "idBeneficiaire" => $idBeneficiaire, - ) - - ); - */ - - if(!$bdd) { - $message = $codeLangue == 'en_US' ? "Entity not found!" : "Entité introuvable!"; - afficherMessage("$message"); - } - - $_SESSION['BdName'] = $bdd['BdName']; - $_SESSION['BdLogin'] = $bdd['BdLogin']; - $_SESSION['BdMdp'] = $bdd['BdMdp']; - - if($assure->existeligne($codeSociete)) { - $fassureExiste = $assure->assureExiste($codeSociete, $idBeneficiaire); - - if(!$fassureExiste) { - $message = $codeLangue == 'en_US' ? "Insured not found!" : "Assuré introuvable!"; - afficherMessage("$message"); - } - - $demandereconnaissancefaciale = $assure->checkdemandereconnaissancefaciale(); - - var_dump($demandereconnaissancefaciale); - - /* - if(!$feuilleMaladieEncours) { - $message = $codeLangue == 'en_US' ? "Deadline for appeal has passed!" : "Delai de contestation dépassé!"; - afficherMessage("$message"); - } - - $feuilleDejaContestee = $validercontestation->feuilleContestee($codeSociete, $idAdherent, $numeroFeuilleMaladie); - - if($feuilleDejaContestee) { - $message = $codeLangue == 'en_US' ? "File already contested!" : "Dossier déjà contesté!"; - afficherMessage("$message"); - } - - $validercontestation->contester($codeSociete, $idAdherent, $numeroFeuilleMaladie, $motifContestation); - */ - - $message = $codeLangue == 'en_US' - ? "Parameters successfully verified!" - : "Paramètres vérifiés avec succès!"; - afficherMessage("$message", false); - } - - function afficherMessage($message) { - echo " - - - - - Erreur - - - - - -
-
-
- -
-

Erreur

-

{$message}

-
-
- - "; - exit(); - } - -?> - - - - - - - INTER-SANTÉ - Vérification d'identité - - - -
-
-

🏥 INTER-SANTÉ

-

Vérification d'identité sécurisée

-
- -
- -
-
-

Vérification du lien...

-
- - -
-
-

Instructions pour la vérification

-
    -
  • Positionnez votre visage dans l'ovale
  • -
  • Assurez-vous d'être dans un endroit bien éclairé
  • -
  • Regardez directement la caméra
  • -
  • Restez immobile lors de la capture
  • -
  • Retirez lunettes de soleil, casquette ou masque
  • -
-
- -
- - -
-
- - -
-
-
- Positionnez votre visage dans l'ovale -
- -
- - -
-

Confirmez votre photo

- Votre photo - - -
- - -
-
-

- Vérification de votre identité en cours...
- Merci de patienter -

-
- - -
-
-
-

-

-
-
-
- - -
-
-

❌ Erreur

-

-
-
-
-
- - - - diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 38621db..acd191a 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -40,8 +40,8 @@ class FacialVerificationAPI { $request = $stmt->fetch(PDO::FETCH_ASSOC); */ $request = $assure_api->valider_token(); - - var_dump(); + + // var_dump(); // exit($request); if (!$request) { From 7b548ffae4f10c833c7f331e8b481a01efa95c25 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:29:13 +0000 Subject: [PATCH 007/129] a --- Contestation/Demandereconnaissancefaciale.php | 4 +++- Contestation/verify_facial_api.php | 9 +++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 5ef8d32..62d133e 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -50,6 +50,7 @@ require_once "Assure.php"; $assure = new Assure(); + $_SESSION['assure'] = $assure; $_SESSION['codeBdd'] = $codeBdd; $bdd = $assure->geUneBd($codeBdd); @@ -553,7 +554,7 @@ verificationToken = ; - // alert("verificationToken = "+verificationToken); + // alert("verificationToken = "+verificationToken); // Initialisation window.onload = function() { @@ -575,6 +576,7 @@ body: JSON.stringify({ action: 'validate_token', token: verificationToken + $assure }) }) .then(response => response.json()) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index acd191a..044a932 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -18,8 +18,10 @@ class FacialVerificationAPI { // public function __construct($db) { public function __construct() { // $this->db = $db; - $assure_api = new Assure(); - $maxAttempts = get_nbTentativeBiometrie($_SESSION['codeEntite']); + // $assure_api = new Assure(); + $assure_api = $_SESSION['assure']; + $maxAttempts = $assure->get_nbTentativeBiometrie($_SESSION['codeEntite']); + $demande = $assure->checkdemandereconnaissancefaciale_id(); } /** @@ -413,6 +415,9 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // $api = new FacialVerificationAPI($db->getConnection()); $api = new FacialVerificationAPI(); + + var_dump($api); + exit; switch ($action) { case 'validate_token': From 3ab227b39c51a4f93cf109b2be02e7ccc37067f8 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:29:51 +0000 Subject: [PATCH 008/129] a --- Contestation/verify_facial_api.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 044a932..6445cb3 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -417,7 +417,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $api = new FacialVerificationAPI(); var_dump($api); - exit; + // exit; switch ($action) { case 'validate_token': From 8d317204959979d21738a392646b4d6cf85d38ff Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:31:16 +0000 Subject: [PATCH 009/129] a --- Contestation/Demandereconnaissancefaciale.php | 2 +- Contestation/facial_verification.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 62d133e..62200fb 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -472,7 +472,7 @@
-

Vérification du lien...

+

Demande Vérification du lien...

diff --git a/Contestation/facial_verification.php b/Contestation/facial_verification.php index ca9effa..0fd716d 100644 --- a/Contestation/facial_verification.php +++ b/Contestation/facial_verification.php @@ -247,7 +247,7 @@
-

Vérification du lien...

+

facial Vérification du lien...

From 0bfafcd662fe37b2ef754df65c4c003df7c88efe Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:33:20 +0000 Subject: [PATCH 010/129] a --- Contestation/verify_facial_api.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 6445cb3..d0c3a3b 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -43,8 +43,9 @@ class FacialVerificationAPI { */ $request = $assure_api->valider_token(); - // var_dump(); - // exit($request); + var_dump($request); + + // exit(); if (!$request) { return [ @@ -416,7 +417,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { // $api = new FacialVerificationAPI($db->getConnection()); $api = new FacialVerificationAPI(); - var_dump($api); + // var_dump($api); // exit; switch ($action) { From 4e6cffb3aff04fbc346fcf39bea8d34445b6d688 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:35:49 +0000 Subject: [PATCH 011/129] a --- Contestation/Demandereconnaissancefaciale.php | 1 - Contestation/verify_facial_api.php | 21 ++++++++----------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 62200fb..44efe59 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -576,7 +576,6 @@ body: JSON.stringify({ action: 'validate_token', token: verificationToken - $assure }) }) .then(response => response.json()) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index d0c3a3b..80b8328 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -28,19 +28,15 @@ class FacialVerificationAPI { * Valide un token de vérification */ public function validateToken($token) { + + $request = $assure_api->valider_token(); + var_dump($request); + return [ + 'success' => false, + 'message' => 'Test KANE' + ]; + /* try { - /* - $sql = "SELECT vr.*, a.nom, a.prenoms, a.photo_reference_path - FROM facial_verification_requests vr - JOIN assures a ON vr.assure_id = a.id - WHERE vr.verification_token = ? - AND vr.status = 'pending' - AND vr.expires_at > NOW()"; - - $stmt = $this->db->prepare($sql); - $stmt->execute([$token]); - $request = $stmt->fetch(PDO::FETCH_ASSOC); - */ $request = $assure_api->valider_token(); var_dump($request); @@ -70,6 +66,7 @@ class FacialVerificationAPI { 'message' => 'Erreur serveur' ]; } + */ } /** From fb9f03b7f1ddfd21a6d9a10419c41bb3f66f4b94 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:38:33 +0000 Subject: [PATCH 012/129] a --- Contestation/Demandereconnaissancefaciale.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 44efe59..9e73e2e 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -580,6 +580,7 @@ }) .then(response => response.json()) .then(data => { + alert(data) console.log('Réponse JSON :', data); if (data.success) { showStep('step-instructions'); From e3e5f1f5f4cda61060ce211721dca90cf87945b1 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:39:07 +0000 Subject: [PATCH 013/129] a --- Contestation/Demandereconnaissancefaciale.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 9e73e2e..2e6d4f9 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -580,7 +580,7 @@ }) .then(response => response.json()) .then(data => { - alert(data) + alert(data); console.log('Réponse JSON :', data); if (data.success) { showStep('step-instructions'); From aac52a81f4c50906d5cbb3b89a6b69639af3c98d Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:43:54 +0000 Subject: [PATCH 014/129] a --- Contestation/Demandereconnaissancefaciale.php | 3 ++- Contestation/verify_facial_api.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 2e6d4f9..03488f2 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -571,7 +571,8 @@ fetch('verify_facial_api.php', { method: 'POST', headers: { - 'Content-Type': 'application/json', + // 'Content-Type': 'application/json', + 'Content-Type': 'text/html; charset=UTF-8', }, body: JSON.stringify({ action: 'validate_token', diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 80b8328..ef062af 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -4,10 +4,11 @@ * Gère la validation des tokens et la comparaison des visages */ -header('Content-Type: application/json'); +// header('Content-Type: application/json'); +header('Content-Type: text/html; charset=UTF-8'); // require_once 'config.php'; // require_once 'database.php'; -require_once "Assure.php"; +// require_once "Assure.php"; class FacialVerificationAPI { From 2485618ccc5e079714823aab4027534dc0ae6780 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:44:18 +0000 Subject: [PATCH 015/129] a --- Contestation/verify_facial_api.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index ef062af..83705f5 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -21,8 +21,8 @@ class FacialVerificationAPI { // $this->db = $db; // $assure_api = new Assure(); $assure_api = $_SESSION['assure']; - $maxAttempts = $assure->get_nbTentativeBiometrie($_SESSION['codeEntite']); - $demande = $assure->checkdemandereconnaissancefaciale_id(); + $maxAttempts = $assure_api->get_nbTentativeBiometrie($_SESSION['codeEntite']); + $demande = $assure_api->checkdemandereconnaissancefaciale_id(); } /** From d32300193569c6a107a43af65bc4c1aea50e5cf0 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:48:33 +0000 Subject: [PATCH 016/129] a --- Contestation/verify_facial_api.php | 40 +++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 9 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 83705f5..04f02ad 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -22,7 +22,6 @@ class FacialVerificationAPI { // $assure_api = new Assure(); $assure_api = $_SESSION['assure']; $maxAttempts = $assure_api->get_nbTentativeBiometrie($_SESSION['codeEntite']); - $demande = $assure_api->checkdemandereconnaissancefaciale_id(); } /** @@ -30,8 +29,8 @@ class FacialVerificationAPI { */ public function validateToken($token) { - $request = $assure_api->valider_token(); - var_dump($request); + // $request = $assure_api->valider_token(); + // var_dump($request); return [ 'success' => false, 'message' => 'Test KANE' @@ -74,6 +73,8 @@ class FacialVerificationAPI { * Compare deux visages avec l'API de reconnaissance faciale * Utilisez Azure Face API, AWS Rekognition, ou une solution locale */ + + /* private function compareFaces($referenceImagePath, $capturedImageBase64) { // Option 1: Azure Face API (Recommandé) return $this->compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64); @@ -84,10 +85,13 @@ class FacialVerificationAPI { // Option 3: Solution locale avec OpenCV/dlib (avancé) // return $this->compareWithLocalFaceRecognition($referenceImagePath, $capturedImageBase64); } - + */ + /** * Comparaison avec Azure Face API */ + + /* private function compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64) { $endpoint = AZURE_FACE_ENDPOINT; // Ex: https://your-resource.cognitiveservices.azure.com $apiKey = AZURE_FACE_API_KEY; @@ -159,10 +163,13 @@ class FacialVerificationAPI { ]; } } + */ /** * Détecte un visage avec Azure Face API et retourne le faceId */ + + /* private function detectFaceAzure($imageBase64, $endpoint, $apiKey) { $detectUrl = $endpoint . '/face/v1.0/detect?returnFaceId=true'; @@ -191,10 +198,13 @@ class FacialVerificationAPI { return $faces[0]['faceId']; } - + */ + /** * Comparaison avec AWS Rekognition (Alternative) */ + + /* private function compareWithAWSRekognition($referenceImagePath, $capturedImageBase64) { require_once 'vendor/autoload.php'; // AWS SDK @@ -242,10 +252,12 @@ class FacialVerificationAPI { ]; } } - + */ + /** * Enregistre la photo capturée */ + /* private function saveCapturedImage($assureId, $imageBase64) { $uploadDir = 'uploads/facial_verification/'; @@ -261,10 +273,13 @@ class FacialVerificationAPI { return $filename; } - + */ + /** * Met à jour le statut de la vérification */ + + /* private function updateVerificationStatus($token, $status, $matchResult = null, $capturedPhotoPath = null) { $sql = "UPDATE facial_verification_requests SET status = ?, @@ -282,10 +297,13 @@ class FacialVerificationAPI { $token ]); } - + */ + /** * Crée une session d'autorisation pour l'accès aux prestations */ + + /* private function createAuthorizationSession($assureId, $verificationRequestId) { $sessionToken = bin2hex(random_bytes(32)); $expiresAt = date('Y-m-d H:i:s', time() + 3600); // 1 heure @@ -299,10 +317,13 @@ class FacialVerificationAPI { return $sessionToken; } - + */ + /** * Vérifie le visage capturé */ + + /* public function verifyFace($token, $capturedImageBase64) { try { // 1. Récupérer les infos de la demande @@ -405,6 +426,7 @@ class FacialVerificationAPI { ]; } } + */ } // Traiter la requête From d4522746cfc3470eced84ddec8bfe5987ee3a9c1 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:50:19 +0000 Subject: [PATCH 017/129] a --- Contestation/Demandereconnaissancefaciale.php | 3 +-- Contestation/verify_facial_api.php | 9 ++------- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 03488f2..2e6d4f9 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -571,8 +571,7 @@ fetch('verify_facial_api.php', { method: 'POST', headers: { - // 'Content-Type': 'application/json', - 'Content-Type': 'text/html; charset=UTF-8', + 'Content-Type': 'application/json', }, body: JSON.stringify({ action: 'validate_token', diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 04f02ad..852f7d3 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -4,12 +4,9 @@ * Gère la validation des tokens et la comparaison des visages */ -// header('Content-Type: application/json'); -header('Content-Type: text/html; charset=UTF-8'); -// require_once 'config.php'; -// require_once 'database.php'; -// require_once "Assure.php"; +session_start(); +header('Content-Type: application/json'); class FacialVerificationAPI { // private $db; @@ -18,8 +15,6 @@ class FacialVerificationAPI { // public function __construct($db) { public function __construct() { - // $this->db = $db; - // $assure_api = new Assure(); $assure_api = $_SESSION['assure']; $maxAttempts = $assure_api->get_nbTentativeBiometrie($_SESSION['codeEntite']); } From c22f75944fb0fd87d310de25a5756f7117291337 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 02:59:30 +0000 Subject: [PATCH 018/129] a --- Contestation/Demandereconnaissancefaciale.php | 29 +++++++++++++++++++ Contestation/verify_facial_api.php | 2 +- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 2e6d4f9..47b5e0a 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -567,6 +567,7 @@ validateToken(); }; + /* function validateToken() { fetch('verify_facial_api.php', { method: 'POST', @@ -592,6 +593,34 @@ showError('KANE : Erreur de connexion au serveur'); }); } + */ + + function validateToken() { + $.ajax({ + url: 'verify_facial_api.php', + method: 'POST', + contentType: 'application/json', + data: JSON.stringify({ + action: 'validate_token', + token: verificationToken + }), + dataType: 'json', + success: function(data) { + alert("succes => " + data); + console.log('Réponse JSON :', data); + if (data.success) { + showStep('step-instructions'); + } else { + showError(data.message || 'Lien expiré ou invalide'); + } + }, + error: function() { + alert("Error => " + data); + showError('KANE : Erreur de connexion au serveur'); + } + }); + } + function showStep(stepId) { document.querySelectorAll('.step').forEach(step => { diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 852f7d3..ffe27f8 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -1,4 +1,4 @@ - Date: Mon, 23 Feb 2026 03:00:46 +0000 Subject: [PATCH 019/129] a --- Contestation/verify_facial_api.php | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index ffe27f8..2a7ea35 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -1,4 +1,4 @@ -trygetConnection()); $api = new FacialVerificationAPI(); - // var_dump($api); - // exit; - switch ($action) { case 'validate_token': $token = $input['token'] ?? null; From 992ce80f6270efd361e83ab33f80ec7cc352e043 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 03:09:19 +0000 Subject: [PATCH 020/129] a --- Contestation/Demandereconnaissancefaciale.php | 4 + Contestation/jquery-ui.js | 16617 ++++++++++++++++ Contestation/jquery.min.js | 4 + Contestation/jquery.timer.js | 45 + 4 files changed, 16670 insertions(+) create mode 100755 Contestation/jquery-ui.js create mode 100755 Contestation/jquery.min.js create mode 100755 Contestation/jquery.timer.js diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 47b5e0a..c44c95d 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -540,6 +540,10 @@ + + + + + + - + + + + + - - + + + + diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 29ee12c..55449fc 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -25,13 +25,6 @@ class FacialVerificationAPI { * Valide un token de vérification */ public function validateToken($token) { - - /* - $request = $this->assure_api->valider_token(); - var_dump($request); - exit; - */ - try { $request = $this->assure_api->valider_token(); @@ -294,6 +287,10 @@ class FacialVerificationAPI { * Vérifie le visage capturé */ public function verifyFace($token, $capturedImageBase64) { + $request = $this->assure_api->valider_token(); + var_dump($request); + exit; + try { // 1. Récupérer les infos de la demande $sql = "SELECT vr.*, a.photo_reference_path, a.id as assure_id diff --git a/Contestation/verify_facial_api_2026_02_23_08h.php b/Contestation/verify_facial_api_2026_02_23_08h.php new file mode 100644 index 0000000..29ee12c --- /dev/null +++ b/Contestation/verify_facial_api_2026_02_23_08h.php @@ -0,0 +1,433 @@ + false, 'message' => 'Méthode non autorisée']); + exit; +} + +class FacialVerificationAPI { + private $assure_api; + private $maxAttempts = 3; + + public function __construct() { + $this->assure_api = $_SESSION['assure']; + $this->maxAttempts = $this->assure_api + ? $this->assure_api->get_nbTentativeBiometrie($_SESSION['codeEntite']) + : 3; + } + + /** + * Valide un token de vérification + */ + public function validateToken($token) { + + /* + $request = $this->assure_api->valider_token(); + var_dump($request); + exit; + */ + + try { + $request = $this->assure_api->valider_token(); + + if (!$request) { + return [ + 'success' => false, + 'message' => 'Lien expiré ou invalide' + ]; + } + + return [ + 'success' => true, + 'message' => 'Token valide', + 'assure' => [ + 'nom' => $request['nom'], + 'prenoms' => $request['prenoms'] + ] + ]; + + } catch (Exception $e) { + error_log("Erreur validateToken: " . $e->getMessage()); + return [ + 'success' => false, + 'message' => 'Erreur serveur' + ]; + } + } + + /** + * Compare deux visages avec l'API de reconnaissance faciale + * Utilisez Azure Face API, AWS Rekognition, ou une solution locale + */ + private function compareFaces($referenceImagePath, $capturedImageBase64) { + // Option 1: Azure Face API (Recommandé) + return $this->compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64); + + // Option 2: AWS Rekognition + // return $this->compareWithAWSRekognition($referenceImagePath, $capturedImageBase64); + + // Option 3: Solution locale avec OpenCV/dlib (avancé) + // return $this->compareWithLocalFaceRecognition($referenceImagePath, $capturedImageBase64); + } + + /** + * Comparaison avec Azure Face API + */ + private function compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64) { + $endpoint = AZURE_FACE_ENDPOINT; + $apiKey = AZURE_FACE_API_KEY; + + try { + // 1. Détecter le visage dans l'image de référence + $referenceImageData = base64_encode(file_get_contents($referenceImagePath)); + $referenceFaceId = $this->detectFaceAzure($referenceImageData, $endpoint, $apiKey); + + if (!$referenceFaceId) { + return [ + 'match' => false, + 'confidence' => 0, + 'error' => 'Aucun visage détecté dans la photo de référence' + ]; + } + + // 2. Détecter le visage dans l'image capturée + $capturedImageData = explode(',', $capturedImageBase64)[1]; + $capturedFaceId = $this->detectFaceAzure($capturedImageData, $endpoint, $apiKey); + + if (!$capturedFaceId) { + return [ + 'match' => false, + 'confidence' => 0, + 'error' => 'Aucun visage détecté dans votre photo' + ]; + } + + // 3. Comparer les deux visages + $verifyUrl = $endpoint . '/face/v1.0/verify'; + + $data = [ + 'faceId1' => $referenceFaceId, + 'faceId2' => $capturedFaceId + ]; + + $ch = curl_init($verifyUrl); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/json', + 'Ocp-Apim-Subscription-Key: ' . $apiKey + ]); + + $response = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + if ($httpCode !== 200) { + throw new Exception("Azure API error: " . $response); + } + + $result = json_decode($response, true); + + return [ + 'match' => $result['isIdentical'], + 'confidence' => round($result['confidence'] * 100, 2), + 'error' => null + ]; + + } catch (Exception $e) { + error_log("Erreur Azure Face API: " . $e->getMessage()); + return [ + 'match' => false, + 'confidence' => 0, + 'error' => 'Erreur lors de la vérification faciale' + ]; + } + } + + /** + * Détecte un visage avec Azure Face API et retourne le faceId + */ + private function detectFaceAzure($imageBase64, $endpoint, $apiKey) { + $detectUrl = $endpoint . '/face/v1.0/detect?returnFaceId=true'; + + $ch = curl_init($detectUrl); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + curl_setopt($ch, CURLOPT_POST, true); + curl_setopt($ch, CURLOPT_POSTFIELDS, base64_decode($imageBase64)); + curl_setopt($ch, CURLOPT_HTTPHEADER, [ + 'Content-Type: application/octet-stream', + 'Ocp-Apim-Subscription-Key: ' . $apiKey + ]); + + $response = curl_exec($ch); + $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); + curl_close($ch); + + if ($httpCode !== 200) { + return null; + } + + $faces = json_decode($response, true); + + if (empty($faces)) { + return null; + } + + return $faces[0]['faceId']; + } + + /** + * Comparaison avec AWS Rekognition (Alternative) + */ + private function compareWithAWSRekognition($referenceImagePath, $capturedImageBase64) { + require_once 'vendor/autoload.php'; + + try { + $rekognitionClient = new Aws\Rekognition\RekognitionClient([ + 'version' => 'latest', + 'region' => AWS_REGION, + 'credentials' => [ + 'key' => AWS_ACCESS_KEY_ID, + 'secret' => AWS_SECRET_ACCESS_KEY + ] + ]); + + $referenceImageData = file_get_contents($referenceImagePath); + $capturedImageData = base64_decode(explode(',', $capturedImageBase64)[1]); + + $result = $rekognitionClient->compareFaces([ + 'SourceImage' => ['Bytes' => $referenceImageData], + 'TargetImage' => ['Bytes' => $capturedImageData], + 'SimilarityThreshold' => 80 + ]); + + if (empty($result['FaceMatches'])) { + return [ + 'match' => false, + 'confidence' => 0, + 'error' => 'Les visages ne correspondent pas' + ]; + } + + $similarity = $result['FaceMatches'][0]['Similarity']; + + return [ + 'match' => $similarity >= 80, + 'confidence' => round($similarity, 2), + 'error' => null + ]; + + } catch (Exception $e) { + error_log("Erreur AWS Rekognition: " . $e->getMessage()); + return [ + 'match' => false, + 'confidence' => 0, + 'error' => 'Erreur lors de la vérification faciale' + ]; + } + } + + /** + * Enregistre la photo capturée + */ + private function saveCapturedImage($assureId, $imageBase64) { + $uploadDir = 'uploads/facial_verification/'; + + if (!file_exists($uploadDir)) { + mkdir($uploadDir, 0755, true); + } + + $imageData = explode(',', $imageBase64)[1]; + $imageData = base64_decode($imageData); + + $filename = $uploadDir . $assureId . '_' . time() . '.jpg'; + file_put_contents($filename, $imageData); + + return $filename; + } + + /** + * Met à jour le statut de la vérification + */ + private function updateVerificationStatus($token, $status, $matchResult = null, $capturedPhotoPath = null) { + $sql = "UPDATE facial_verification_requests + SET status = ?, + verified_at = NOW(), + match_confidence = ?, + captured_photo_path = ?, + attempts = attempts + 1 + WHERE verification_token = ?"; + + $stmt = $this->db->prepare($sql); + $stmt->execute([ + $status, + $matchResult ? $matchResult['confidence'] : null, + $capturedPhotoPath, + $token + ]); + } + + /** + * Crée une session d'autorisation pour l'accès aux prestations + */ + private function createAuthorizationSession($assureId, $verificationRequestId) { + $sessionToken = bin2hex(random_bytes(32)); + $expiresAt = date('Y-m-d H:i:s', time() + 3600); + + $sql = "INSERT INTO prestation_authorization_sessions + (assure_id, verification_request_id, session_token, expires_at, status) + VALUES (?, ?, ?, ?, 'active')"; + + $stmt = $this->db->prepare($sql); + $stmt->execute([$assureId, $verificationRequestId, $sessionToken, $expiresAt]); + + return $sessionToken; + } + + /** + * Vérifie le visage capturé + */ + public function verifyFace($token, $capturedImageBase64) { + try { + // 1. Récupérer les infos de la demande + $sql = "SELECT vr.*, a.photo_reference_path, a.id as assure_id + FROM facial_verification_requests vr + JOIN assures a ON vr.assure_id = a.id + WHERE vr.verification_token = ? + AND vr.status = 'pending' + AND vr.expires_at > NOW()"; + + $stmt = $this->db->prepare($sql); + $stmt->execute([$token]); + $request = $stmt->fetch(PDO::FETCH_ASSOC); + + if (!$request) { + return [ + 'success' => false, + 'match' => false, + 'message' => 'Demande expirée ou invalide' + ]; + } + + // 2. Vérifier le nombre de tentatives + if ($request['attempts'] >= $this->maxAttempts) { + $this->updateVerificationStatus($token, 'failed'); + return [ + 'success' => false, + 'match' => false, + 'message' => 'Nombre maximum de tentatives atteint' + ]; + } + + // 3. Enregistrer la photo capturée + $capturedPhotoPath = $this->saveCapturedImage($request['assure_id'], $capturedImageBase64); + + // 4. Comparer les visages + $comparisonResult = $this->compareFaces( + $request['photo_reference_path'], + $capturedImageBase64 + ); + + if ($comparisonResult['error']) { + $this->updateVerificationStatus($token, 'error', $comparisonResult, $capturedPhotoPath); + return [ + 'success' => false, + 'match' => false, + 'message' => $comparisonResult['error'], + 'attempts_remaining'=> $this->maxAttempts - ($request['attempts'] + 1) + ]; + } + + // 5. Seuil de confiance minimum (80%) + $confidenceThreshold = 80; + $isMatch = $comparisonResult['match'] && $comparisonResult['confidence'] >= $confidenceThreshold; + + if ($isMatch) { + $this->updateVerificationStatus($token, 'verified', $comparisonResult, $capturedPhotoPath); + $sessionToken = $this->createAuthorizationSession($request['assure_id'], $request['id']); + + return [ + 'success' => true, + 'match' => true, + 'confidence' => $comparisonResult['confidence'], + 'message' => 'Identité vérifiée avec succès', + 'session_token' => $sessionToken, + 'redirect_url' => 'saisie_prestations.php?token=' . $sessionToken + ]; + } else { + $attemptsRemaining = $this->maxAttempts - ($request['attempts'] + 1); + + if ($attemptsRemaining > 0) { + $this->updateVerificationStatus($token, 'pending', $comparisonResult, $capturedPhotoPath); + return [ + 'success' => false, + 'match' => false, + 'confidence' => $comparisonResult['confidence'], + 'message' => 'Votre visage ne correspond pas', + 'attempts_remaining' => $attemptsRemaining + ]; + } else { + $this->updateVerificationStatus($token, 'failed', $comparisonResult, $capturedPhotoPath); + return [ + 'success' => false, + 'match' => false, + 'confidence' => $comparisonResult['confidence'], + 'message' => 'Vérification échouée. Nombre maximum de tentatives atteint.', + 'attempts_remaining' => 0 + ]; + } + } + + } catch (Exception $e) { + error_log("Erreur verifyFace: " . $e->getMessage()); + return [ + 'success' => false, + 'match' => false, + 'message' => 'Erreur lors de la vérification: ' . $e->getMessage() + ]; + } + } +} + +// Traiter la requête +if ($_SERVER['REQUEST_METHOD'] === 'POST') { + $input = json_decode(file_get_contents('php://input'), true); + $action = $input['action'] ?? null; + + $api = new FacialVerificationAPI(); + + switch ($action) { + case 'validate_token': + $token = $input['token'] ?? null; + if (!$token) { + echo json_encode(['success' => false, 'message' => 'Token requis']); + exit; + } + echo json_encode($api->validateToken($token)); + break; + + case 'verify_face': + $token = $input['token'] ?? null; + $image = $input['image'] ?? null; + + if (!$token || !$image) { + echo json_encode(['success' => false, 'message' => 'Token et image requis']); + exit; + } + echo json_encode($api->verifyFace($token, $image)); + break; + + default: + echo json_encode(['success' => false, 'message' => 'Action invalide']); + } +} else { + // echo json_encode(['success' => false, 'message' => 'Méthode non autorisée']); + ob_end_clean(); // ✅ vide le buffer avant d'envoyer le JSON + echo json_encode(['success' => false, 'message' => 'Méthode non autorisée']); +} \ No newline at end of file From 1001ebfd4fefe256618088f8046a2287bc44c709 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 09:13:11 +0000 Subject: [PATCH 056/129] a --- Contestation/Demandereconnaissancefaciale.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index ea38fb1..c24d199 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -692,7 +692,7 @@ function verifyPhoto() { showStep('step-verifying'); $.ajax({ - url: 'verify_facial_api.php', + url: '/Contestation/verify_facial_api.php', method: 'POST', contentType: 'application/json', data: JSON.stringify({ From 91a022a13f982b45f1ffa2e909dd854ad50ace95 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 09:17:14 +0000 Subject: [PATCH 057/129] a --- Contestation/verify_facial_api.php | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 55449fc..84d0953 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -287,22 +287,10 @@ class FacialVerificationAPI { * Vérifie le visage capturé */ public function verifyFace($token, $capturedImageBase64) { - $request = $this->assure_api->valider_token(); - var_dump($request); - exit; - try { // 1. Récupérer les infos de la demande - $sql = "SELECT vr.*, a.photo_reference_path, a.id as assure_id - FROM facial_verification_requests vr - JOIN assures a ON vr.assure_id = a.id - WHERE vr.verification_token = ? - AND vr.status = 'pending' - AND vr.expires_at > NOW()"; - - $stmt = $this->db->prepare($sql); - $stmt->execute([$token]); - $request = $stmt->fetch(PDO::FETCH_ASSOC); + $request = $this->assure_api->valider_token(); + var_dump($request); if (!$request) { return [ From a36d4b948ba6789c7896b387151495d66e11e527 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 09:20:23 +0000 Subject: [PATCH 058/129] a --- Contestation/verify_facial_api.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 84d0953..99b2092 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -290,7 +290,8 @@ class FacialVerificationAPI { try { // 1. Récupérer les infos de la demande $request = $this->assure_api->valider_token(); - var_dump($request); + + // var_dump($request); if (!$request) { return [ From 747e55df399f808951c070a0c6ef373dbccb7021 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 09:21:14 +0000 Subject: [PATCH 059/129] a --- Contestation/verify_facial_api.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 99b2092..925c546 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -301,6 +301,9 @@ class FacialVerificationAPI { ]; } + var_dump($this->maxAttempts); + exit; + // 2. Vérifier le nombre de tentatives if ($request['attempts'] >= $this->maxAttempts) { $this->updateVerificationStatus($token, 'failed'); From b3ff32ce9e5e3ded78d80824b305f8c0cf431292 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 09:23:52 +0000 Subject: [PATCH 060/129] a --- Contestation/verify_facial_api.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 925c546..23cad05 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -301,9 +301,6 @@ class FacialVerificationAPI { ]; } - var_dump($this->maxAttempts); - exit; - // 2. Vérifier le nombre de tentatives if ($request['attempts'] >= $this->maxAttempts) { $this->updateVerificationStatus($token, 'failed'); @@ -317,6 +314,9 @@ class FacialVerificationAPI { // 3. Enregistrer la photo capturée $capturedPhotoPath = $this->saveCapturedImage($request['assure_id'], $capturedImageBase64); + var_dump($capturedPhotoPath); + exit; + // 4. Comparer les visages $comparisonResult = $this->compareFaces( $request['photo_reference_path'], From d07682af9beacd7c420acc9460a2e06ed1863666 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 09:26:23 +0000 Subject: [PATCH 061/129] a --- Contestation/verify_facial_api.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 23cad05..7524ff1 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -274,7 +274,7 @@ class FacialVerificationAPI { $expiresAt = date('Y-m-d H:i:s', time() + 3600); $sql = "INSERT INTO prestation_authorization_sessions - (assure_id, verification_request_id, session_token, expires_at, status) + (idBeneficiaire, verification_request_id, session_token, expires_at, status) VALUES (?, ?, ?, ?, 'active')"; $stmt = $this->db->prepare($sql); @@ -312,7 +312,7 @@ class FacialVerificationAPI { } // 3. Enregistrer la photo capturée - $capturedPhotoPath = $this->saveCapturedImage($request['assure_id'], $capturedImageBase64); + $capturedPhotoPath = $this->saveCapturedImage($request['idBeneficiaire'], $capturedImageBase64); var_dump($capturedPhotoPath); exit; @@ -339,7 +339,7 @@ class FacialVerificationAPI { if ($isMatch) { $this->updateVerificationStatus($token, 'verified', $comparisonResult, $capturedPhotoPath); - $sessionToken = $this->createAuthorizationSession($request['assure_id'], $request['id']); + $sessionToken = $this->createAuthorizationSession($request['idBeneficiaire'], $request['id']); return [ 'success' => true, From 6f5f37f36f8795c81fe76ef5a3414324647cc18a Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 09:54:55 +0000 Subject: [PATCH 062/129] a --- Contestation/verify_facial_api.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 7524ff1..36e6fc9 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -58,6 +58,14 @@ class FacialVerificationAPI { * Utilisez Azure Face API, AWS Rekognition, ou une solution locale */ private function compareFaces($referenceImagePath, $capturedImageBase64) { + var_dump( + array( + "referenceImagePath" => $referenceImagePath, + "capturedImageBase64" => $capturedImageBase64, + ) + ); + exit; + // Option 1: Azure Face API (Recommandé) return $this->compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64); @@ -314,9 +322,6 @@ class FacialVerificationAPI { // 3. Enregistrer la photo capturée $capturedPhotoPath = $this->saveCapturedImage($request['idBeneficiaire'], $capturedImageBase64); - var_dump($capturedPhotoPath); - exit; - // 4. Comparer les visages $comparisonResult = $this->compareFaces( $request['photo_reference_path'], From 506a90c5de19bbe5e01d36981681b80cb72ed1f5 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 23:32:59 +0000 Subject: [PATCH 063/129] a --- Contestation/Assure.php | 7 ++++++- Contestation/Demandereconnaissancefaciale.php | 18 ++++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/Contestation/Assure.php b/Contestation/Assure.php index 5eb1899..3f0beb4 100755 --- a/Contestation/Assure.php +++ b/Contestation/Assure.php @@ -105,7 +105,12 @@ class Assure extends Modelecontestation { public function get_parametres_societe($codeSociete) { - $sql = 'select dureeTokenReconnaissanceFaciale, dossierPhoto, nbTentativeBiometrie FROM societeuser WHERE (codeSociete=?);'; + $sql = 'select + dureeTokenReconnaissanceFaciale, + dossierPhoto, + nbTentativeBiometrie, + lienPhotoFace + FROM societeuser WHERE (codeSociete=?);'; $resultat = $this->executerRequeteAdin($sql, array($codeSociete))->fetch(PDO::FETCH_ASSOC); diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index c24d199..a6ba4a6 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -102,6 +102,8 @@ $beneficiaire = $demande["beneficiaire"]; $prestataire = $demande["prestataire"]; + $lienPhoto = $demande["lienPhoto"]; + // var_dump($demande); /* idDemande @@ -176,6 +178,22 @@ $_SESSION['dureeToken'] = $param_societe["dureeTokenReconnaissanceFaciale"]; $_SESSION['dossierPhoto'] = $param_societe["dossierPhoto"]; $_SESSION['nbTentative'] = $param_societe["nbTentativeBiometrie"]; + $_SESSION['lienPhotoFace'] = $param_societe["lienPhotoFace"]; + + // vérifier que la photo du bénéficiaire existe + if ($_SESSION['lienPhoto']>" ") + { + $photo = $_SESSION['lienPhotoFace'].$_SESSION['lienPhoto']; + if(!file_exists($photo)) + { + $_SESSION['lienPhoto'] = ""; + } + else + { + $_SESSION['photoAssureCrypte'] = decryptImage($photo); + } + } + } function afficherMessage($message) { From 70c89fe4c1fc923055a2b15b66648b7fcd51ed47 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 23:41:24 +0000 Subject: [PATCH 064/129] a --- Contestation/Demandereconnaissancefaciale.php | 24 +++++++++++++++++++ Contestation/verify_facial_api.php | 5 ++-- 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index a6ba4a6..d3e8b25 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -241,6 +241,30 @@ // echo $message; } + // Chiffrer l’image au moment de l’upload (PHP) + function encryptImage($sourcePath, $destPath) + { + $key = base64_decode(trim(file_get_contents('/var/www/keys/inter-sante-photo.key'))); + $plaintext = file_get_contents($sourcePath); + + $iv = openssl_random_pseudo_bytes(16); + $cipher = openssl_encrypt($plaintext, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv); + + file_put_contents($destPath, $iv . $cipher); // concat IV + données + } + + // Déchiffrer pour afficher la photo dans INTER-SANTE + function decryptImage($path) + { + $key = base64_decode(trim(file_get_contents('/var/www/keys/inter-sante-photo.key'))); + $data = file_get_contents($path); + + $iv = substr($data, 0, 16); + $ciphertext = substr($data, 16); + + // return openssl_decrypt($ciphertext, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv); + return base64_encode(openssl_decrypt($ciphertext, 'AES-256-CBC', $key, OPENSSL_RAW_DATA, $iv)); + } ?> diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 36e6fc9..7e2e632 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -62,15 +62,16 @@ class FacialVerificationAPI { array( "referenceImagePath" => $referenceImagePath, "capturedImageBase64" => $capturedImageBase64, + "photoAssureCrypte" => $_SESSION['photoAssureCrypte'], ) ); exit; // Option 1: Azure Face API (Recommandé) - return $this->compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64); + // return $this->compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64); // Option 2: AWS Rekognition - // return $this->compareWithAWSRekognition($referenceImagePath, $capturedImageBase64); + return $this->compareWithAWSRekognition($referenceImagePath, $capturedImageBase64); // Option 3: Solution locale avec OpenCV/dlib (avancé) // return $this->compareWithLocalFaceRecognition($referenceImagePath, $capturedImageBase64); From d9e8f096587bec05f3e6ebce035d073c36b1bac2 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Mon, 23 Feb 2026 23:52:23 +0000 Subject: [PATCH 065/129] a --- Contestation/Faceebene.php | 58 ++++++++++++++++++++++++++++++ Contestation/verify_facial_api.php | 1 + 2 files changed, 59 insertions(+) create mode 100644 Contestation/Faceebene.php diff --git a/Contestation/Faceebene.php b/Contestation/Faceebene.php new file mode 100644 index 0000000..9c0c96b --- /dev/null +++ b/Contestation/Faceebene.php @@ -0,0 +1,58 @@ + [ + /* + 'key' => 'AKIARKWWQN5L3CY26JXS', + 'secret' => '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', + */ + /* + 'key' => 'AKIARKWWQN5LZYQYF5HJ', + 'secret' => '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', + */ + // en attente de réactivation => 24/09/2025 + 'key' => 'AKIARKWWQN5LVQZROBMS', + 'secret' => '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', + // Compte de radiant en attendant => 24/09/2025 + 'key' => 'AKIA2O2PTXQ7XN5OATO3', + 'secret' => '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', + ], + 'version' => 'latest', + 'region' => 'us-west-2' +]; + +$client = new RekognitionClient($arrgs); + +/* +regions +us-east-2 +us-east-1 +us-west-1 +us-west-2 +af-south-1 +ap-east-1 +ap-south-2 +ap-southeast-3 +ap-southeast-4 +ap-south-1 +ap-northeast-3 +ap-northeast-2 +ap-southeast-1 +ap-southeast-2 +ap-northeast-1 +ca-central-1 +eu-central-1 +eu-west-1 +eu-west-2 +eu-south-1 +eu-west-3 +eu-south-2 +eu-north-1 +eu-central-2 +me-south-1 +me-central-1 +sa-east-1 +us-gov-east-1 +us-gov-west-1 +*/ diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 7e2e632..8daae45 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -1,6 +1,7 @@ Date: Tue, 24 Feb 2026 00:01:50 +0000 Subject: [PATCH 066/129] a --- Contestation/verify_facial_api.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 8daae45..fb47e56 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -26,6 +26,7 @@ class FacialVerificationAPI { * Valide un token de vérification */ public function validateToken($token) { + $_SESSION['lienPhoto'] = ""; try { $request = $this->assure_api->valider_token(); @@ -36,6 +37,8 @@ class FacialVerificationAPI { ]; } + $_SESSION['lienPhoto'] = $request['lienPhoto']; + return [ 'success' => true, 'message' => 'Token valide', From 76cdb990dc7c121a0526fe2e3faf97fc61048b3e Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:02:48 +0000 Subject: [PATCH 067/129] a --- Contestation/verify_facial_api.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index fb47e56..3669b4d 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -64,11 +64,12 @@ class FacialVerificationAPI { private function compareFaces($referenceImagePath, $capturedImageBase64) { var_dump( array( - "referenceImagePath" => $referenceImagePath, - "capturedImageBase64" => $capturedImageBase64, - "photoAssureCrypte" => $_SESSION['photoAssureCrypte'], + "referenceImagePath" => $referenceImagePath, + "capturedImageBase64" => $capturedImageBase64, + "photoAssureCrypte" => $_SESSION['photoAssureCrypte'], + "lienPhoto" => $_SESSION['lienPhoto'], ) - ); + ); exit; // Option 1: Azure Face API (Recommandé) From 6fab7f70244d08d746f32d769df01f34b9732727 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:04:49 +0000 Subject: [PATCH 068/129] a --- Contestation/Demandereconnaissancefaciale.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index d3e8b25..2a8ec30 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -103,6 +103,8 @@ $prestataire = $demande["prestataire"]; $lienPhoto = $demande["lienPhoto"]; + + $_SESSION['lienPhoto'] = $lienPhoto; // var_dump($demande); /* From 4a238b4973123d6120d2761dfb4609b1914e24b8 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:06:48 +0000 Subject: [PATCH 069/129] a --- Contestation/Demandereconnaissancefaciale.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Contestation/Demandereconnaissancefaciale.php b/Contestation/Demandereconnaissancefaciale.php index 2a8ec30..2b29fcf 100755 --- a/Contestation/Demandereconnaissancefaciale.php +++ b/Contestation/Demandereconnaissancefaciale.php @@ -633,8 +633,9 @@ } }, error: function(xhr, status, err) { - showError('Erreur de connexion au serveur'); - // showError(xhr.responseText); + // showError('Erreur de connexion au serveur'); + console.log(xhr.responseText); + showError(xhr.responseText); } }); } From 8d48a1d12d64e9a0c9697d23ccca7f9f68c56414 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:26:23 +0000 Subject: [PATCH 070/129] a --- Contestation/Faceebene.php | 58 ------------- Contestation/verify_facial_api.php | 131 ++++------------------------- 2 files changed, 16 insertions(+), 173 deletions(-) delete mode 100644 Contestation/Faceebene.php diff --git a/Contestation/Faceebene.php b/Contestation/Faceebene.php deleted file mode 100644 index 9c0c96b..0000000 --- a/Contestation/Faceebene.php +++ /dev/null @@ -1,58 +0,0 @@ - [ - /* - 'key' => 'AKIARKWWQN5L3CY26JXS', - 'secret' => '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', - */ - /* - 'key' => 'AKIARKWWQN5LZYQYF5HJ', - 'secret' => '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', - */ - // en attente de réactivation => 24/09/2025 - 'key' => 'AKIARKWWQN5LVQZROBMS', - 'secret' => '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', - // Compte de radiant en attendant => 24/09/2025 - 'key' => 'AKIA2O2PTXQ7XN5OATO3', - 'secret' => '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', - ], - 'version' => 'latest', - 'region' => 'us-west-2' -]; - -$client = new RekognitionClient($arrgs); - -/* -regions -us-east-2 -us-east-1 -us-west-1 -us-west-2 -af-south-1 -ap-east-1 -ap-south-2 -ap-southeast-3 -ap-southeast-4 -ap-south-1 -ap-northeast-3 -ap-northeast-2 -ap-southeast-1 -ap-southeast-2 -ap-northeast-1 -ca-central-1 -eu-central-1 -eu-west-1 -eu-west-2 -eu-south-1 -eu-west-3 -eu-south-2 -eu-north-1 -eu-central-2 -me-south-1 -me-central-1 -sa-east-1 -us-gov-east-1 -us-gov-west-1 -*/ diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 3669b4d..0d6d641 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -1,7 +1,6 @@ compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64); - // Option 2: AWS Rekognition return $this->compareWithAWSRekognition($referenceImagePath, $capturedImageBase64); - - // Option 3: Solution locale avec OpenCV/dlib (avancé) - // return $this->compareWithLocalFaceRecognition($referenceImagePath, $capturedImageBase64); - } - - /** - * Comparaison avec Azure Face API - */ - private function compareWithAzureFaceAPI($referenceImagePath, $capturedImageBase64) { - $endpoint = AZURE_FACE_ENDPOINT; - $apiKey = AZURE_FACE_API_KEY; - - try { - // 1. Détecter le visage dans l'image de référence - $referenceImageData = base64_encode(file_get_contents($referenceImagePath)); - $referenceFaceId = $this->detectFaceAzure($referenceImageData, $endpoint, $apiKey); - - if (!$referenceFaceId) { - return [ - 'match' => false, - 'confidence' => 0, - 'error' => 'Aucun visage détecté dans la photo de référence' - ]; - } - - // 2. Détecter le visage dans l'image capturée - $capturedImageData = explode(',', $capturedImageBase64)[1]; - $capturedFaceId = $this->detectFaceAzure($capturedImageData, $endpoint, $apiKey); - - if (!$capturedFaceId) { - return [ - 'match' => false, - 'confidence' => 0, - 'error' => 'Aucun visage détecté dans votre photo' - ]; - } - - // 3. Comparer les deux visages - $verifyUrl = $endpoint . '/face/v1.0/verify'; - - $data = [ - 'faceId1' => $referenceFaceId, - 'faceId2' => $capturedFaceId - ]; - - $ch = curl_init($verifyUrl); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($data)); - curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'Content-Type: application/json', - 'Ocp-Apim-Subscription-Key: ' . $apiKey - ]); - - $response = curl_exec($ch); - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - - if ($httpCode !== 200) { - throw new Exception("Azure API error: " . $response); - } - - $result = json_decode($response, true); - - return [ - 'match' => $result['isIdentical'], - 'confidence' => round($result['confidence'] * 100, 2), - 'error' => null - ]; - - } catch (Exception $e) { - error_log("Erreur Azure Face API: " . $e->getMessage()); - return [ - 'match' => false, - 'confidence' => 0, - 'error' => 'Erreur lors de la vérification faciale' - ]; - } - } - - /** - * Détecte un visage avec Azure Face API et retourne le faceId - */ - private function detectFaceAzure($imageBase64, $endpoint, $apiKey) { - $detectUrl = $endpoint . '/face/v1.0/detect?returnFaceId=true'; - - $ch = curl_init($detectUrl); - curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); - curl_setopt($ch, CURLOPT_POST, true); - curl_setopt($ch, CURLOPT_POSTFIELDS, base64_decode($imageBase64)); - curl_setopt($ch, CURLOPT_HTTPHEADER, [ - 'Content-Type: application/octet-stream', - 'Ocp-Apim-Subscription-Key: ' . $apiKey - ]); - - $response = curl_exec($ch); - $httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE); - curl_close($ch); - - if ($httpCode !== 200) { - return null; - } - - $faces = json_decode($response, true); - - if (empty($faces)) { - return null; - } - - return $faces[0]['faceId']; } /** @@ -213,7 +99,22 @@ class FacialVerificationAPI { 'TargetImage' => ['Bytes' => $capturedImageData], 'SimilarityThreshold' => 80 ]); - + +/* + $result = $client->compareFaces + ( + [ + 'SimilarityThreshold' => 80, + 'SourceImage' => [ + 'Bytes' => file_get_contents($sourceImage) + ], + 'TargetImage' => [ + //'Bytes' => file_get_contents($targetImage) + 'Bytes' => base64_decode($targetImage) + ], + ] + ); +*/ if (empty($result['FaceMatches'])) { return [ 'match' => false, From adc8fe66a6f52b4c6788ed8b6c1e7678ab8272dc Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:35:46 +0000 Subject: [PATCH 071/129] a --- Contestation/verify_facial_api.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 0d6d641..b4f2928 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -64,7 +64,7 @@ class FacialVerificationAPI { var_dump( array( "referenceImagePath" => $referenceImagePath, - "capturedImageBase64" => $capturedImageBase64, + // "capturedImageBase64" => $capturedImageBase64, "photoAssureCrypte" => $_SESSION['photoAssureCrypte'], "lienPhoto" => $_SESSION['lienPhoto'], ) @@ -84,19 +84,20 @@ class FacialVerificationAPI { try { $rekognitionClient = new Aws\Rekognition\RekognitionClient([ 'version' => 'latest', - 'region' => AWS_REGION, + 'region' => 'us-west-2', 'credentials' => [ - 'key' => AWS_ACCESS_KEY_ID, - 'secret' => AWS_SECRET_ACCESS_KEY + 'key' => 'AKIA2O2PTXQ7XN5OATO3', + 'secret' => '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' ] ]); - + + $referenceImageData = file_get_contents($referenceImagePath); $capturedImageData = base64_decode(explode(',', $capturedImageBase64)[1]); $result = $rekognitionClient->compareFaces([ - 'SourceImage' => ['Bytes' => $referenceImageData], - 'TargetImage' => ['Bytes' => $capturedImageData], + 'SourceImage' => ['Bytes' => $capturedImageData], + 'TargetImage' => ['Bytes' => $referenceImageData], 'SimilarityThreshold' => 80 ]); From 1ccafd13bdda49760513a1f1d9d8980c46f2aecc Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:40:38 +0000 Subject: [PATCH 072/129] a --- Contestation/verify_facial_api.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index b4f2928..addea1c 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -64,9 +64,9 @@ class FacialVerificationAPI { var_dump( array( "referenceImagePath" => $referenceImagePath, - // "capturedImageBase64" => $capturedImageBase64, - "photoAssureCrypte" => $_SESSION['photoAssureCrypte'], - "lienPhoto" => $_SESSION['lienPhoto'], + "capturedImageBase64" => $capturedImageBase64, + // "photoAssureCrypte" => $_SESSION['photoAssureCrypte'], + // "lienPhoto" => $_SESSION['lienPhoto'], ) ); exit; @@ -232,7 +232,7 @@ class FacialVerificationAPI { // 4. Comparer les visages $comparisonResult = $this->compareFaces( - $request['photo_reference_path'], + $_SESSION['photoAssureCrypte'], $capturedImageBase64 ); From ddad227fb1920832e291b4e0c469e12b0e2dc56c Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:43:50 +0000 Subject: [PATCH 073/129] a --- Contestation/verify_facial_api.php | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index addea1c..1335ef6 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -61,6 +61,7 @@ class FacialVerificationAPI { * Utilisez Azure Face API, AWS Rekognition, ou une solution locale */ private function compareFaces($referenceImagePath, $capturedImageBase64) { + /* var_dump( array( "referenceImagePath" => $referenceImagePath, @@ -70,6 +71,7 @@ class FacialVerificationAPI { ) ); exit; + */ // Option 2: AWS Rekognition return $this->compareWithAWSRekognition($referenceImagePath, $capturedImageBase64); @@ -101,21 +103,9 @@ class FacialVerificationAPI { 'SimilarityThreshold' => 80 ]); -/* - $result = $client->compareFaces - ( - [ - 'SimilarityThreshold' => 80, - 'SourceImage' => [ - 'Bytes' => file_get_contents($sourceImage) - ], - 'TargetImage' => [ - //'Bytes' => file_get_contents($targetImage) - 'Bytes' => base64_decode($targetImage) - ], - ] - ); -*/ + var_dump($result); + exit; + if (empty($result['FaceMatches'])) { return [ 'match' => false, From b01ef7f77c5480b1f8819ae9277c168fe7db5c45 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 00:53:55 +0000 Subject: [PATCH 074/129] a --- Contestation/verify_facial_api.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Contestation/verify_facial_api.php b/Contestation/verify_facial_api.php index 1335ef6..f4dea34 100644 --- a/Contestation/verify_facial_api.php +++ b/Contestation/verify_facial_api.php @@ -94,7 +94,8 @@ class FacialVerificationAPI { ]); - $referenceImageData = file_get_contents($referenceImagePath); + // $referenceImageData = file_get_contents($referenceImagePath); + $referenceImageData = $referenceImagePath; $capturedImageData = base64_decode(explode(',', $capturedImageBase64)[1]); $result = $rekognitionClient->compareFaces([ @@ -105,7 +106,7 @@ class FacialVerificationAPI { var_dump($result); exit; - + if (empty($result['FaceMatches'])) { return [ 'match' => false, From 22db8f480ffd40f25685256578ec17ac8fdae144 Mon Sep 17 00:00:00 2001 From: KANE LAZENI Date: Tue, 24 Feb 2026 01:06:48 +0000 Subject: [PATCH 075/129] a --- ...dereconnaissancefaciale_2026_02_23_08h.php | 751 - Contestation/check_verification_status.php | 58 - Contestation/facial_verification.php | 513 - Contestation/integration_example.php | 341 - Contestation/jquery-ui.js | 16617 ---------------- Contestation/jquery.min.js | 4 - Contestation/jquery.timer.js | 45 - Contestation/verify_facial_api.php | 2 + .../verify_facial_api_2026_02_23_08h.php | 433 - 9 files changed, 2 insertions(+), 18762 deletions(-) delete mode 100755 Contestation/Demandereconnaissancefaciale_2026_02_23_08h.php delete mode 100644 Contestation/check_verification_status.php delete mode 100644 Contestation/facial_verification.php delete mode 100644 Contestation/integration_example.php delete mode 100755 Contestation/jquery-ui.js delete mode 100755 Contestation/jquery.min.js delete mode 100755 Contestation/jquery.timer.js delete mode 100644 Contestation/verify_facial_api_2026_02_23_08h.php diff --git a/Contestation/Demandereconnaissancefaciale_2026_02_23_08h.php b/Contestation/Demandereconnaissancefaciale_2026_02_23_08h.php deleted file mode 100755 index a119db8..0000000 --- a/Contestation/Demandereconnaissancefaciale_2026_02_23_08h.php +++ /dev/null @@ -1,751 +0,0 @@ -geUneBd($codeBdd); - - /* - var_dump( - array( - // "bdd" => $bdd, - "codeSociete" => $codeSociete, - "codePrestataire" => $codePrestataire, - "idBeneficiaire" => $idBeneficiaire, - ) - - ); - */ - - if(!$bdd) { - $message = $codeLangue == 'en_US' ? "Entity not found!" : "Entité introuvable!"; - afficherMessage("$message"); - } - - $_SESSION['BdName'] = $bdd['BdName']; - $_SESSION['BdLogin'] = $bdd['BdLogin']; - $_SESSION['BdMdp'] = $bdd['BdMdp']; - - if($assure->existeligne($codeSociete)) { - $fassureExiste = $assure->assureExiste($codeSociete, $idBeneficiaire); - - if(!$fassureExiste) { - $message = $codeLangue == 'en_US' ? "Insured not found!" : "Assuré introuvable!"; - afficherMessage("$message"); - } - - $demande = $assure->checkdemandereconnaissancefaciale_id(); - - if(!$demande) { - $message = $codeLangue == 'en_US' ? "No requests found!" : "Aucune demande trouvée!"; - afficherMessage("$message"); - } - - $idDemande = $demande["idDemande"]; - $codeEtat = $demande["codeEtat"]; - $demandeExpiree = $demande["demandeExpiree"]; - $dateExpirationFr = $demande["dateExpirationFr"]; - $dateExpirationEng = $demande["dateExpirationEng"]; - $etatDemande = $demande["etatDemande"]; - $etatDemandeEng = $demande["etatDemandeEng"]; - - $beneficiaire = $demande["beneficiaire"]; - $prestataire = $demande["prestataire"]; - - // var_dump($demande); - /* - idDemande - codePrestataire - idBeneficiaire - codeEtat - nbTentative - lienPhotoWebcam - dateExpiration - dateExpirationFr - dateExpirationEng - demandeExpiree - beneficiaire - prestataire - */ - - /* - var_dump( - array( - // "bdd" => $bdd, - "idDemande" => $idDemande, - "codeEtat" => $codeEtat, - "demandeExpiree" => $demandeExpiree, - "etatDemande" => $etatDemande, - "etatDemandeEng" => $etatDemandeEng, - - "beneficiaire" => $beneficiaire, - "prestataire" => $prestataire, - ) - - ); - */ - - /* - codeEtat libelle - 3 Expiré - 1 Vérifié - 2 Echec - 4 Erreur - 0 En attente - */ - - if($codeEtat=="3" || $demandeExpiree=="1") { - $message = $codeLangue == 'en_US' ? "Request expired since $dateExpirationEng !" : "Demande expirée depuis $dateExpirationFr !"; - afficherMessage("$message"); - } - - if($codeEtat=="1") { - $message = $codeLangue == 'en_US' ? "Verification already completed!" : "Vérification déjà exffectuée!"; - afficherMessage("$message"); - } - - if($codeEtat=="2") { - $message = $codeLangue == 'en_US' ? "Failure, please try again!" : "Echec, veuilez réessayer!"; - afficherMessage("$message"); - } - - if($codeEtat=="4") { - $message = $codeLangue == 'en_US' ? "Error, please try again!" : "Erreur, veuilez réessayer!"; - afficherMessage("$message"); - } - - /* - $message = $codeLangue == 'en_US' - ? "Parameters successfully verified!" - : "Paramètres vérifiés avec succès!"; - afficherMessage("$message", false); - */ - - $param_societe = $assure->get_parametres_societe($codeSociete); - - $_SESSION['dureeToken'] = $param_societe["dureeTokenReconnaissanceFaciale"]; - $_SESSION['dossierPhoto'] = $param_societe["dossierPhoto"]; - $_SESSION['nbTentative'] = $param_societe["nbTentativeBiometrie"]; - } - - function afficherMessage($message) { - echo " - - - - - Erreur - - - - - -
-
-
- -
-

Erreur

-

{$message}

-
-
- - "; - exit(); - - // echo $message; - } - -?> - - - - - - - INTER-SANTÉ - Vérification d'identité - - - -
-
-

🏥 INTER-SANTÉ

-

Vérification d'identité sécurisée

-
- -
- -
-
-

Demande Vérification du lien...

-
- - -
-
-

Instructions pour la vérification

-
    -
  • Positionnez votre visage dans l'ovale
  • -
  • Assurez-vous d'être dans un endroit bien éclairé
  • -
  • Regardez directement la caméra
  • -
  • Restez immobile lors de la capture
  • -
  • Retirez lunettes de soleil, casquette ou masque
  • -
-
- -
- - -
-
- - -
-
-
- Positionnez votre visage dans l'ovale -
- -
- - -
-

Confirmez votre photo

- Votre photo - - -
- - -
-
-

- Vérification de votre identité en cours...
- Merci de patienter -

-
- - -
-
-
-

-

-
-
-
- - -
-
-

❌ Erreur

-

-
-
-
-
- - - - - - diff --git a/Contestation/check_verification_status.php b/Contestation/check_verification_status.php deleted file mode 100644 index 78bd991..0000000 --- a/Contestation/check_verification_status.php +++ /dev/null @@ -1,58 +0,0 @@ - false, - 'message' => 'ID de requête manquant' - ]); - exit; -} - -$db = new Database(); -$conn = $db->getConnection(); - -// Récupérer le statut de la vérification -$sql = "SELECT vr.*, pas.session_token - FROM facial_verification_requests vr - LEFT JOIN prestation_authorization_sessions pas - ON vr.id = pas.verification_request_id - AND pas.status = 'active' - WHERE vr.id = ?"; - -$stmt = $conn->prepare($sql); -$stmt->execute([$requestId]); -$request = $stmt->fetch(PDO::FETCH_ASSOC); - -if (!$request) { - echo json_encode([ - 'success' => false, - 'message' => 'Requête non trouvée' - ]); - exit; -} - -// Calculer le temps restant -$now = new DateTime(); -$expiresAt = new DateTime($request['expires_at']); -$interval = $now->diff($expiresAt); -$secondsRemaining = ($expiresAt->getTimestamp() - $now->getTimestamp()); - -echo json_encode([ - 'success' => true, - 'status' => $request['status'], - 'attempts' => $request['attempts'], - 'match_confidence' => $request['match_confidence'], - 'session_token' => $request['session_token'], - 'seconds_remaining' => max(0, $secondsRemaining), - 'verified_at' => $request['verified_at'] -]); diff --git a/Contestation/facial_verification.php b/Contestation/facial_verification.php deleted file mode 100644 index acb3522..0000000 --- a/Contestation/facial_verification.php +++ /dev/null @@ -1,513 +0,0 @@ - - - - - - INTER-SANTÉ - Vérification d'identité - - - -
-
-

🏥 INTER-SANTÉ

-

Vérification d'identité sécurisée

-
- -
- -
-
-

facial Vérification du lien...

-
- - -
-
-

Instructions pour la vérification

-
    -
  • Positionnez votre visage dans l'ovale
  • -
  • Assurez-vous d'être dans un endroit bien éclairé
  • -
  • Regardez directement la caméra
  • -
  • Restez immobile lors de la capture
  • -
  • Retirez lunettes de soleil, casquette ou masque
  • -
-
- -
- - -
-
- - -
-
-
- Positionnez votre visage dans l'ovale -
- -
- - -
-

Confirmez votre photo

- Votre photo - - -
- - -
-
-

- Vérification de votre identité en cours...
- Merci de patienter -

-
- - -
-
-
-

-

-
-
-
- - -
-
-

❌ Erreur

-

-
-
-
-
- - - - diff --git a/Contestation/integration_example.php b/Contestation/integration_example.php deleted file mode 100644 index 0a82b30..0000000 --- a/Contestation/integration_example.php +++ /dev/null @@ -1,341 +0,0 @@ -getConnection(); - - $sql = "SELECT id, nom, prenoms, numero_carte, email, telephone, photo_reference_path - FROM assures - WHERE id = ? AND statut = 'actif'"; - - $stmt = $conn->prepare($sql); - $stmt->execute([$assureId]); - $assure = $stmt->fetch(PDO::FETCH_ASSOC); - - if (!$assure) { - return [ - 'success' => false, - 'message' => 'Assuré non trouvé ou inactif' - ]; - } - - // 3. Vérifier si une photo de référence existe - if (empty($assure['photo_reference_path'])) { - // Pas de photo de référence = accès sans vérification faciale - // Loguer cette tentative pour sécurité - logAction("Accès sans vérification faciale - Assuré #{$assureId} - Aucune photo de référence", 'WARNING'); - - return [ - 'success' => true, - 'require_facial_verification' => false, - 'message' => 'Accès autorisé (pas de photo de référence)', - 'assure' => $assure - ]; - } - - // 4. Envoyer le lien de vérification faciale - $verifier = new FacialVerificationLink($conn); - - // Choisir le canal d'envoi selon les préférences - $method = 'both'; // 'email', 'whatsapp', ou 'both' - - $result = $verifier->sendVerificationLink($assureId, $method); - - if ($result['success']) { - return [ - 'success' => true, - 'require_facial_verification' => true, - 'message' => 'Lien de vérification envoyé', - 'email_sent' => $result['email_sent'], - 'whatsapp_sent' => $result['whatsapp_sent'], - 'assure' => $assure - ]; - } else { - return [ - 'success' => false, - 'message' => $result['message'] - ]; - } -} - -// ==================================================================== -// SCÉNARIO 2: Vérification de session avant saisie des prestations -// ==================================================================== - -/** - * Vérifie si l'utilisateur a une session d'autorisation valide - * À appeler au début de saisie_prestations.php - */ -function checkAuthorizationSession() { - $sessionToken = $_GET['token'] ?? $_SESSION['authorization_token'] ?? null; - - if (!$sessionToken) { - return [ - 'authorized' => false, - 'message' => 'Aucune session d\'autorisation' - ]; - } - - $db = new Database(); - $conn = $db->getConnection(); - - $sql = "SELECT pas.*, a.id as assure_id, a.nom, a.prenoms, a.numero_carte - FROM prestation_authorization_sessions pas - JOIN assures a ON pas.assure_id = a.id - WHERE pas.session_token = ? - AND pas.status = 'active' - AND pas.expires_at > NOW()"; - - $stmt = $conn->prepare($sql); - $stmt->execute([$sessionToken]); - $session = $stmt->fetch(PDO::FETCH_ASSOC); - - if (!$session) { - return [ - 'authorized' => false, - 'message' => 'Session invalide ou expirée' - ]; - } - - // Stocker en session PHP pour les requêtes suivantes - $_SESSION['authorization_token'] = $sessionToken; - $_SESSION['authorized_assure_id'] = $session['assure_id']; - - return [ - 'authorized' => true, - 'assure' => [ - 'id' => $session['assure_id'], - 'nom' => $session['nom'], - 'prenoms' => $session['prenoms'], - 'numero_carte' => $session['numero_carte'] - ], - 'session' => $session - ]; -} - -/** - * Marque une session comme utilisée après saisie d'une prestation - */ -function markSessionAsUsed($sessionToken) { - $db = new Database(); - $conn = $db->getConnection(); - - $sql = "UPDATE prestation_authorization_sessions - SET prestations_saisies = prestations_saisies + 1, - used_at = NOW() - WHERE session_token = ?"; - - $stmt = $conn->prepare($sql); - return $stmt->execute([$sessionToken]); -} - -// ==================================================================== -// SCÉNARIO 3: Interface utilisateur pour le prestataire -// ==================================================================== - -/** - * Génère l'interface HTML pour le prestataire après scan NFC/QR - */ -function renderVerificationWaitingScreen($assure, $verificationSent) { - ?> - - - - - - Vérification en attente - INTER-SANTÉ - - - -
-

🏥 INTER-SANTÉ

-

Vérification d'identité en cours

- -
-

-

Carte N°

-
- -
- -

- Un lien de vérification a été envoyé à l'assuré.
- En attente de la vérification faciale... -

- -
- -
✓ Email envoyé
- -
✗ Email non envoyé
- - - -
✓ WhatsApp envoyé
- -
✗ WhatsApp non envoyé
- -
- -

- Le lien de vérification est valable pendant 15 minutes -

-
- - - - - false, 'message' => 'Données manquantes']); - exit; - } - - // Traiter le scan - $result = handleNFCOrQRCodeScan($tagData); - - if ($result['success'] && $result['require_facial_verification']) { - // Afficher l'écran d'attente - renderVerificationWaitingScreen($result['assure'], $result); - } elseif ($result['success'] && !$result['require_facial_verification']) { - // Accès direct (pas de photo de référence) - header('Location: saisie_prestations.php?assure_id=' . $result['assure']['id']); - } else { - // Erreur - echo json_encode($result); - } -} - -// Dans votre fichier saisie_prestations.php -session_start(); - -// Vérifier l'autorisation -$auth = checkAuthorizationSession(); - -if (!$auth['authorized']) { - die('Accès non autorisé. Veuillez scanner la carte de l\'assuré.'); -} - -// L'utilisateur est autorisé, afficher le formulaire de saisie -$assure = $auth['assure']; - -// ... Votre code de saisie de prestations ... - -// Après enregistrement d'une prestation -if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['save_prestation'])) { - // Enregistrer la prestation - // ... - - // Marquer la session comme utilisée - markSessionAsUsed($_SESSION['authorization_token']); -} diff --git a/Contestation/jquery-ui.js b/Contestation/jquery-ui.js deleted file mode 100755 index 95c365c..0000000 --- a/Contestation/jquery-ui.js +++ /dev/null @@ -1,16617 +0,0 @@ -/*! jQuery UI - v1.11.4 - 2016-04-27 -* http://jqueryui.com -* Includes: core.js, widget.js, mouse.js, position.js, draggable.js, droppable.js, resizable.js, selectable.js, sortable.js, accordion.js, autocomplete.js, button.js, datepicker.js, dialog.js, menu.js, progressbar.js, selectmenu.js, slider.js, spinner.js, tabs.js, tooltip.js, effect.js, effect-blind.js, effect-bounce.js, effect-clip.js, effect-drop.js, effect-explode.js, effect-fade.js, effect-fold.js, effect-highlight.js, effect-puff.js, effect-pulsate.js, effect-scale.js, effect-shake.js, effect-size.js, effect-slide.js, effect-transfer.js -* Copyright jQuery Foundation and other contributors; Licensed MIT */ - -(function( factory ) { - if ( typeof define === "function" && define.amd ) { - - // AMD. Register as an anonymous module. - define([ "jquery" ], factory ); - } else { - - // Browser globals - factory( jQuery ); - } -}(function( $ ) { -/*! - * jQuery UI Core 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/category/ui-core/ - */ - - -// $.ui might exist from components with no dependencies, e.g., $.ui.position -$.ui = $.ui || {}; - -$.extend( $.ui, { - version: "1.11.4", - - keyCode: { - BACKSPACE: 8, - COMMA: 188, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - LEFT: 37, - PAGE_DOWN: 34, - PAGE_UP: 33, - PERIOD: 190, - RIGHT: 39, - SPACE: 32, - TAB: 9, - UP: 38 - } -}); - -// plugins -$.fn.extend({ - scrollParent: function( includeHidden ) { - var position = this.css( "position" ), - excludeStaticParent = position === "absolute", - overflowRegex = includeHidden ? /(auto|scroll|hidden)/ : /(auto|scroll)/, - scrollParent = this.parents().filter( function() { - var parent = $( this ); - if ( excludeStaticParent && parent.css( "position" ) === "static" ) { - return false; - } - return overflowRegex.test( parent.css( "overflow" ) + parent.css( "overflow-y" ) + parent.css( "overflow-x" ) ); - }).eq( 0 ); - - return position === "fixed" || !scrollParent.length ? $( this[ 0 ].ownerDocument || document ) : scrollParent; - }, - - uniqueId: (function() { - var uuid = 0; - - return function() { - return this.each(function() { - if ( !this.id ) { - this.id = "ui-id-" + ( ++uuid ); - } - }); - }; - })(), - - removeUniqueId: function() { - return this.each(function() { - if ( /^ui-id-\d+$/.test( this.id ) ) { - $( this ).removeAttr( "id" ); - } - }); - } -}); - -// selectors -function focusable( element, isTabIndexNotNaN ) { - var map, mapName, img, - nodeName = element.nodeName.toLowerCase(); - if ( "area" === nodeName ) { - map = element.parentNode; - mapName = map.name; - if ( !element.href || !mapName || map.nodeName.toLowerCase() !== "map" ) { - return false; - } - img = $( "img[usemap='#" + mapName + "']" )[ 0 ]; - return !!img && visible( img ); - } - return ( /^(input|select|textarea|button|object)$/.test( nodeName ) ? - !element.disabled : - "a" === nodeName ? - element.href || isTabIndexNotNaN : - isTabIndexNotNaN) && - // the element and all of its ancestors must be visible - visible( element ); -} - -function visible( element ) { - return $.expr.filters.visible( element ) && - !$( element ).parents().addBack().filter(function() { - return $.css( this, "visibility" ) === "hidden"; - }).length; -} - -$.extend( $.expr[ ":" ], { - data: $.expr.createPseudo ? - $.expr.createPseudo(function( dataName ) { - return function( elem ) { - return !!$.data( elem, dataName ); - }; - }) : - // support: jQuery <1.8 - function( elem, i, match ) { - return !!$.data( elem, match[ 3 ] ); - }, - - focusable: function( element ) { - return focusable( element, !isNaN( $.attr( element, "tabindex" ) ) ); - }, - - tabbable: function( element ) { - var tabIndex = $.attr( element, "tabindex" ), - isTabIndexNaN = isNaN( tabIndex ); - return ( isTabIndexNaN || tabIndex >= 0 ) && focusable( element, !isTabIndexNaN ); - } -}); - -// support: jQuery <1.8 -if ( !$( "" ).outerWidth( 1 ).jquery ) { - $.each( [ "Width", "Height" ], function( i, name ) { - var side = name === "Width" ? [ "Left", "Right" ] : [ "Top", "Bottom" ], - type = name.toLowerCase(), - orig = { - innerWidth: $.fn.innerWidth, - innerHeight: $.fn.innerHeight, - outerWidth: $.fn.outerWidth, - outerHeight: $.fn.outerHeight - }; - - function reduce( elem, size, border, margin ) { - $.each( side, function() { - size -= parseFloat( $.css( elem, "padding" + this ) ) || 0; - if ( border ) { - size -= parseFloat( $.css( elem, "border" + this + "Width" ) ) || 0; - } - if ( margin ) { - size -= parseFloat( $.css( elem, "margin" + this ) ) || 0; - } - }); - return size; - } - - $.fn[ "inner" + name ] = function( size ) { - if ( size === undefined ) { - return orig[ "inner" + name ].call( this ); - } - - return this.each(function() { - $( this ).css( type, reduce( this, size ) + "px" ); - }); - }; - - $.fn[ "outer" + name] = function( size, margin ) { - if ( typeof size !== "number" ) { - return orig[ "outer" + name ].call( this, size ); - } - - return this.each(function() { - $( this).css( type, reduce( this, size, true, margin ) + "px" ); - }); - }; - }); -} - -// support: jQuery <1.8 -if ( !$.fn.addBack ) { - $.fn.addBack = function( selector ) { - return this.add( selector == null ? - this.prevObject : this.prevObject.filter( selector ) - ); - }; -} - -// support: jQuery 1.6.1, 1.6.2 (http://bugs.jquery.com/ticket/9413) -if ( $( "" ).data( "a-b", "a" ).removeData( "a-b" ).data( "a-b" ) ) { - $.fn.removeData = (function( removeData ) { - return function( key ) { - if ( arguments.length ) { - return removeData.call( this, $.camelCase( key ) ); - } else { - return removeData.call( this ); - } - }; - })( $.fn.removeData ); -} - -// deprecated -$.ui.ie = !!/msie [\w.]+/.exec( navigator.userAgent.toLowerCase() ); - -$.fn.extend({ - focus: (function( orig ) { - return function( delay, fn ) { - return typeof delay === "number" ? - this.each(function() { - var elem = this; - setTimeout(function() { - $( elem ).focus(); - if ( fn ) { - fn.call( elem ); - } - }, delay ); - }) : - orig.apply( this, arguments ); - }; - })( $.fn.focus ), - - disableSelection: (function() { - var eventType = "onselectstart" in document.createElement( "div" ) ? - "selectstart" : - "mousedown"; - - return function() { - return this.bind( eventType + ".ui-disableSelection", function( event ) { - event.preventDefault(); - }); - }; - })(), - - enableSelection: function() { - return this.unbind( ".ui-disableSelection" ); - }, - - zIndex: function( zIndex ) { - if ( zIndex !== undefined ) { - return this.css( "zIndex", zIndex ); - } - - if ( this.length ) { - var elem = $( this[ 0 ] ), position, value; - while ( elem.length && elem[ 0 ] !== document ) { - // Ignore z-index if position is set to a value where z-index is ignored by the browser - // This makes behavior of this function consistent across browsers - // WebKit always returns auto if the element is positioned - position = elem.css( "position" ); - if ( position === "absolute" || position === "relative" || position === "fixed" ) { - // IE returns 0 when zIndex is not specified - // other browsers return a string - // we ignore the case of nested elements with an explicit value of 0 - //
- value = parseInt( elem.css( "zIndex" ), 10 ); - if ( !isNaN( value ) && value !== 0 ) { - return value; - } - } - elem = elem.parent(); - } - } - - return 0; - } -}); - -// $.ui.plugin is deprecated. Use $.widget() extensions instead. -$.ui.plugin = { - add: function( module, option, set ) { - var i, - proto = $.ui[ module ].prototype; - for ( i in set ) { - proto.plugins[ i ] = proto.plugins[ i ] || []; - proto.plugins[ i ].push( [ option, set[ i ] ] ); - } - }, - call: function( instance, name, args, allowDisconnected ) { - var i, - set = instance.plugins[ name ]; - - if ( !set ) { - return; - } - - if ( !allowDisconnected && ( !instance.element[ 0 ].parentNode || instance.element[ 0 ].parentNode.nodeType === 11 ) ) { - return; - } - - for ( i = 0; i < set.length; i++ ) { - if ( instance.options[ set[ i ][ 0 ] ] ) { - set[ i ][ 1 ].apply( instance.element, args ); - } - } - } -}; - - -/*! - * jQuery UI Widget 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/jQuery.widget/ - */ - - -var widget_uuid = 0, - widget_slice = Array.prototype.slice; - -$.cleanData = (function( orig ) { - return function( elems ) { - var events, elem, i; - for ( i = 0; (elem = elems[i]) != null; i++ ) { - try { - - // Only trigger remove when necessary to save time - events = $._data( elem, "events" ); - if ( events && events.remove ) { - $( elem ).triggerHandler( "remove" ); - } - - // http://bugs.jquery.com/ticket/8235 - } catch ( e ) {} - } - orig( elems ); - }; -})( $.cleanData ); - -$.widget = function( name, base, prototype ) { - var fullName, existingConstructor, constructor, basePrototype, - // proxiedPrototype allows the provided prototype to remain unmodified - // so that it can be used as a mixin for multiple widgets (#8876) - proxiedPrototype = {}, - namespace = name.split( "." )[ 0 ]; - - name = name.split( "." )[ 1 ]; - fullName = namespace + "-" + name; - - if ( !prototype ) { - prototype = base; - base = $.Widget; - } - - // create selector for plugin - $.expr[ ":" ][ fullName.toLowerCase() ] = function( elem ) { - return !!$.data( elem, fullName ); - }; - - $[ namespace ] = $[ namespace ] || {}; - existingConstructor = $[ namespace ][ name ]; - constructor = $[ namespace ][ name ] = function( options, element ) { - // allow instantiation without "new" keyword - if ( !this._createWidget ) { - return new constructor( options, element ); - } - - // allow instantiation without initializing for simple inheritance - // must use "new" keyword (the code above always passes args) - if ( arguments.length ) { - this._createWidget( options, element ); - } - }; - // extend with the existing constructor to carry over any static properties - $.extend( constructor, existingConstructor, { - version: prototype.version, - // copy the object used to create the prototype in case we need to - // redefine the widget later - _proto: $.extend( {}, prototype ), - // track widgets that inherit from this widget in case this widget is - // redefined after a widget inherits from it - _childConstructors: [] - }); - - basePrototype = new base(); - // we need to make the options hash a property directly on the new instance - // otherwise we'll modify the options hash on the prototype that we're - // inheriting from - basePrototype.options = $.widget.extend( {}, basePrototype.options ); - $.each( prototype, function( prop, value ) { - if ( !$.isFunction( value ) ) { - proxiedPrototype[ prop ] = value; - return; - } - proxiedPrototype[ prop ] = (function() { - var _super = function() { - return base.prototype[ prop ].apply( this, arguments ); - }, - _superApply = function( args ) { - return base.prototype[ prop ].apply( this, args ); - }; - return function() { - var __super = this._super, - __superApply = this._superApply, - returnValue; - - this._super = _super; - this._superApply = _superApply; - - returnValue = value.apply( this, arguments ); - - this._super = __super; - this._superApply = __superApply; - - return returnValue; - }; - })(); - }); - constructor.prototype = $.widget.extend( basePrototype, { - // TODO: remove support for widgetEventPrefix - // always use the name + a colon as the prefix, e.g., draggable:start - // don't prefix for widgets that aren't DOM-based - widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name - }, proxiedPrototype, { - constructor: constructor, - namespace: namespace, - widgetName: name, - widgetFullName: fullName - }); - - // If this widget is being redefined then we need to find all widgets that - // are inheriting from it and redefine all of them so that they inherit from - // the new version of this widget. We're essentially trying to replace one - // level in the prototype chain. - if ( existingConstructor ) { - $.each( existingConstructor._childConstructors, function( i, child ) { - var childPrototype = child.prototype; - - // redefine the child widget using the same prototype that was - // originally used, but inherit from the new version of the base - $.widget( childPrototype.namespace + "." + childPrototype.widgetName, constructor, child._proto ); - }); - // remove the list of existing child constructors from the old constructor - // so the old child constructors can be garbage collected - delete existingConstructor._childConstructors; - } else { - base._childConstructors.push( constructor ); - } - - $.widget.bridge( name, constructor ); - - return constructor; -}; - -$.widget.extend = function( target ) { - var input = widget_slice.call( arguments, 1 ), - inputIndex = 0, - inputLength = input.length, - key, - value; - for ( ; inputIndex < inputLength; inputIndex++ ) { - for ( key in input[ inputIndex ] ) { - value = input[ inputIndex ][ key ]; - if ( input[ inputIndex ].hasOwnProperty( key ) && value !== undefined ) { - // Clone objects - if ( $.isPlainObject( value ) ) { - target[ key ] = $.isPlainObject( target[ key ] ) ? - $.widget.extend( {}, target[ key ], value ) : - // Don't extend strings, arrays, etc. with objects - $.widget.extend( {}, value ); - // Copy everything else by reference - } else { - target[ key ] = value; - } - } - } - } - return target; -}; - -$.widget.bridge = function( name, object ) { - var fullName = object.prototype.widgetFullName || name; - $.fn[ name ] = function( options ) { - var isMethodCall = typeof options === "string", - args = widget_slice.call( arguments, 1 ), - returnValue = this; - - if ( isMethodCall ) { - this.each(function() { - var methodValue, - instance = $.data( this, fullName ); - if ( options === "instance" ) { - returnValue = instance; - return false; - } - if ( !instance ) { - return $.error( "cannot call methods on " + name + " prior to initialization; " + - "attempted to call method '" + options + "'" ); - } - if ( !$.isFunction( instance[options] ) || options.charAt( 0 ) === "_" ) { - return $.error( "no such method '" + options + "' for " + name + " widget instance" ); - } - methodValue = instance[ options ].apply( instance, args ); - if ( methodValue !== instance && methodValue !== undefined ) { - returnValue = methodValue && methodValue.jquery ? - returnValue.pushStack( methodValue.get() ) : - methodValue; - return false; - } - }); - } else { - - // Allow multiple hashes to be passed on init - if ( args.length ) { - options = $.widget.extend.apply( null, [ options ].concat(args) ); - } - - this.each(function() { - var instance = $.data( this, fullName ); - if ( instance ) { - instance.option( options || {} ); - if ( instance._init ) { - instance._init(); - } - } else { - $.data( this, fullName, new object( options, this ) ); - } - }); - } - - return returnValue; - }; -}; - -$.Widget = function( /* options, element */ ) {}; -$.Widget._childConstructors = []; - -$.Widget.prototype = { - widgetName: "widget", - widgetEventPrefix: "", - defaultElement: "
", - options: { - disabled: false, - - // callbacks - create: null - }, - _createWidget: function( options, element ) { - element = $( element || this.defaultElement || this )[ 0 ]; - this.element = $( element ); - this.uuid = widget_uuid++; - this.eventNamespace = "." + this.widgetName + this.uuid; - - this.bindings = $(); - this.hoverable = $(); - this.focusable = $(); - - if ( element !== this ) { - $.data( element, this.widgetFullName, this ); - this._on( true, this.element, { - remove: function( event ) { - if ( event.target === element ) { - this.destroy(); - } - } - }); - this.document = $( element.style ? - // element within the document - element.ownerDocument : - // element is window or document - element.document || element ); - this.window = $( this.document[0].defaultView || this.document[0].parentWindow ); - } - - this.options = $.widget.extend( {}, - this.options, - this._getCreateOptions(), - options ); - - this._create(); - this._trigger( "create", null, this._getCreateEventData() ); - this._init(); - }, - _getCreateOptions: $.noop, - _getCreateEventData: $.noop, - _create: $.noop, - _init: $.noop, - - destroy: function() { - this._destroy(); - // we can probably remove the unbind calls in 2.0 - // all event bindings should go through this._on() - this.element - .unbind( this.eventNamespace ) - .removeData( this.widgetFullName ) - // support: jquery <1.6.3 - // http://bugs.jquery.com/ticket/9413 - .removeData( $.camelCase( this.widgetFullName ) ); - this.widget() - .unbind( this.eventNamespace ) - .removeAttr( "aria-disabled" ) - .removeClass( - this.widgetFullName + "-disabled " + - "ui-state-disabled" ); - - // clean up events and states - this.bindings.unbind( this.eventNamespace ); - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - }, - _destroy: $.noop, - - widget: function() { - return this.element; - }, - - option: function( key, value ) { - var options = key, - parts, - curOption, - i; - - if ( arguments.length === 0 ) { - // don't return a reference to the internal hash - return $.widget.extend( {}, this.options ); - } - - if ( typeof key === "string" ) { - // handle nested keys, e.g., "foo.bar" => { foo: { bar: ___ } } - options = {}; - parts = key.split( "." ); - key = parts.shift(); - if ( parts.length ) { - curOption = options[ key ] = $.widget.extend( {}, this.options[ key ] ); - for ( i = 0; i < parts.length - 1; i++ ) { - curOption[ parts[ i ] ] = curOption[ parts[ i ] ] || {}; - curOption = curOption[ parts[ i ] ]; - } - key = parts.pop(); - if ( arguments.length === 1 ) { - return curOption[ key ] === undefined ? null : curOption[ key ]; - } - curOption[ key ] = value; - } else { - if ( arguments.length === 1 ) { - return this.options[ key ] === undefined ? null : this.options[ key ]; - } - options[ key ] = value; - } - } - - this._setOptions( options ); - - return this; - }, - _setOptions: function( options ) { - var key; - - for ( key in options ) { - this._setOption( key, options[ key ] ); - } - - return this; - }, - _setOption: function( key, value ) { - this.options[ key ] = value; - - if ( key === "disabled" ) { - this.widget() - .toggleClass( this.widgetFullName + "-disabled", !!value ); - - // If the widget is becoming disabled, then nothing is interactive - if ( value ) { - this.hoverable.removeClass( "ui-state-hover" ); - this.focusable.removeClass( "ui-state-focus" ); - } - } - - return this; - }, - - enable: function() { - return this._setOptions({ disabled: false }); - }, - disable: function() { - return this._setOptions({ disabled: true }); - }, - - _on: function( suppressDisabledCheck, element, handlers ) { - var delegateElement, - instance = this; - - // no suppressDisabledCheck flag, shuffle arguments - if ( typeof suppressDisabledCheck !== "boolean" ) { - handlers = element; - element = suppressDisabledCheck; - suppressDisabledCheck = false; - } - - // no element argument, shuffle and use this.element - if ( !handlers ) { - handlers = element; - element = this.element; - delegateElement = this.widget(); - } else { - element = delegateElement = $( element ); - this.bindings = this.bindings.add( element ); - } - - $.each( handlers, function( event, handler ) { - function handlerProxy() { - // allow widgets to customize the disabled handling - // - disabled as an array instead of boolean - // - disabled class as method for disabling individual parts - if ( !suppressDisabledCheck && - ( instance.options.disabled === true || - $( this ).hasClass( "ui-state-disabled" ) ) ) { - return; - } - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - - // copy the guid so direct unbinding works - if ( typeof handler !== "string" ) { - handlerProxy.guid = handler.guid = - handler.guid || handlerProxy.guid || $.guid++; - } - - var match = event.match( /^([\w:-]*)\s*(.*)$/ ), - eventName = match[1] + instance.eventNamespace, - selector = match[2]; - if ( selector ) { - delegateElement.delegate( selector, eventName, handlerProxy ); - } else { - element.bind( eventName, handlerProxy ); - } - }); - }, - - _off: function( element, eventName ) { - eventName = (eventName || "").split( " " ).join( this.eventNamespace + " " ) + - this.eventNamespace; - element.unbind( eventName ).undelegate( eventName ); - - // Clear the stack to avoid memory leaks (#10056) - this.bindings = $( this.bindings.not( element ).get() ); - this.focusable = $( this.focusable.not( element ).get() ); - this.hoverable = $( this.hoverable.not( element ).get() ); - }, - - _delay: function( handler, delay ) { - function handlerProxy() { - return ( typeof handler === "string" ? instance[ handler ] : handler ) - .apply( instance, arguments ); - } - var instance = this; - return setTimeout( handlerProxy, delay || 0 ); - }, - - _hoverable: function( element ) { - this.hoverable = this.hoverable.add( element ); - this._on( element, { - mouseenter: function( event ) { - $( event.currentTarget ).addClass( "ui-state-hover" ); - }, - mouseleave: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-hover" ); - } - }); - }, - - _focusable: function( element ) { - this.focusable = this.focusable.add( element ); - this._on( element, { - focusin: function( event ) { - $( event.currentTarget ).addClass( "ui-state-focus" ); - }, - focusout: function( event ) { - $( event.currentTarget ).removeClass( "ui-state-focus" ); - } - }); - }, - - _trigger: function( type, event, data ) { - var prop, orig, - callback = this.options[ type ]; - - data = data || {}; - event = $.Event( event ); - event.type = ( type === this.widgetEventPrefix ? - type : - this.widgetEventPrefix + type ).toLowerCase(); - // the original event may come from any element - // so we need to reset the target on the new event - event.target = this.element[ 0 ]; - - // copy original event properties over to the new event - orig = event.originalEvent; - if ( orig ) { - for ( prop in orig ) { - if ( !( prop in event ) ) { - event[ prop ] = orig[ prop ]; - } - } - } - - this.element.trigger( event, data ); - return !( $.isFunction( callback ) && - callback.apply( this.element[0], [ event ].concat( data ) ) === false || - event.isDefaultPrevented() ); - } -}; - -$.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) { - $.Widget.prototype[ "_" + method ] = function( element, options, callback ) { - if ( typeof options === "string" ) { - options = { effect: options }; - } - var hasOptions, - effectName = !options ? - method : - options === true || typeof options === "number" ? - defaultEffect : - options.effect || defaultEffect; - options = options || {}; - if ( typeof options === "number" ) { - options = { duration: options }; - } - hasOptions = !$.isEmptyObject( options ); - options.complete = callback; - if ( options.delay ) { - element.delay( options.delay ); - } - if ( hasOptions && $.effects && $.effects.effect[ effectName ] ) { - element[ method ]( options ); - } else if ( effectName !== method && element[ effectName ] ) { - element[ effectName ]( options.duration, options.easing, callback ); - } else { - element.queue(function( next ) { - $( this )[ method ](); - if ( callback ) { - callback.call( element[ 0 ] ); - } - next(); - }); - } - }; -}); - -var widget = $.widget; - - -/*! - * jQuery UI Mouse 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/mouse/ - */ - - -var mouseHandled = false; -$( document ).mouseup( function() { - mouseHandled = false; -}); - -var mouse = $.widget("ui.mouse", { - version: "1.11.4", - options: { - cancel: "input,textarea,button,select,option", - distance: 1, - delay: 0 - }, - _mouseInit: function() { - var that = this; - - this.element - .bind("mousedown." + this.widgetName, function(event) { - return that._mouseDown(event); - }) - .bind("click." + this.widgetName, function(event) { - if (true === $.data(event.target, that.widgetName + ".preventClickEvent")) { - $.removeData(event.target, that.widgetName + ".preventClickEvent"); - event.stopImmediatePropagation(); - return false; - } - }); - - this.started = false; - }, - - // TODO: make sure destroying one instance of mouse doesn't mess with - // other instances of mouse - _mouseDestroy: function() { - this.element.unbind("." + this.widgetName); - if ( this._mouseMoveDelegate ) { - this.document - .unbind("mousemove." + this.widgetName, this._mouseMoveDelegate) - .unbind("mouseup." + this.widgetName, this._mouseUpDelegate); - } - }, - - _mouseDown: function(event) { - // don't let more than one widget handle mouseStart - if ( mouseHandled ) { - return; - } - - this._mouseMoved = false; - - // we may have missed mouseup (out of window) - (this._mouseStarted && this._mouseUp(event)); - - this._mouseDownEvent = event; - - var that = this, - btnIsLeft = (event.which === 1), - // event.target.nodeName works around a bug in IE 8 with - // disabled inputs (#7620) - elIsCancel = (typeof this.options.cancel === "string" && event.target.nodeName ? $(event.target).closest(this.options.cancel).length : false); - if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) { - return true; - } - - this.mouseDelayMet = !this.options.delay; - if (!this.mouseDelayMet) { - this._mouseDelayTimer = setTimeout(function() { - that.mouseDelayMet = true; - }, this.options.delay); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = (this._mouseStart(event) !== false); - if (!this._mouseStarted) { - event.preventDefault(); - return true; - } - } - - // Click event may never have fired (Gecko & Opera) - if (true === $.data(event.target, this.widgetName + ".preventClickEvent")) { - $.removeData(event.target, this.widgetName + ".preventClickEvent"); - } - - // these delegates are required to keep context - this._mouseMoveDelegate = function(event) { - return that._mouseMove(event); - }; - this._mouseUpDelegate = function(event) { - return that._mouseUp(event); - }; - - this.document - .bind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) - .bind( "mouseup." + this.widgetName, this._mouseUpDelegate ); - - event.preventDefault(); - - mouseHandled = true; - return true; - }, - - _mouseMove: function(event) { - // Only check for mouseups outside the document if you've moved inside the document - // at least once. This prevents the firing of mouseup in the case of IE<9, which will - // fire a mousemove event if content is placed under the cursor. See #7778 - // Support: IE <9 - if ( this._mouseMoved ) { - // IE mouseup check - mouseup happened when mouse was out of window - if ($.ui.ie && ( !document.documentMode || document.documentMode < 9 ) && !event.button) { - return this._mouseUp(event); - - // Iframe mouseup check - mouseup occurred in another document - } else if ( !event.which ) { - return this._mouseUp( event ); - } - } - - if ( event.which || event.button ) { - this._mouseMoved = true; - } - - if (this._mouseStarted) { - this._mouseDrag(event); - return event.preventDefault(); - } - - if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) { - this._mouseStarted = - (this._mouseStart(this._mouseDownEvent, event) !== false); - (this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event)); - } - - return !this._mouseStarted; - }, - - _mouseUp: function(event) { - this.document - .unbind( "mousemove." + this.widgetName, this._mouseMoveDelegate ) - .unbind( "mouseup." + this.widgetName, this._mouseUpDelegate ); - - if (this._mouseStarted) { - this._mouseStarted = false; - - if (event.target === this._mouseDownEvent.target) { - $.data(event.target, this.widgetName + ".preventClickEvent", true); - } - - this._mouseStop(event); - } - - mouseHandled = false; - return false; - }, - - _mouseDistanceMet: function(event) { - return (Math.max( - Math.abs(this._mouseDownEvent.pageX - event.pageX), - Math.abs(this._mouseDownEvent.pageY - event.pageY) - ) >= this.options.distance - ); - }, - - _mouseDelayMet: function(/* event */) { - return this.mouseDelayMet; - }, - - // These are placeholder methods, to be overriden by extending plugin - _mouseStart: function(/* event */) {}, - _mouseDrag: function(/* event */) {}, - _mouseStop: function(/* event */) {}, - _mouseCapture: function(/* event */) { return true; } -}); - - -/*! - * jQuery UI Position 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/position/ - */ - -(function() { - -$.ui = $.ui || {}; - -var cachedScrollbarWidth, supportsOffsetFractions, - max = Math.max, - abs = Math.abs, - round = Math.round, - rhorizontal = /left|center|right/, - rvertical = /top|center|bottom/, - roffset = /[\+\-]\d+(\.[\d]+)?%?/, - rposition = /^\w+/, - rpercent = /%$/, - _position = $.fn.position; - -function getOffsets( offsets, width, height ) { - return [ - parseFloat( offsets[ 0 ] ) * ( rpercent.test( offsets[ 0 ] ) ? width / 100 : 1 ), - parseFloat( offsets[ 1 ] ) * ( rpercent.test( offsets[ 1 ] ) ? height / 100 : 1 ) - ]; -} - -function parseCss( element, property ) { - return parseInt( $.css( element, property ), 10 ) || 0; -} - -function getDimensions( elem ) { - var raw = elem[0]; - if ( raw.nodeType === 9 ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: 0, left: 0 } - }; - } - if ( $.isWindow( raw ) ) { - return { - width: elem.width(), - height: elem.height(), - offset: { top: elem.scrollTop(), left: elem.scrollLeft() } - }; - } - if ( raw.preventDefault ) { - return { - width: 0, - height: 0, - offset: { top: raw.pageY, left: raw.pageX } - }; - } - return { - width: elem.outerWidth(), - height: elem.outerHeight(), - offset: elem.offset() - }; -} - -$.position = { - scrollbarWidth: function() { - if ( cachedScrollbarWidth !== undefined ) { - return cachedScrollbarWidth; - } - var w1, w2, - div = $( "
" ), - innerDiv = div.children()[0]; - - $( "body" ).append( div ); - w1 = innerDiv.offsetWidth; - div.css( "overflow", "scroll" ); - - w2 = innerDiv.offsetWidth; - - if ( w1 === w2 ) { - w2 = div[0].clientWidth; - } - - div.remove(); - - return (cachedScrollbarWidth = w1 - w2); - }, - getScrollInfo: function( within ) { - var overflowX = within.isWindow || within.isDocument ? "" : - within.element.css( "overflow-x" ), - overflowY = within.isWindow || within.isDocument ? "" : - within.element.css( "overflow-y" ), - hasOverflowX = overflowX === "scroll" || - ( overflowX === "auto" && within.width < within.element[0].scrollWidth ), - hasOverflowY = overflowY === "scroll" || - ( overflowY === "auto" && within.height < within.element[0].scrollHeight ); - return { - width: hasOverflowY ? $.position.scrollbarWidth() : 0, - height: hasOverflowX ? $.position.scrollbarWidth() : 0 - }; - }, - getWithinInfo: function( element ) { - var withinElement = $( element || window ), - isWindow = $.isWindow( withinElement[0] ), - isDocument = !!withinElement[ 0 ] && withinElement[ 0 ].nodeType === 9; - return { - element: withinElement, - isWindow: isWindow, - isDocument: isDocument, - offset: withinElement.offset() || { left: 0, top: 0 }, - scrollLeft: withinElement.scrollLeft(), - scrollTop: withinElement.scrollTop(), - - // support: jQuery 1.6.x - // jQuery 1.6 doesn't support .outerWidth/Height() on documents or windows - width: isWindow || isDocument ? withinElement.width() : withinElement.outerWidth(), - height: isWindow || isDocument ? withinElement.height() : withinElement.outerHeight() - }; - } -}; - -$.fn.position = function( options ) { - if ( !options || !options.of ) { - return _position.apply( this, arguments ); - } - - // make a copy, we don't want to modify arguments - options = $.extend( {}, options ); - - var atOffset, targetWidth, targetHeight, targetOffset, basePosition, dimensions, - target = $( options.of ), - within = $.position.getWithinInfo( options.within ), - scrollInfo = $.position.getScrollInfo( within ), - collision = ( options.collision || "flip" ).split( " " ), - offsets = {}; - - dimensions = getDimensions( target ); - if ( target[0].preventDefault ) { - // force left top to allow flipping - options.at = "left top"; - } - targetWidth = dimensions.width; - targetHeight = dimensions.height; - targetOffset = dimensions.offset; - // clone to reuse original targetOffset later - basePosition = $.extend( {}, targetOffset ); - - // force my and at to have valid horizontal and vertical positions - // if a value is missing or invalid, it will be converted to center - $.each( [ "my", "at" ], function() { - var pos = ( options[ this ] || "" ).split( " " ), - horizontalOffset, - verticalOffset; - - if ( pos.length === 1) { - pos = rhorizontal.test( pos[ 0 ] ) ? - pos.concat( [ "center" ] ) : - rvertical.test( pos[ 0 ] ) ? - [ "center" ].concat( pos ) : - [ "center", "center" ]; - } - pos[ 0 ] = rhorizontal.test( pos[ 0 ] ) ? pos[ 0 ] : "center"; - pos[ 1 ] = rvertical.test( pos[ 1 ] ) ? pos[ 1 ] : "center"; - - // calculate offsets - horizontalOffset = roffset.exec( pos[ 0 ] ); - verticalOffset = roffset.exec( pos[ 1 ] ); - offsets[ this ] = [ - horizontalOffset ? horizontalOffset[ 0 ] : 0, - verticalOffset ? verticalOffset[ 0 ] : 0 - ]; - - // reduce to just the positions without the offsets - options[ this ] = [ - rposition.exec( pos[ 0 ] )[ 0 ], - rposition.exec( pos[ 1 ] )[ 0 ] - ]; - }); - - // normalize collision option - if ( collision.length === 1 ) { - collision[ 1 ] = collision[ 0 ]; - } - - if ( options.at[ 0 ] === "right" ) { - basePosition.left += targetWidth; - } else if ( options.at[ 0 ] === "center" ) { - basePosition.left += targetWidth / 2; - } - - if ( options.at[ 1 ] === "bottom" ) { - basePosition.top += targetHeight; - } else if ( options.at[ 1 ] === "center" ) { - basePosition.top += targetHeight / 2; - } - - atOffset = getOffsets( offsets.at, targetWidth, targetHeight ); - basePosition.left += atOffset[ 0 ]; - basePosition.top += atOffset[ 1 ]; - - return this.each(function() { - var collisionPosition, using, - elem = $( this ), - elemWidth = elem.outerWidth(), - elemHeight = elem.outerHeight(), - marginLeft = parseCss( this, "marginLeft" ), - marginTop = parseCss( this, "marginTop" ), - collisionWidth = elemWidth + marginLeft + parseCss( this, "marginRight" ) + scrollInfo.width, - collisionHeight = elemHeight + marginTop + parseCss( this, "marginBottom" ) + scrollInfo.height, - position = $.extend( {}, basePosition ), - myOffset = getOffsets( offsets.my, elem.outerWidth(), elem.outerHeight() ); - - if ( options.my[ 0 ] === "right" ) { - position.left -= elemWidth; - } else if ( options.my[ 0 ] === "center" ) { - position.left -= elemWidth / 2; - } - - if ( options.my[ 1 ] === "bottom" ) { - position.top -= elemHeight; - } else if ( options.my[ 1 ] === "center" ) { - position.top -= elemHeight / 2; - } - - position.left += myOffset[ 0 ]; - position.top += myOffset[ 1 ]; - - // if the browser doesn't support fractions, then round for consistent results - if ( !supportsOffsetFractions ) { - position.left = round( position.left ); - position.top = round( position.top ); - } - - collisionPosition = { - marginLeft: marginLeft, - marginTop: marginTop - }; - - $.each( [ "left", "top" ], function( i, dir ) { - if ( $.ui.position[ collision[ i ] ] ) { - $.ui.position[ collision[ i ] ][ dir ]( position, { - targetWidth: targetWidth, - targetHeight: targetHeight, - elemWidth: elemWidth, - elemHeight: elemHeight, - collisionPosition: collisionPosition, - collisionWidth: collisionWidth, - collisionHeight: collisionHeight, - offset: [ atOffset[ 0 ] + myOffset[ 0 ], atOffset [ 1 ] + myOffset[ 1 ] ], - my: options.my, - at: options.at, - within: within, - elem: elem - }); - } - }); - - if ( options.using ) { - // adds feedback as second argument to using callback, if present - using = function( props ) { - var left = targetOffset.left - position.left, - right = left + targetWidth - elemWidth, - top = targetOffset.top - position.top, - bottom = top + targetHeight - elemHeight, - feedback = { - target: { - element: target, - left: targetOffset.left, - top: targetOffset.top, - width: targetWidth, - height: targetHeight - }, - element: { - element: elem, - left: position.left, - top: position.top, - width: elemWidth, - height: elemHeight - }, - horizontal: right < 0 ? "left" : left > 0 ? "right" : "center", - vertical: bottom < 0 ? "top" : top > 0 ? "bottom" : "middle" - }; - if ( targetWidth < elemWidth && abs( left + right ) < targetWidth ) { - feedback.horizontal = "center"; - } - if ( targetHeight < elemHeight && abs( top + bottom ) < targetHeight ) { - feedback.vertical = "middle"; - } - if ( max( abs( left ), abs( right ) ) > max( abs( top ), abs( bottom ) ) ) { - feedback.important = "horizontal"; - } else { - feedback.important = "vertical"; - } - options.using.call( this, props, feedback ); - }; - } - - elem.offset( $.extend( position, { using: using } ) ); - }); -}; - -$.ui.position = { - fit: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollLeft : within.offset.left, - outerWidth = within.width, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = withinOffset - collisionPosLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - withinOffset, - newOverRight; - - // element is wider than within - if ( data.collisionWidth > outerWidth ) { - // element is initially over the left side of within - if ( overLeft > 0 && overRight <= 0 ) { - newOverRight = position.left + overLeft + data.collisionWidth - outerWidth - withinOffset; - position.left += overLeft - newOverRight; - // element is initially over right side of within - } else if ( overRight > 0 && overLeft <= 0 ) { - position.left = withinOffset; - // element is initially over both left and right sides of within - } else { - if ( overLeft > overRight ) { - position.left = withinOffset + outerWidth - data.collisionWidth; - } else { - position.left = withinOffset; - } - } - // too far left -> align with left edge - } else if ( overLeft > 0 ) { - position.left += overLeft; - // too far right -> align with right edge - } else if ( overRight > 0 ) { - position.left -= overRight; - // adjust based on position and margin - } else { - position.left = max( position.left - collisionPosLeft, position.left ); - } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.isWindow ? within.scrollTop : within.offset.top, - outerHeight = data.within.height, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = withinOffset - collisionPosTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - withinOffset, - newOverBottom; - - // element is taller than within - if ( data.collisionHeight > outerHeight ) { - // element is initially over the top of within - if ( overTop > 0 && overBottom <= 0 ) { - newOverBottom = position.top + overTop + data.collisionHeight - outerHeight - withinOffset; - position.top += overTop - newOverBottom; - // element is initially over bottom of within - } else if ( overBottom > 0 && overTop <= 0 ) { - position.top = withinOffset; - // element is initially over both top and bottom of within - } else { - if ( overTop > overBottom ) { - position.top = withinOffset + outerHeight - data.collisionHeight; - } else { - position.top = withinOffset; - } - } - // too far up -> align with top - } else if ( overTop > 0 ) { - position.top += overTop; - // too far down -> align with bottom edge - } else if ( overBottom > 0 ) { - position.top -= overBottom; - // adjust based on position and margin - } else { - position.top = max( position.top - collisionPosTop, position.top ); - } - } - }, - flip: { - left: function( position, data ) { - var within = data.within, - withinOffset = within.offset.left + within.scrollLeft, - outerWidth = within.width, - offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left, - collisionPosLeft = position.left - data.collisionPosition.marginLeft, - overLeft = collisionPosLeft - offsetLeft, - overRight = collisionPosLeft + data.collisionWidth - outerWidth - offsetLeft, - myOffset = data.my[ 0 ] === "left" ? - -data.elemWidth : - data.my[ 0 ] === "right" ? - data.elemWidth : - 0, - atOffset = data.at[ 0 ] === "left" ? - data.targetWidth : - data.at[ 0 ] === "right" ? - -data.targetWidth : - 0, - offset = -2 * data.offset[ 0 ], - newOverRight, - newOverLeft; - - if ( overLeft < 0 ) { - newOverRight = position.left + myOffset + atOffset + offset + data.collisionWidth - outerWidth - withinOffset; - if ( newOverRight < 0 || newOverRight < abs( overLeft ) ) { - position.left += myOffset + atOffset + offset; - } - } else if ( overRight > 0 ) { - newOverLeft = position.left - data.collisionPosition.marginLeft + myOffset + atOffset + offset - offsetLeft; - if ( newOverLeft > 0 || abs( newOverLeft ) < overRight ) { - position.left += myOffset + atOffset + offset; - } - } - }, - top: function( position, data ) { - var within = data.within, - withinOffset = within.offset.top + within.scrollTop, - outerHeight = within.height, - offsetTop = within.isWindow ? within.scrollTop : within.offset.top, - collisionPosTop = position.top - data.collisionPosition.marginTop, - overTop = collisionPosTop - offsetTop, - overBottom = collisionPosTop + data.collisionHeight - outerHeight - offsetTop, - top = data.my[ 1 ] === "top", - myOffset = top ? - -data.elemHeight : - data.my[ 1 ] === "bottom" ? - data.elemHeight : - 0, - atOffset = data.at[ 1 ] === "top" ? - data.targetHeight : - data.at[ 1 ] === "bottom" ? - -data.targetHeight : - 0, - offset = -2 * data.offset[ 1 ], - newOverTop, - newOverBottom; - if ( overTop < 0 ) { - newOverBottom = position.top + myOffset + atOffset + offset + data.collisionHeight - outerHeight - withinOffset; - if ( newOverBottom < 0 || newOverBottom < abs( overTop ) ) { - position.top += myOffset + atOffset + offset; - } - } else if ( overBottom > 0 ) { - newOverTop = position.top - data.collisionPosition.marginTop + myOffset + atOffset + offset - offsetTop; - if ( newOverTop > 0 || abs( newOverTop ) < overBottom ) { - position.top += myOffset + atOffset + offset; - } - } - } - }, - flipfit: { - left: function() { - $.ui.position.flip.left.apply( this, arguments ); - $.ui.position.fit.left.apply( this, arguments ); - }, - top: function() { - $.ui.position.flip.top.apply( this, arguments ); - $.ui.position.fit.top.apply( this, arguments ); - } - } -}; - -// fraction support test -(function() { - var testElement, testElementParent, testElementStyle, offsetLeft, i, - body = document.getElementsByTagName( "body" )[ 0 ], - div = document.createElement( "div" ); - - //Create a "fake body" for testing based on method used in jQuery.support - testElement = document.createElement( body ? "div" : "body" ); - testElementStyle = { - visibility: "hidden", - width: 0, - height: 0, - border: 0, - margin: 0, - background: "none" - }; - if ( body ) { - $.extend( testElementStyle, { - position: "absolute", - left: "-1000px", - top: "-1000px" - }); - } - for ( i in testElementStyle ) { - testElement.style[ i ] = testElementStyle[ i ]; - } - testElement.appendChild( div ); - testElementParent = body || document.documentElement; - testElementParent.insertBefore( testElement, testElementParent.firstChild ); - - div.style.cssText = "position: absolute; left: 10.7432222px;"; - - offsetLeft = $( div ).offset().left; - supportsOffsetFractions = offsetLeft > 10 && offsetLeft < 11; - - testElement.innerHTML = ""; - testElementParent.removeChild( testElement ); -})(); - -})(); - -var position = $.ui.position; - - -/*! - * jQuery UI Draggable 1.11.4 - * http://jqueryui.com - * - * Copyright jQuery Foundation and other contributors - * Released under the MIT license. - * http://jquery.org/license - * - * http://api.jqueryui.com/draggable/ - */ - - -$.widget("ui.draggable", $.ui.mouse, { - version: "1.11.4", - widgetEventPrefix: "drag", - options: { - addClasses: true, - appendTo: "parent", - axis: false, - connectToSortable: false, - containment: false, - cursor: "auto", - cursorAt: false, - grid: false, - handle: false, - helper: "original", - iframeFix: false, - opacity: false, - refreshPositions: false, - revert: false, - revertDuration: 500, - scope: "default", - scroll: true, - scrollSensitivity: 20, - scrollSpeed: 20, - snap: false, - snapMode: "both", - snapTolerance: 20, - stack: false, - zIndex: false, - - // callbacks - drag: null, - start: null, - stop: null - }, - _create: function() { - - if ( this.options.helper === "original" ) { - this._setPositionRelative(); - } - if (this.options.addClasses){ - this.element.addClass("ui-draggable"); - } - if (this.options.disabled){ - this.element.addClass("ui-draggable-disabled"); - } - this._setHandleClassName(); - - this._mouseInit(); - }, - - _setOption: function( key, value ) { - this._super( key, value ); - if ( key === "handle" ) { - this._removeHandleClassName(); - this._setHandleClassName(); - } - }, - - _destroy: function() { - if ( ( this.helper || this.element ).is( ".ui-draggable-dragging" ) ) { - this.destroyOnClear = true; - return; - } - this.element.removeClass( "ui-draggable ui-draggable-dragging ui-draggable-disabled" ); - this._removeHandleClassName(); - this._mouseDestroy(); - }, - - _mouseCapture: function(event) { - var o = this.options; - - this._blurActiveElement( event ); - - // among others, prevent a drag on a resizable-handle - if (this.helper || o.disabled || $(event.target).closest(".ui-resizable-handle").length > 0) { - return false; - } - - //Quit if we're not on a valid handle - this.handle = this._getHandle(event); - if (!this.handle) { - return false; - } - - this._blockFrames( o.iframeFix === true ? "iframe" : o.iframeFix ); - - return true; - - }, - - _blockFrames: function( selector ) { - this.iframeBlocks = this.document.find( selector ).map(function() { - var iframe = $( this ); - - return $( "
" ) - .css( "position", "absolute" ) - .appendTo( iframe.parent() ) - .outerWidth( iframe.outerWidth() ) - .outerHeight( iframe.outerHeight() ) - .offset( iframe.offset() )[ 0 ]; - }); - }, - - _unblockFrames: function() { - if ( this.iframeBlocks ) { - this.iframeBlocks.remove(); - delete this.iframeBlocks; - } - }, - - _blurActiveElement: function( event ) { - var document = this.document[ 0 ]; - - // Only need to blur if the event occurred on the draggable itself, see #10527 - if ( !this.handleElement.is( event.target ) ) { - return; - } - - // support: IE9 - // IE9 throws an "Unspecified error" accessing document.activeElement from an