<?php

require_once('config.php');

header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json; charset=utf-8');

$license_key = isset($_POST['license']) ? $_POST['license']: '';
$uuid = isset($_POST['uuid']) ? $_POST['uuid']: '';

if($license_key && $uuid){

  $license = $db->query("SELECT * FROM licenses WHERE license_key='$license_key' AND uuid='$uuid' AND deleted_at IS NULL")->fetch();

  if($license){
    $response = array("successful" => true);
  } else {
    $response = array("successful" => false);
  }
} else {
  $response = array("successful" => false, "error_title" => "Hata", "error_message" => "Boş alanlar var.");
}

echo json_encode($response, JSON_UNESCAPED_UNICODE);

?>
