

Nextrek
@ 593
Nextrek / Android / SmartCharging / endPoints / nightly / get_commenti.php
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 46 47 48 49 |
<?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); $countComments = $comment_repo->countComments($params["id"]); $comments = $comment_repo->getComments($params["id"], $params["startIndex"], $params["length"]); $risposta["count"] = $countComments; $risposta["id"] = $params["id"]; $risposta["comments"] = $comments; } catch(PDOException $e) { echo $e->getMessage(); $risposta = createErrorMessage(1, "Errore DB"); /*$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_commenti.php
Revision | Author | Commited | Message |
---|---|---|---|
591
![]() |
![]() |
Thu 27 Aug, 2015 14:28:30 +0000 | |
587
![]() |
![]() |
Thu 27 Aug, 2015 13:28:12 +0000 | |
537
![]() |
![]() |
Mon 24 Aug, 2015 14:46:21 +0000 | |
517
![]() |
![]() |
Thu 20 Aug, 2015 14:25:03 +0000 | |
415
![]() |
![]() |
Wed 22 Jul, 2015 08:27:42 +0000 | Piccolo refactor dei file php... |
374 |
![]() |
Fri 17 Jul, 2015 08:20:18 +0000 | Creazione “branch” nightly |