<?php\r
\r
function api_put() {\r
+ // RÉCUPÉRATION DES DONNÉES\r
$data = file_get_contents("php://input");\r
- //file_put_contents('uploads/data', $data);\r
-\r
- $instanceManager = new PdoInstanceManager();\r
-\r
+ // CAS DE DECLARATION D'INFOS\r
if ($_GET['action'] == 'upload_info') {\r
- // DECODE JSON\r
+ // DECODE DU JSON\r
$array = json_decode($data, true);\r
- //var_dump($array);\r
-\r
+ // TEST DE CHAINE VIDE / CORROMPUE\r
if (!is_null($array) && assert($array)) {\r
- // MISE A JOUR INSTANCE\r
- $instanceManager -> updateInstanceInfos($array);\r
+ $instanceManager = new PdoInstanceManager();\r
+ // TEST DES INFORMATIONS ENVOYEES\r
+ $retour = $instanceManager->testInformationsAvantUpload($array);\r
+ if($retour === 'ok') {\r
+ // MISE A JOUR DES INFORMATIONS DE L'INSTANCE\r
+ $instanceManager -> updateInstanceInfos($array);\r
+ } else {\r
+ echo $retour;\r
+ }\r
}\r
}\r
\r