<?php
require_once "../../config.database.php";

if(!isset($_POST['license_key']) || !isset($_POST['enabled'])){
    echo "ERR"; 
    exit;
}

$license = $_POST['license_key'];
$enabled = (int)$_POST['enabled'];

$conn = new mysqli(FXH_DB_HOST, FXH_DB_USER, FXH_DB_PASS, FXH_DB_NAME);

if($conn->connect_errno){
    echo "ERR";
    exit;
}

$stmt = $conn->prepare("UPDATE fxh_licenses SET trade_enabled=? WHERE license_key=?");
$stmt->bind_param("is", $enabled, $license);
$stmt->execute();

echo "OK";
