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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
    header("Access-Control-Allow-Origin: *");
    header('Content-Type: application/json; charset=UTF-8');

	require_once("repositories/UserRepository.php");
	require_once("classes/User.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();
    $risposta["avatar"] = "";
	$user = new User();
	$user_repo;

    //var_dump($params);

	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";

    	$user_repo = new UserRepository($conn);

    	$user->username 		= $params["username"];
		//$user->nominativo		= $params["nominativo"];
        $user->nome             = $params["nome"];
        $user->cognome          = $params["cognome"];
    	$user->cell 			= $params["cell"];
    	$user->email 			= $params["email"];
    	//$user->avatar 		    = $params["avatar"];
    	//$user->is_owner			= 0; //non รจ un gestore

    	$risposta = $user_repo->registerUser($user, $params["password"]);

        $strToHash = $user->username.$user->nome.$user->cognome.$user->cell.$user->email;

        if ($params["avatar"] != "") {
            $imgExtention = substr(strrchr($params["avatar"],'.'),1);
            $risposta["avatar_name"] = uniqid().".".$imgExtention;
        }

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

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

?>

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

Diff revisions: vs.
Revision Author Commited Message
510 Diff Diff FSallustio picture FSallustio Thu 20 Aug, 2015 12:50:58 +0000

Merge ramo stable con la nightly.

507 Diff Diff FSallustio picture FSallustio Thu 20 Aug, 2015 07:51:22 +0000

Merge ramo stable con la nightly.

465 Diff Diff FSallustio picture FSallustio Mon 03 Aug, 2015 12:59:41 +0000
287 Diff Diff FSallustio picture FSallustio Mon 13 Jul, 2015 13:08:39 +0000
282 Diff Diff FSallustio picture FSallustio Mon 13 Jul, 2015 09:50:57 +0000
281 Diff Diff FSallustio picture FSallustio Mon 13 Jul, 2015 09:46:31 +0000

Inserito supporto all’upload degli avatar.

264 Diff Diff FSallustio picture FSallustio Fri 10 Jul, 2015 12:25:59 +0000

Risolto problema con l’application/json di registrazione_utente.php

249 Diff Diff FSallustio picture FSallustio Fri 10 Jul, 2015 07:17:20 +0000

Risolto bug chiamate POST

242 Diff Diff FSallustio picture FSallustio Thu 09 Jul, 2015 11:18:36 +0000

get_commenti.php implementata + bugfix

235 FSallustio picture FSallustio Thu 09 Jul, 2015 08:52:31 +0000

Reimplementati registrazione_utente.php e registrazione_locale.php