<?php
header('Content-Type: application/json');

include "./../lib/send_reply_json.php";
include "./../setup/connect_db.php";

$maestroID = $_POST["maestro_id"];
$flagAllowEditEnterCode = $_POST["allowEditEnterCode"];


change_allow_edit_entercode($maestroID, $flagAllowEditEnterCode);

set_data("isActivated", $flagAllowEditEnterCode);
send_result_success();
exit;


function change_allow_edit_entercode($maestroID, $flagAllowEditEnterCode) {
	global $db_conn;

	$query = "
		UPDATE maestro
		SET AllowEditEnterCode = ?
		WHERE MaestroID = ?
	";
	$stmt = $db_conn->prepare($query);
	$stmt->bind_param("ii", $flagAllowEditEnterCode, $maestroID);
	$stmt->execute();
}

?>