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
<?php
    header("Access-Control-Allow-Origin: *");
    header('Content-Type: application/json; charset=UTF-8');

    require_once("constants.php");
    
	require_once("repositories/UserRepository.php");

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

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

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

    	$checkToken = UserRepository::checkToken($params["token"], $conn);

        if ($checkToken) {
            $risposta["return"] = 0;
            $risposta["token"] = $params["token"];
        } else {
            $risposta["return"] = 1;
            $risposta["token"] = "";
        }

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

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

?>

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

Diff revisions: vs.
Revision Author Commited Message
517 Diff Diff FSallustio picture FSallustio Thu 20 Aug, 2015 14:25:03 +0000
415 FSallustio picture FSallustio Wed 22 Jul, 2015 08:27:42 +0000

Piccolo refactor dei file php...