Subversion Repository Public Repository

Nextrek

Diff Revisions 578 vs 579 for /Android/SmartCharging/endPoints/edit_locale.php

Diff revisions: vs.
  @@ -7,11 +7,12 @@
7 7 require_once("constants.php");
8 8
9 9 require_once("repositories/LocalRepository.php");
10 + require_once("repositories/UserRepository.php");
10 11 require_once("classes/Local.php");
11 12
12 - $servername = "localhost";
13 + /*$servername = "localhost";
13 14 $username = "smartcharging";
14 - $password = "LXRLBaEAuRr7M7jY";
15 + $password = "LXRLBaEAuRr7M7jY";*/
15 16
16 17 //$params = json_decode($_REQUEST["params"], true);
17 18
  @@ -25,12 +26,13 @@
25 26 $local_repo;
26 27
27 28 try {
28 - $conn = new PDO("mysql:host=".$servername.";dbname=smartcharging", $username, $password);
29 + $conn = new PDO("mysql:host=".DB_SERVERNAME.";dbname=".DB_NAME, DB_USERNAME, DB_PASSWORD);
29 30 $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
30 31 //echo "Connesso con successo al DB";
31 32
32 33 if (!array_key_exists("token", $params) || !UserRepository::checkToken($params["token"], $conn)) {
33 - $risposta["return"] = -1;
34 + $risposta = createErrorMessage(-1, "Token non valido");
35 + //$risposta["return"] = -1;
34 36 echo json_encode($risposta);
35 37 die();
36 38 }
  @@ -54,7 +56,8 @@
54 56 catch(PDOException $e)
55 57 {
56 58 echo $e->getMessage();
57 - $risposta["return"] = 1;
59 + $risposta = createErrorMessage(1, "Errore DB");
60 + //$risposta["return"] = 1;
58 61 } finally {
59 62 echo json_encode($risposta);
60 63 $conn = null; //Close the connection to the DBMS