Subversion Repository Public Repository

Nextrek

Diff Revisions 507 vs 579 for /Android/SmartCharging/endPoints/get_immagini.php

Diff revisions: vs.
  @@ -6,9 +6,9 @@
6 6 require_once("repositories/CommentRepository.php");
7 7 require_once("constants.php");
8 8
9 - $servername = "localhost";
9 + /*$servername = "localhost";
10 10 $username = "smartcharging";
11 - $password = "LXRLBaEAuRr7M7jY";
11 + $password = "LXRLBaEAuRr7M7jY";*/
12 12
13 13 //$params = json_decode($_REQUEST["params"], true);
14 14
  @@ -21,7 +21,7 @@
21 21 $object;
22 22
23 23 try {
24 - $conn = new PDO("mysql:host=".$servername.";dbname=smartcharging", $username, $password);
24 + $conn = new PDO("mysql:host=".DB_SERVERNAME.";dbname=".DB_NAME, DB_USERNAME, DB_PASSWORD);
25 25 $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
26 26 //echo "Connesso con successo al DB";
27 27
  @@ -32,10 +32,12 @@
32 32 } else if ($type=="comment") {
33 33 $repo = new CommentRepository($conn);
34 34 } else {
35 - $risposta["type"] = "error";
35 + /*$risposta["type"] = "error";
36 36 $risposta["id"] = -1;
37 37 $risposta["imgs"] = null;
38 - $risposta["return"] = 1;
38 + $risposta["return"] = 1;*/
39 + $risposta = createErrorMessage(1, "Parametro \"type\" non valido");
40 + $risposta["type"] = "error";
39 41 }
40 42
41 43 $object = $repo->getImages($params["id"]);
  @@ -49,7 +51,8 @@
49 51 catch(PDOException $e)
50 52 {
51 53 echo $e->getMessage();
52 - $risposta["return"] = 1;
54 + $risposta = createErrorMessage(1, "Errore DB");
55 + //$risposta["return"] = 1;
53 56 }
54 57
55 58 echo json_encode($risposta);