<?php
$DB_DATABASE = "";
$token = "";

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

$DB_DATABASE = "iitech_firebase";

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

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

// connecting to db
$bdd = connect($DB_DATABASE);

require_once __DIR__ . '/include/user.php';


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

// Registration of new user
if(!empty($token)) {
	$json_registration = $userObject->insertUserDeviceToken($token, $bdd);
	echo json_encode($json_registration);
}
?>