Files
2025-10-18 10:19:37 +08:00

120 lines
3.3 KiB
PHP
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
function kanglehost_CreateSign($a, $r)
{
return md5($a . "hsxKjJeampw7AJtw" . $r);
}
function kanglehost_GetUrl($info, $skey, $r)
{
$url = "";
foreach ($info as $k => $v) {
$url .= $k . "=" . $v . "&";
}
return "http://38.55.233.203:3312/api/index.php?" . $url . "r=" . $r . "&s=" . $skey . "&json=1";
}
function 展示产品($业务元数据,$产品元数据) {
$Page = file_get_contents($_SERVER['DOCUMENT_ROOT'] . '/Main/ProductsModule/HK-FREE-EP/s.html');
$Page = @str_replace("<业务元数据>", 转JSON($业务元数据), $Page);
$Page = @str_replace("<产品元数据>", 转JSON($产品元数据), $Page);
$Page = @str_replace("<登录元数据>", 转JSON($业务元数据["extra_data"]), $Page);
return $Page;
}
function 开通产品($产品元数据,$产品唯一标识符) {
$a = "add_vh";
$r = rand(100000, 999999);
$user = 唯一随机字符串(10); // 随机生成用户名
$pass = 唯一随机字符串(15); // 随机生成密码
$currentDate = date('Y-m-d'); // 获取当前日期
$futureDate = date('Y-m-d', strtotime($currentDate . ' +30 days')); // 计算30天后的日期
$info = [
"c" => "whm",
"a" => $a,
"init" => 1,
"name" => $user,
"passwd" => $pass,
"product_id" => $产品元数据["extra_info"]
];
$skey = kanglehost_CreateSign($a, $r); // 修正函数名称大小写
$url = kanglehost_GetUrl($info, $skey, $r); // 修正函数名称大小写
$re = @file_get_contents($url);
$re = json_decode($re, true);
if (!isset($re['result'])) {
$code = 100; // 错误处理如果result不存在设为100
} else {
$code = $re['result'];
}
$储存数据 = [];
$储存数据["username"] = $user;
$储存数据["password"] = $pass;
$data["data"] = $储存数据;
if ($code == 200) {
$data['msg'] = $re;
$data['code'] = 200;
} else {
$data['msg'] = $re;
$data['code'] = 100;
}
return $data;
}
function show_product($data) {
$templatePath = './mods/us_m/index.html'; // 模板路径
$variables = $data;
return h_t($templatePath, $variables);
}
function long_product($data) {
$date = new DateTime($data['dqtime']);
$date->modify('+' . $data['Today'] . ' days'); // 假设'Today'是$data数组中的一个键
$data['dqtime'] = $date->format('Y-m-d');
return $data;
}
function 删除业务($业务元数据,$产品元数据) {
$username = @JSON解析($业务元数据["extra_data"])["username"];
$a = "del_vh";
$r = rand(100000, 999999);
$info = ["c" => "whm", "a" => $a, "name" => $username];
$skey = kanglehost_CreateSign($a, $r); // 修正函数名称大小写
$url = kanglehost_GetUrl($info, $skey, $r); // 修正函数名称大小写
$re = @file_get_contents($url);
$data['msg'] = $re;
$re = json_decode($re, true);
$data['code'] = $re["result"];
return $data;
}
function ready_products($data) {
$templatePath = './mods/us_m/ready.html'; // 模板路径
$variables = $data;
$variables["id"] = $_GET["id"];
return h_t($templatePath, $variables);
}