Subversion Repository Public Repository

Nextrek

Diff Revisions 299 vs 300 for /Android/SmartCharging/endPoints/registrazione_locale.php

Diff revisions: vs.
  @@ -1,4 +1,6 @@
1 1 <?php
2 + session_start();
3 +
2 4 header("Access-Control-Allow-Origin: *");
3 5 header('Content-Type: application/json; charset=UTF-8');
4 6
  @@ -69,6 +71,19 @@
69 71 $risposta["local_id"] = $statusLocal["local_id"];
70 72 $risposta["return"] = $statusLocal["return"];
71 73
74 +
75 + $localImgs = array_key_exists("images", $_SESSION) ? $_SESSION["images"] : null;
76 +
77 + if ($risposta["return"] == 0 && count($localImgs)>0) {
78 + foreach($localImgs as $image) {
79 + rename("./images/temp/".session_id()."/".$image, "./images/".$image);
80 + }
81 + rmdir("./images/temp/".session_id()."/");
82 + $local_repo->addImages($risposta["local_id"], $localImgs);
83 + }
84 +
85 + unset($_SESSION["images"]);
86 +
72 87 echo json_encode($risposta);
73 88 }
74 89