<?php

$jsonReply = array();

function set_error_message($message) {
	global $jsonReply;

	$jsonReply["error"] = $message;
}

function set_data($name, $data) {
	global $jsonReply;

	$jsonReply[$name] = $data;
}

function send_result_success() {
	global $jsonReply;
	global $db_conn;

	$jsonReply["result"] = "success";
	echo json_encode($jsonReply, JSON_UNESCAPED_UNICODE);
	$db_conn->close();
}

function set_error_code($data) {
	set_data("error_code", $data);
}

function send_result_fail() {
	global $jsonReply;
	global $db_conn;

	$jsonReply["result"] = "fail";
	echo json_encode($jsonReply, JSON_UNESCAPED_UNICODE);
	$db_conn->close();
}

?>