<?php
ini_set("display_errors", 1);
error_reporting(E_ALL);

header("Content-Type: application/json; charset=utf-8");

$DB_HOST = "h30.core.hostnext.net";
$DB_USER = "ogerspkc_fxhai";
$DB_PASS = "Mustaffa@2040";
$DB_NAME = "ogerspkc_fxhai";

$mysqli = new mysqli($DB_HOST, $DB_USER, $DB_PASS, $DB_NAME);
if ($mysqli->connect_errno) {
    echo json_encode(["status"=>"error","message"=>"DB fail"]);
    exit;
}

$key     = isset($_GET["key"]) ? trim($_GET["key"]) : "";
$account = isset($_GET["account"]) ? trim($_GET["account"]) : "";

if ($key == "" || $account == "") {
    echo json_encode(["status"=>"error","message"=>"Missing input"]);
    exit;
}

$stmt = $mysqli->prepare("
    DELETE FROM fxh_license_activations
    WHERE license_key=? AND hwid=?
");
$stmt->bind_param("ss", $key, $account);
$stmt->execute();

echo json_encode([
    "status"=>"released",
    "message"=>"Activation removed",
    "account"=>$account,
    "key"=>$key
]);
exit;
?>
