Nextrek
Diff Revisions
507
vs
579
for /Android/SmartCharging/endPoints/get_info_small_locale.php
|
@@ -2,11 +2,13 @@ |
2 |
2 |
|
header("Access-Control-Allow-Origin: *"); |
3 |
3 |
|
header('Content-Type: application/json; charset=UTF-8'); |
4 |
4 |
|
|
|
5 |
+ |
require_once("constants.php"); |
|
6 |
+ |
|
5 |
7 |
|
require_once("repositories/LocalRepository.php"); |
6 |
8 |
|
|
7 |
|
- |
$servername = "localhost"; |
|
9 |
+ |
/*$servername = "localhost"; |
8 |
10 |
|
$username = "smartcharging"; |
9 |
|
- |
$password = "LXRLBaEAuRr7M7jY"; |
|
11 |
+ |
$password = "LXRLBaEAuRr7M7jY";*/ |
10 |
12 |
|
|
11 |
13 |
|
//$params = json_decode($_REQUEST["params"], true); |
12 |
14 |
|
|
|
@@ -19,7 +21,7 @@ |
19 |
21 |
|
$local; |
20 |
22 |
|
|
21 |
23 |
|
try { |
22 |
|
- |
$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); |
23 |
25 |
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
24 |
26 |
|
//echo "Connesso con successo al DB"; |
25 |
27 |
|
|
|
@@ -37,7 +39,8 @@ |
37 |
39 |
|
catch(PDOException $e) |
38 |
40 |
|
{ |
39 |
41 |
|
echo $e->getMessage(); |
40 |
|
- |
$risposta["return"] = 1; |
|
42 |
+ |
$risposta = createErrorMessage(1, "Errore DB"); |
|
43 |
+ |
//$risposta["return"] = 1; |
41 |
44 |
|
} |
42 |
45 |
|
|
43 |
46 |
|
echo json_encode($risposta); |