Subversion Repository Public Repository

Nextrek

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?php
    header("Access-Control-Allow-Origin: *");
    header('Content-Type: application/json; charset=UTF-8');

    require_once("constants.php");

	require_once("repositories/CommentRepository.php");

	/*$servername = "localhost";
	$username = "smartcharging";
	$password = "LXRLBaEAuRr7M7jY";*/

	//$params = json_decode($_REQUEST["params"], true);

    //$input = file_get_contents('php://input');
    $params = json_decode(file_get_contents('php://input'), true);

	$conn;
	$risposta = array();
	$comment_repo;
	$comments;

	try {
        
    	$conn = new PDO("mysql:host=".DB_SERVERNAME.";dbname=".DB_NAME, DB_USERNAME, DB_PASSWORD);
    	$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    	//echo "Connesso con successo al DB";
        
    	$comment_repo = new CommentRepository($conn);
    	$risposta = $comment_repo->getComment($params["id_user"], $params["id_local"]);

    }
	catch(PDOException $e)
    {
   		echo $e->getMessage();
        $risposta = createErrorMessage(1, "Errore DB");
        $risposta["comment"] = null;
   		/*$risposta["id"] = -1;
        $risposta["comments"] = null;*/
    }

    echo json_encode($risposta);
	$conn = null; //Close the connection to the DBMS

?>

Commits for Nextrek/Android/SmartCharging/endPoints/nightly/get_commento.php

Diff revisions: vs.
Revision Author Commited Message
728 Diff Diff FSallustio picture FSallustio Mon 14 Sep, 2015 06:08:22 +0000
695 FSallustio picture FSallustio Mon 07 Sep, 2015 10:31:36 +0000

Implementata chiamata get_commento.php