<?php
$DB_DATABASE = "";
$prefix = "iitech_";
if(isset($_POST['database'])){
	$DB_DATABASE = $prefix.$_POST['database'];
}

// include db connect class
require_once __DIR__ . '/include/new_db_connect.php';

// connecting to db
$db = new DB_CONNECT($DB_DATABASE);


require_once 'include/user.php';

$matricule = "";
$tokenId  = "";

if(isset($_POST['matricule'])){
	$matricule = $_POST['matricule'];
}
if(isset($_POST['tokenId'])){
	$tokenId = $_POST['tokenId'];
}

// Instance of a User class
$tokenObject = new User();

// Registration of new user
if( !empty($matricule) && !empty($tokenId) ) {

	$json_token = $tokenObject->updateTokenInfo($tokenId, $matricule);
	
	echo json_encode($json_token);
}
?>