Last active
June 1, 2023 20:38
-
-
Save psycodeliccircus/378292701edadf84ed67afc7eb1d00a0 to your computer and use it in GitHub Desktop.
RKHM install
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($endpoint == "check_purchase_code") { | |
$code = bof()->nest->user_input("post", "code", "string"); | |
if (!$code) | |
throw new bofException("Código de compra inválido"); | |
// Verificação adicional ou processamento do código aqui | |
header("HTTP/1.1 201 OK"); | |
bof()->api->set_message("ok", [ | |
"license" => "Licença válida", | |
"server_ip" => "IP do servidor", | |
"server_name" => !empty($_SERVER["SERVER_NAME"]) ? "https://" . $_SERVER["SERVER_NAME"] : null | |
]); | |
} | |
elseif ($endpoint == "submit_purchase_code") { | |
$code = bof()->nest->user_input("post", "code", "string"); | |
$email = bof()->nest->user_input("post", "email", "string"); | |
$domain = bof()->nest->user_input("post", "domain", "url", array( | |
"remove_fragment" => true, | |
"remove_query" => true, | |
"accept_port" => true, | |
"accept_auth" => true, | |
"default_scheme_add" => true | |
)); | |
$web_address = $domain . (substr($domain, -1) == "/" ? "" : "/"); | |
if (!$code) | |
throw new bofException("Código de compra inválido"); | |
if (!$email) | |
throw new bofException("Email inválido"); | |
if (!$domain) | |
throw new bofException("Domínio inválido"); | |
// Remova a chamada para a API externa e a verificação do código de compra | |
$this->write_config_file("license", array( | |
"purchase_code" => $code, | |
"sign_code" => "valid", | |
"owner" => $email, | |
"vapid_public" => "public_key", | |
"vapid_private" => "private_key", | |
"sign_key" => "sign_key" | |
)); | |
$this->write_config_file("user", array( | |
"web_address" => $web_address, | |
)); | |
header("HTTP/1.1 201 OK"); | |
bof()->api->set_message("ok"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment