Nextrek
Diff Revisions
542
vs
543
for /Android/SmartCharging/endPoints/nightly/delete_immagine.php
|
@@ -5,12 +5,13 @@ |
5 |
5 |
|
header('Content-Type: application/json; charset=UTF-8'); |
6 |
6 |
|
|
7 |
7 |
|
require_once("repositories/LocalRepository.php"); |
|
8 |
+ |
require_once("repositories/UserRepository.php"); |
8 |
9 |
|
require_once("repositories/CommentRepository.php"); |
9 |
10 |
|
require_once("constants.php"); |
10 |
11 |
|
|
11 |
|
- |
$servername = "localhost"; |
|
12 |
+ |
/*$servername = "localhost"; |
12 |
13 |
|
$username = "smartcharging"; |
13 |
|
- |
$password = "LXRLBaEAuRr7M7jY"; |
|
14 |
+ |
$password = "LXRLBaEAuRr7M7jY";*/ |
14 |
15 |
|
|
15 |
16 |
|
//$params = json_decode($_REQUEST["params"], true); |
16 |
17 |
|
|
|
@@ -26,6 +27,13 @@ |
26 |
27 |
|
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); |
27 |
28 |
|
//echo "Connesso con successo al DB"; |
28 |
29 |
|
|
|
30 |
+ |
if (!array_key_exists("token", $params) || !UserRepository::checkToken($params["token"], $conn)) { |
|
31 |
+ |
//$risposta["return"] = -1; |
|
32 |
+ |
$risposta = createErrorMessage(-1, "Token non valido"); |
|
33 |
+ |
echo json_encode($risposta); |
|
34 |
+ |
die(); |
|
35 |
+ |
} |
|
36 |
+ |
|
29 |
37 |
|
$type = $params["type"]; |
30 |
38 |
|
|
31 |
39 |
|
if ($type=="local") { |