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
46
47
48
49
<?php
	require ("LocalRepository.php");
	require ("Local.php");

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

	$params = json_decode($_GET["params"], true); //da portare su POST la richiesta

	$conn;
	$risposta = array();
	$local = new Local();
	$local_repo;

	try {
    	$conn = new PDO("mysql:host=".$servername.";dbname=smartcharging", $username, $password);
    	$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    	//echo "Connesso con successo al DB";

    	$local_repo = new LocalRepository($conn);

    	$local->nominativo 		= $params["nominativo"];
    	$local->cell 			= $params["cell"];
    	$local->email 			= $params["email"];
    	$local->nomelocale 		= $params["nomelocale"];
    	$local->descrizione 	= $params["descrizione"];
    	$local->tipologia 		= $params["tipologia"];
    	$local->img1 			= $params["img1"];
    	$local->img2 			= $params["img2"];
    	$local->username 		= $params["username"];
    	$local->lat 			= array_key_exists("lat", $params)? $params["lat"] : null;
    	$local->lon 			= array_key_exists("lon", $params)? $params["lon"] : null;

    	$risposta["id"] = $local_repo->registerLocal($local, $params["password"]);		
		$risposta["return"] = 0;


    }
	catch(PDOException $e)
    {
   		echo $e->getMessage();
   		$risposta["return"] = 1;
    }

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

?>

Commits for Nextrek/Android/SmartCharging/endPoints/registrazione_locale.php

Diff revisions: vs.
Revision Author Commited Message
224 Diff Diff FSallustio picture FSallustio Wed 08 Jul, 2015 07:36:39 +0000

- Piccolo refactor (sia lato php che lato sql);
- set_position.php

223 Diff Diff FSallustio picture FSallustio Tue 07 Jul, 2015 15:54:32 +0000

Fix typo

222 FSallustio picture FSallustio Tue 07 Jul, 2015 15:51:51 +0000

- Prima versione di registrazione_utente.php e registrazione_locale.php
- Corretti i json degli stub (alcuni non erano corretti sintatticamente)